public class EssenceAccess extends EssenceMultiAccess implements EssenceAccess, Serializable
| Constructor and Description |
|---|
EssenceAccess(MaterialPackage masterMob,
AUIDImpl mediaKind,
AUIDImpl codecID,
Rational editRate,
Rational sampleRate,
Rational compEnable,
EssenceType essencetype) |
| Modifier and Type | Method and Description |
|---|---|
static EssenceAccess |
castFromInterface(EssenceAccess alien)
Cast a
EssenceAccess
value from the generic interface to this implementation of
the interface. |
void |
completeWrite()
Handle any format related writing at the end of the essence and adjust
package lengths as required.
|
long |
countSamples(DataDefinition dataDef)
Returns the number of samples of the given essence type on the
essence stream.
|
AUIDImpl |
getCodecID()
Returns the identifier of the codec being used to handle the specified
essence.
|
String |
getCodecName()
Returns the friendly name of the codec expanded for human
consumption.
|
EssenceFormat |
getEmptyFileFormat()
Returns an empty
EssenceFormat object. |
EssenceFormat |
getFileFormat(EssenceFormat opsTemplate)
Given an AAFEssenceFormat, read the essence parameters inside
and set the values from the file format.
|
EssenceFormat |
getFileFormatParametersList()
Returns a list of all file format parameters supported by
the current codec.
|
long |
getIndexedSampleSize(DataDefinition dataDef,
long frameNum)
Returns the size in bytes of the given sample for a given essence
type.
|
long |
getLargestSampleSize(DataDefinition dataDef)
Returns the size in bytes of the largest sample for a given
essence type.
|
int |
getSamplesActuallyRead()
Returns the number of samples actually read by the last call
to
EssenceAccess.readSamples(int). |
void |
putFileFormat(EssenceFormat ops)
Given an
EssenceFormat, read the essence parameters inside
and change the file format. |
byte[] |
readSamples(int samples)
Read a given number of samples from an opened essence stream.
|
void |
seek(long sampleFrameNum)
The seek function for essence.
|
void |
setEssenceCodecFlavour(AUID flavour)
Sets which flavour of the codec for the essence is to be used.
|
void |
setTransformParameters(List<? extends EssenceFormat> op)
Sets a series of format objects which will be used to describe the
in-memory format.
|
int |
writeSamples(int samples,
byte[] buffer)
Writes data to the essence stream.
|
castFromInterface, readMultiSamples, writeMultiSamplesequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadMultiSamples, writeMultiSamplespublic EssenceAccess(MaterialPackage masterMob, AUIDImpl mediaKind, AUIDImpl codecID, Rational editRate, Rational sampleRate, Rational compEnable, EssenceType essencetype)
public static final EssenceAccess castFromInterface(EssenceAccess alien) throws NullPointerException
Cast a EssenceAccess
value from the generic interface to this implementation of
the interface. If the given value is not a native implementation, a copy will be
instanciated using get and set methods.
alien - A potentially alien implementation of an instance of the EssenceAccess
interface.NullPointerException - Argument is null.public void completeWrite()
throws StreamFullException
EssenceAccessHandle any format related writing at the end of the essence and adjust package lengths as required. Must be called before releasing a write essence access.
completeWrite in interface EssenceAccessStreamFullException - The stream has insufficient capacity to complete the
write operation.EssenceAccess.completeWrite()public long countSamples(DataDefinition dataDef) throws NullPointerException
EssenceAccessReturns the number of samples of the given essence type on the essence stream. A video sample is one frame.
countSamples in interface EssenceAccessdataDef - Type of essence to count.NullPointerException - The given essence type is null.EssenceAccess.countSamples(tv.amwa.maj.model.DataDefinition)public AUIDImpl getCodecID()
EssenceAccessReturns the identifier of the codec being used to handle the specified essence. This will be required in order to be able to send private data to the codec.
getCodecID in interface EssenceAccessEssenceAccess.getCodecID()public String getCodecName()
EssenceAccessReturns the friendly name of the codec expanded for human consumption. No other call uses this name, so it may be fully descriptive, especially of limitations.
getCodecName in interface EssenceAccessEssenceAccess.getCodecName()public EssenceFormat getEmptyFileFormat()
EssenceAccessReturns an empty EssenceFormat object. This is the factory
method for EssenceFormat.
getEmptyFileFormat in interface EssenceAccessEssenceAccess.getEmptyFileFormat()public EssenceFormat getFileFormat(EssenceFormat opsTemplate) throws NullPointerException, InvalidParameterException
EssenceAccessGiven an AAFEssenceFormat, read the essence parameters inside and set the values from the file format.
getFileFormat in interface EssenceAccessopsTemplate - An EssenceFormat with parameter codes set
but no values.EssenceFormat with values set.NullPointerException - Argument is null.InvalidParameterException - Matching parameter not found.EssenceAccess.getFileFormat(tv.amwa.maj.model.EssenceFormat)public EssenceFormat getFileFormatParametersList()
EssenceAccessReturns a list of all file format parameters supported by the current codec.
getFileFormatParametersList in interface EssenceAccessEssenceAccess.getFileFormatParametersList()public long getIndexedSampleSize(DataDefinition dataDef, long frameNum) throws NullPointerException, BadSampleOffsetException
EssenceAccessReturns the size in bytes of the given sample for a given essence type. For uncompressed data, or the output of the software codec, the sample size is likely be a constant value.
The essence type parameter exists to support codecs with multiple interleaved essence types.
getIndexedSampleSize in interface EssenceAccessdataDef - The essence type.frameNum - The 0-based index of a sample frame number.NullPointerException - The given essence type is null.BadSampleOffsetException - The supplied sample offset is outside
the acceptable range for the essence.EssenceAccess.getIndexedSampleSize(tv.amwa.maj.model.DataDefinition, long)public long getLargestSampleSize(DataDefinition dataDef) throws NullPointerException
EssenceAccessReturns the size in bytes of the largest sample for a given essence type.
For uncompressed data, or the output of the software codec, the sample size is likely to be a constant value.
The essence type parameter exists to support codecs with multiple interleaved essence types.
getLargestSampleSize in interface EssenceAccessdataDef - The essence type.NullPointerException - The given essence type is nullEssenceAccess.getLargestSampleSize(tv.amwa.maj.model.DataDefinition)public int getSamplesActuallyRead()
EssenceAccessReturns the number of samples actually read by the last call
to EssenceAccess.readSamples(int).
getSamplesActuallyRead in interface EssenceAccessEssenceAccess.readSamples(int) has not previously been called or
0 samples were read.EssenceAccess.getSamplesActuallyRead()public void putFileFormat(EssenceFormat ops) throws NullPointerException
EssenceAccessGiven an EssenceFormat, read the essence parameters inside
and change the file format.
putFileFormat in interface EssenceAccessops - An EssenceFormat with one or more parameter/value
pairs.NullPointerException - Argument is null.EssenceAccess.putFileFormat(tv.amwa.maj.model.EssenceFormat)public byte[] readSamples(int samples)
throws EndOfDataException
EssenceAccessRead a given number of samples from an opened essence stream. This call will only return a single channel of essence from an interleaved stream. A signle video sample is a frame.
readSamples in interface EssenceAccesssamples - Read this many samples.EndOfDataException - Hit the end of the essence (like EOF)
while reading.EssenceAccess.readSamples(int)public void seek(long sampleFrameNum)
throws BadSampleOffsetException
EssenceAccessThe seek function for essence. Useful only on reading as you cannot seek around while writing essence.
An audio frame is one sample across all channels.
seek in interface EssenceAccesssampleFrameNum - A 0-based offset in units of the sample rate
to seek to.BadSampleOffsetException - Hit the end of the essence (like EOF)
while reading.EssenceAccess.seek(long)public void setEssenceCodecFlavour(AUID flavour) throws NullPointerException
EssenceAccessSets which flavour of the codec for the essence is to be used.
setEssenceCodecFlavour in interface EssenceAccessflavour - The codec flavour to be used.NullPointerException - The given codec flavour is null.EssenceAccess.setEssenceCodecFlavour(tv.amwa.maj.record.AUID)public void setTransformParameters(List<? extends EssenceFormat> op) throws NullPointerException
EssenceAccessSets a series of format objects which will be used to describe the in-memory format. This is the format expected on writes and produced on reads. On writes, the data will be written in this format, except where a software codec may be used. On reads, the data will be translated to this format.
The order of the parameters does matter, as transformations will be applied in that order to get from the on-disk format to the in-memory format.
setTransformParameters in interface EssenceAccessop - An ordered list iterator over transforms to apply to the
essence if required.NullPointerException - Argument is null.tv.amwa.maj.model.EssenceAccess#setTransformParameters(java.util.ListIterator)public int writeSamples(int samples,
byte[] buffer)
throws NullPointerException,
SingleChannelOpException
EssenceAccessWrites data to the essence stream.
A single video frame is one sample.
writeSamples in interface EssenceAccesssamples - Write this many samples.buffer - Buffer to write data from.NullPointerException - The given buffer is null.SingleChannelOpException - Tried to write to an interleaved
stream.EssenceAccess.writeSamples(int, byte[])(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.