@MediaClass(uuid1=218169601, uuid2=257, uuid3=8960, uuid4={6,14,43,52,2,6,1,1}, definedName="EssenceData", description="The EssenceData class contains essence.", symbol="EssenceData") public class EssenceDataImpl extends InterchangeObjectImpl implements EssenceData, Serializable, Cloneable
Implements an essence container. The methods can be used to modify essence data objects that contain the actual essence data (excluding WAVE) when it is contained within an AAF file. Normally, the client application would access the essence through the essence access interface, which handles the work of finding and (de)compressing the data. However, in rare cases direct access to the data is required, the read and write methods of this interface are provided.
ObjectClassPropertyID| Constructor and Description |
|---|
EssenceDataImpl() |
EssenceDataImpl(SourcePackage sourcePackage,
Stream data)
Creates and initializes a new essence data object that contains essence.
|
| Modifier and Type | Method and Description |
|---|---|
EssenceData |
clone()
Cloned essence data contains the same file package and data, which are not themselves cloned.
|
int |
getBodySID()
Returns the identifier for the essence container of this this essence data, known as the
body stream identifier.
|
Stream |
getEssenceStream()
Returns the underlying essence stream of this essence data.
|
SourcePackage |
getFilePackage()
Returns a reference to the file source package that describes this essence
data.
|
int |
getIndexSID()
Returns the identifier of the index table for the essence container of this essence
data.
|
PackageID |
getLinkedPackageID()
Returns the oackage id of the file source package that describes this essence data.
|
String |
getLinkedPackageIDString() |
long |
getPosition()
Get the absolute position within the stream of essence data.
|
Stream |
getSampleIndex()
Returns the sample index for the essence data, which contains an index to the
samples or frames.
|
long |
getSampleIndexPosition()
Returns the current sample index position, measured in bytes rather than samples.
|
long |
getSampleIndexSize()
Returns the total size of the sample index data, measured in bytes rather than the
total number of samples.
|
long |
getSize()
Returns the total size of the stream of essence data.
|
static PackageID |
initializeLinkedPackageID() |
ByteBuffer |
read(int bytes)
Read the given number of bytes from the pre-interleaved data of an essence stream
at the current position.
|
ByteBuffer |
readSampleIndex(int size)
Reads raw data from a sample index stream at the current sample
index position.
|
void |
setBodySID(Integer bodySID)
Sets the identifier for the essence container of this essence data, known as the
body stream identifier.
|
void |
setEssenceStream(Stream data)
Sets the underlying essence stream of this essence data.
|
void |
setFilePackage(SourcePackage packageToSet)
Sets a reference to the file source package that describes this essence
data.
|
void |
setIndexSID(Integer indexSID)
Sets the identifier of the index table for the essence container of this essence data.
|
void |
setLinkedPackageID(PackageID linkedPackageID) |
void |
setLinkedPackageIDString(String linkedPackageID) |
void |
setPosition(long offset)
Seek to an absolute position within the stream of essence data.
|
void |
setSampleIndex(Stream sampleIndex)
Set the sample index of this essence data to the given
stream.
|
void |
setSampleIndexPosition(long offset)
Seek to an absolute position within the sample index data, measured in bytes
rather than samples.
|
void |
setSampleIndexSize(long sampleIndexSize)
Sets the size of the sample index.
|
int |
write(ByteBuffer buffer)
Write a pre-interleaved data item into the essence stream, starting
at the current position.
|
int |
writeSampleIndex(ByteBuffer buffer)
Writes the given sample index data to the sample index data at
the current sample index stream position.
|
addApplicationPlugin, appendXMLChildren, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getComment, getGeneration, getLinkedGenerationID, getLinkedGenerationIDString, getObjectClass, getPersistentID, getPersistentIndex, hashCode, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setLinkedGenerationIDString, setObjectClass, setPersistentID, setPersistentIndex, toStringaddApplicationPlugin, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getObjectClass, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setObjectClass, toStringgetPersistentID, setPersistentIndexpublic EssenceDataImpl()
public EssenceDataImpl(SourcePackage sourcePackage, Stream data) throws NullPointerException
Creates and initializes a new essence data object that contains essence. This method requires a weak reference to the corresponding metadata source package of the essence data itself.
sourcePackage - Identifies the source package that describes the essence.data - The essence data.NullPointerException - One or both of the arguments is/are null.@MediaProperty(uuid1=100729094, uuid2=256, uuid3=0, uuid4={6,14,43,52,1,1,1,2}, definedName="LinkedPackageID", aliases={"MobID","EssenceDataMobID"}, typeName="PackageIDType", optional=false, uniqueIdentifier=true, pid=9985, symbol="LinkedPackageID") public PackageID getLinkedPackageID()
EssenceDataReturns the oackage id of the file source package that describes this essence data. The linked source package must exist in the same file as the essence data.
This is a required persistent property of essence data.
getLinkedPackageID in interface EssenceData@MediaPropertySetter(value="LinkedPackageID") public void setLinkedPackageID(PackageID linkedPackageID)
public static final PackageID initializeLinkedPackageID()
public SourcePackage getFilePackage()
EssenceDataReturns a reference to the file source package that describes this essence
data. This method will return null unless the file package reference has previously
been set using EssenceData.setFilePackage(SourcePackage).
getFilePackage in interface EssenceDatapublic void setFilePackage(SourcePackage packageToSet) throws NullPointerException
EssenceDataSets a reference to the file source package that describes this essence data. This reference will provide the persistent file package id property for this essence data.
setFilePackage in interface EssenceDatapackageToSet - Reference to a source package that describes this essence data.NullPointerException - The given file source package is null.public long getPosition()
throws IOException
EssenceDataGet the absolute position within the stream of essence data.
getPosition in interface EssenceDataIOException - Error trying to determine position from the underlying
stream.public long getSampleIndexPosition()
throws PropertyNotPresentException,
IOException
EssenceDataReturns the current sample index position, measured in bytes rather than samples. The sample index stream contains an index to the samples or frames. The format of the index is determined by the associated codec. The sample index property is optional.
getSampleIndexPosition in interface EssenceDataPropertyNotPresentException - The optional sample index data is not present for this
essence data.IOException - Error trying to retrieve the position from the underlying stream.public long getSampleIndexSize()
throws PropertyNotPresentException,
IOException
EssenceDataReturns the total size of the sample index data, measured in bytes rather than the total number of samples. The sample index stream contains an index to the samples or frames. The format of the index is determined by the associated codec. The sample index property is optional.
getSampleIndexSize in interface EssenceDataPropertyNotPresentException - The optional sample index data is not present for this
essence data.IOException - Error accessing the underlying stream to determine the stream length.public void setSampleIndexSize(@LengthType long sampleIndexSize) throws IllegalArgumentException, NotImplementedException
EssenceDataSets the size of the sample index. The sample index stream contains an index to the samples or frames. The format of the index is determined by the associated codec. Set this value to 0 to omit this optional property.
This method will extend an existing buffer but will not truncate it. To decrease the size of the buffer, copy the data, call this method with 0 and then write the copied bytes back into the buffer.
setSampleIndexSize in interface EssenceDatasampleIndexSize - Size for the sample index data.IllegalArgumentException - The given sample index size is negative or smaller
than the sample index already stored.NotImplementedException - Creating a non existent buffer is not supported in
this version of MAJ.public long getSize()
throws IOException
EssenceDataReturns the total size of the stream of essence data.
getSize in interface EssenceDataIOException - Error accessing the underlying stream to determine the length.public ByteBuffer read(int bytes) throws IOException, EndOfDataException
EssenceDataRead the given number of bytes from the pre-interleaved data of an essence stream at the current position.
read in interface EssenceDatabytes - Number of bytes to read from the data streamIOException - Error when trying to read data from the underlying stream.EndOfDataException - Attempting to read beyond the bounds of the data
stream.public ByteBuffer readSampleIndex(int size) throws PropertyNotPresentException, IOException, EndOfDataException
EssenceDataReads raw data from a sample index stream at the current sample index position. The sample index stream contains an index to the samples or frames. The format of the index is determined by the associated codec which is why the parameter of this method is measured in bytes rather than number of samples. The sample index property is optional.
readSampleIndex in interface EssenceDatasize - Read this many bytes from the sample index stream.PropertyNotPresentException - The optional sample index property is
not present for this essence data.IOException - Error trying to read data from the underlying stream.EndOfDataException - Cannot read data beyond the end of the sample
index.public void setPosition(long offset)
throws IllegalArgumentException,
IOException
EssenceDataSeek to an absolute position within the stream of essence data.
setPosition in interface EssenceDataoffset - Offset from the beginning of the essence.IllegalArgumentException - Cannot set the position outside the bounds of
the underlying stream.IOException - An error occurred when trying to set the position for
the underlying stream.public void setSampleIndexPosition(@PositionType long offset) throws PropertyNotPresentException, IllegalArgumentException, IOException
EssenceDataSeek to an absolute position within the sample index data, measured in bytes rather than samples. The sample index stream contains an index to the samples or frames. The format of the index is determined by the associated codec. If the given offset is beyond the end of the stream, the position is set to be the end of the stream.
setSampleIndexPosition in interface EssenceDataoffset - Offset from the beginning of the data measured in
bytes.PropertyNotPresentException - The optional sample index property is not
present for this essence data.IllegalArgumentException - Cannot set the position outside the bounds of the
underlying stream.IOException - Error trying to set the position for the underlying stream.public int write(ByteBuffer buffer) throws EndOfDataException, IOException
EssenceDataWrite a pre-interleaved data item into the essence stream, starting at the current position. The number of bytes actually written into the essence data is returned.
write in interface EssenceDatabuffer - Buffer containing the data to be written.EndOfDataException - Cannot write beyond the end of the bounds of the
underlying stream.IOException - Error occurred when trying to write data to the
underlying stream.public int writeSampleIndex(ByteBuffer buffer) throws PropertyNotPresentException, EndOfDataException, IOException
EssenceDataWrites the given sample index data to the sample index data at the current sample index stream position. The sample index stream contains an index to the samples or frames. The format of the index is determined by the associated codec. The number of samples actually written is returned and may be less than those requested at the end of the buffer.
The sample index property is optional. It is not possible to write sample index
data if the property is not present. To write data, call EssenceData.setSampleIndexSize(long)
first with sufficient size to write the required buffer.
writeSampleIndex in interface EssenceDatabuffer - Buffer of sample data to write into the essence data.PropertyNotPresentException - The optional sample index data is not present for
this essence data.EndOfDataException - Cannot write data beyond the bounds of the sample index
stream.IOException - Error occurred when trying to write data to the underlying stream.EssenceData.getSampleIndexPosition()@MediaProperty(uuid1=67568128, uuid2=0, uuid3=0, uuid4={6,14,43,52,1,1,1,2}, definedName="EssenceStream", aliases="Data", typeName="Stream", optional=true, uniqueIdentifier=false, pid=9986, symbol="EssenceStream") public Stream getEssenceStream() throws PropertyNotPresentException
EssenceDataReturns the underlying essence stream of this essence data. This is an optional property for MXF applications only, where the body stream identifier is used instead.
getEssenceStream in interface EssenceDataPropertyNotPresentException - The essence stream data is not (yet) present for this
essence data.EssenceData.read(int),
EssenceData.write(ByteBuffer),
EssenceData.getPosition(),
EssenceData.setPosition(long),
EssenceData.getSize()@MediaPropertySetter(value="EssenceStream") public void setEssenceStream(Stream data)
EssenceDataSets the underlying essence stream of this essence data. This is an optional
property for MXF applications only, where the body stream identifier
is used instead. Set this optional property to null to omit it.
setEssenceStream in interface EssenceDatadata - Underlying essence stream of this essence data.EssenceData.read(int),
EssenceData.write(ByteBuffer),
EssenceData.getPosition(),
EssenceData.setPosition(long),
EssenceData.getSize()@MediaProperty(uuid1=100729090, uuid2=256, uuid3=0, uuid4={6,14,43,52,1,1,1,2}, definedName="SampleIndex", typeName="Stream", optional=true, uniqueIdentifier=false, pid=11009, symbol="SampleIndex") public Stream getSampleIndex() throws PropertyNotPresentException
EssenceDataReturns the sample index for the essence data, which contains an index to the samples or frames. The format of the index is determined by the associated codec. This is an optional property.
getSampleIndex in interface EssenceDataPropertyNotPresentException - The optional sample index is not present for
this essence data.@MediaPropertySetter(value="SampleIndex") public void setSampleIndex(Stream sampleIndex)
EssenceDataSet the sample index of this essence data to the given
stream. Set this optional
property to null to omit it.
setSampleIndex in interface EssenceDatasampleIndex - Stream of sample index data.public EssenceData clone()
Cloned essence data contains the same file package and data, which are not themselves cloned.
clone in interface MediaEntityclone in interface EssenceDataclone in interface InterchangeObjectclone in class InterchangeObjectImplObject.clone()public String getLinkedPackageIDString()
public void setLinkedPackageIDString(String linkedPackageID)
@MediaProperty(uuid1=16974853, uuid2=0, uuid3=0, uuid4={6,14,43,52,1,1,1,4}, definedName="IndexSID", typeName="UInt32", optional=true, uniqueIdentifier=false, pid=16134, symbol="IndexSID") @UInt32 public int getIndexSID() throws PropertyNotPresentException
EssenceDataReturns the identifier of the index table for the essence container of this essence data. The index stream identifier is an optional property used in the encoding of essence streams in MXF files.
getIndexSID in interface EssenceDataPropertyNotPresentException - The optional index table stream identifier property
is not present for this essence data.IndexTableSegment,
PartitionPack.getIndexSID()@MediaPropertySetter(value="IndexSID") public void setIndexSID(@UInt32 Integer indexSID) throws IllegalArgumentException
EssenceDataSets the identifier of the index table for the essence container of this essence data.
The index stream identifier is an optional property used in the encoding of essence streams
in MXF files. Set this optional property to null to omit it.
setIndexSID in interface EssenceDataindexSID - Identifier of the index table for the essence container of this essence data.IllegalArgumentException - Cannot set the index stream identifier to a negative value.IndexTableSegment,
PartitionPack.getIndexSID()@MediaProperty(uuid1=16974852, uuid2=0, uuid3=0, uuid4={6,14,43,52,1,1,1,4}, definedName="BodySID", typeName="UInt32", optional=true, uniqueIdentifier=false, pid=16135, symbol="BodySID") @UInt32 public int getBodySID() throws PropertyNotPresentException
EssenceDataReturns the identifier for the essence container of this this essence data, known as the body stream identifier. The body stream identifier is an optional property used in the encoding of essence streams in MXF files.
getBodySID in interface EssenceDataPropertyNotPresentException - The optional body stream identifier property is not
present for this essence data.EssencePartition,
PartitionPack.getBodySID()@MediaPropertySetter(value="BodySID") public void setBodySID(@UInt32 Integer bodySID) throws IllegalArgumentException
EssenceDataSets the identifier for the essence container of this essence data, known as the
body stream identifier. The body stream identifier is an optional property used in
the encoding of essence streams in MXF files. Set this optional property to null
to omit it.
setBodySID in interface EssenceDatabodySID - Identifier for the essence container of this essence data.IllegalArgumentException - Cannot set the body stream identifier to a negative value.EssencePartition,
PartitionPack.getBodySID()(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.