|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tv.amwa.maj.entity.InterchangeObject tv.amwa.maj.entity.Component tv.amwa.maj.entity.Segment tv.amwa.maj.entity.TimecodeStream tv.amwa.maj.entity.TimecodeStream12M
@AAFClass(uuid1=218169601, uuid2=257, uuid3=5632, uuid4={6,14,43,52,2,6,1,1}, definedName="TimecodeStream12M", description="The TimecodeStream12M class specifies a stream of timecode data in the SMPTE 12M format.") public class TimecodeStream12M
Implements a representation of a stream of timecode data in the SMPTE 12M format.
THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.
The byte stream is laid out as a sequence of bits numbered 0-79 with bit 0 being the first bit. The data is stored as a 10-byte array, and bit 0 is the MSB of the first byte.
The bit definitions are as follows:
bits | description | extraction expression |
0-3 | units of frames | (foo[bits0_7] >> 4) & 0x0F |
4-7 | first binary group | foo[bits0_7] & 0x0F |
8-9 | tens of frames | (foo[bits8_15] >> 6) & 0x03 |
10 | drop frame | (foo[bits8_15] >> 5) & 0x01 |
11 | color frame | (foo[bits8_15] >> 4) & 0x01 |
12-15 | second binary group | foo[bits8_15] & 0x0F |
16-19 | units of seconds | (foo[bits16_23] >> 4) & 0x0F |
20-23 | third binary group | foo[bits16_23] & 0x0F |
24-26 | tens of seconds | (foo[bits24_31] >> 5) & 0x07 |
27 | bi-phase mark phase correction bit | (foo[bits24_31] >> 7) & 0x01 |
28-31 | fourth binary group | foo[bits24_31] & 0x0F |
32-35 | units of minutes | (foo[bits32_39] >> 4) & 0x0F |
36-39 | fifth binary group | foo[bits32_39] & 0x0F |
40-42 | tens of minutes | (foo[bits40_47] >> 5) & 0x07 |
43 | binary group flag bit | (foo[bits40_47] >> 4) & 0x01 |
44-47 | sixth binary group | foo[bits40_47] & 0x0F |
48-51 | units of hours | (foo[bits48_55] >> 4) & 0x0F |
52-55 | seventh binary group | foo[bits48_55] & 0x0F |
56-57 | tens of hours | (foo[bits56_63] >> 6) & 0x03 |
58 | unassigned address bit | (foo[bits56_63] >> 5) & 0x01 |
59 | binary group flag bit | (foo[bits56_63] >> 4) & 0x01 |
60-63 | eighth binary group | foo[bits56_63] & 0x0F |
64-71 | synch word (fixed 0x3F ) | |
72-79 | synch word (fixed 0xFD ) |
Timecode streams are useful to store user bits that were specified in the timecode on the videotape.
Nested Class Summary | |
---|---|
static class |
TimecodeStream12M.XMLHandler
|
Nested classes/interfaces inherited from class tv.amwa.maj.entity.Segment |
---|
Segment.SegmentXMLHandler |
Nested classes/interfaces inherited from class tv.amwa.maj.entity.Component |
---|
Component.ComponentAttributesXMLHandler, Component.ComponentUserCommentsXMLHandler, Component.ComponentXMLHandler, Component.KLVDataXMLHandler |
Nested classes/interfaces inherited from class tv.amwa.maj.entity.InterchangeObject |
---|
InterchangeObject.InterchangeObjectXMLHandler |
Field Summary | |
---|---|
static String |
TIMECODESTREAM12M_TAG
|
Fields inherited from class tv.amwa.maj.entity.Component |
---|
COMPONENT_ITEM |
Fields inherited from interface tv.amwa.maj.iface.TimecodeStream12M |
---|
INCLUDESYNC_DEFAULT |
Constructor Summary | |
---|---|
TimecodeStream12M(Rational sampleRate,
byte[] source,
TCSource sourceType)
Creates and initializes a new SMPTE 12M-compliant timecode stream, which specifies a stream of timecode data in the SMPTE 12M format. |
Method Summary | |
---|---|
void |
appendXMLChildren(Node parent)
Append child elements to the given parent node to serialize the value of an object to an XML fragment. |
TimecodeStream12M |
clone()
Creates a cloned copy of this entity. |
boolean |
equals(Object o)
Tests to see if the given object is equal to this interchange object. |
boolean |
getIncludeSync()
Returns true if the synchronization data is included in the
timecode stream; otherwise false if the synchronization data has a
fixed value and is omitted from the timecode stream. |
int |
getSampleSize()
Returns the size of one sample of the timecode data of this timecode stream, measured in bytes. |
int |
getUserDataLength()
Returns the length of user data for one frame of this timecode stream. |
int |
hashCode()
Returns a hash code value for this interchange object. |
byte[] |
packTimecode(TimecodeValue timecode,
byte[] packedBuffer)
Pack a given timecode value into a give byte array. |
byte[] |
packUserBits(byte[] userBits,
byte[] packedBuffer)
Pack user data from the given byte array into the given packed buffer. |
void |
setIncludeSync(Boolean includeSync)
Sets true if synchronization data is included in this
timecode stream and false if the synchronization data has a
fixed value and is omitted from the timecode stream. |
void |
setPropertiesFromInterface(TimecodeStream12M castFrom)
|
TimecodeValue |
unpackTimecode(byte[] buffer,
short fps)
Unpack a timecode value from the given buffer for the given number of frames per second. |
byte[] |
unpackUserBits(byte[] buffer)
Unpack user data from the given sample of the timecode stream. |
Methods inherited from class tv.amwa.maj.entity.TimecodeStream |
---|
getPositionTimecode, getSampleRate, getSource, getSourceBufferLength, getSourceType, getUserDataAtPosition, segmentOffsetToTC, segmentTCToOffset, setPositionTimecode, setPropertiesFromInterface, setSampleRate, setSource, setSourceType, setUserDataAtPosition |
Methods inherited from class tv.amwa.maj.entity.Segment |
---|
setPropertiesFromInterface |
Methods inherited from class tv.amwa.maj.entity.Component |
---|
appendAttribute, appendAttribute, appendComment, appendComment, appendKLVData, countAttributes, countComments, countKLVData, getAttributes, getComments, getDataDefinition, getKLVData, getLength, getLengthPresent, removeAttribute, removeComment, removeKLVData, setDataDefinition, setLength, setLengthPresent, setPropertiesFromInterface |
Methods inherited from class tv.amwa.maj.entity.InterchangeObject |
---|
castFromInterface, countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, registerImplementation, setPropertiesFromInterface, setPropertyValue, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface tv.amwa.maj.iface.TimecodeStream |
---|
getPositionTimecode, getSampleRate, getSource, getSourceBufferLength, getSourceType, getUserDataAtPosition, setPositionTimecode, setSampleRate, setSource, setSourceType, setUserDataAtPosition |
Methods inherited from interface tv.amwa.maj.iface.Segment |
---|
segmentOffsetToTC, segmentTCToOffset |
Methods inherited from interface tv.amwa.maj.iface.Component |
---|
appendAttribute, appendAttribute, appendComment, appendComment, appendKLVData, countAttributes, countComments, countKLVData, getAttributes, getComments, getDataDefinition, getKLVData, getLength, removeAttribute, removeComment, removeKLVData, setDataDefinition, setLength |
Methods inherited from interface tv.amwa.maj.iface.InterchangeObject |
---|
countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, setPropertyValue |
Methods inherited from interface tv.amwa.maj.entity.MAJCommon |
---|
toString |
Field Detail |
---|
public static final String TIMECODESTREAM12M_TAG
Constructor Detail |
---|
public TimecodeStream12M(Rational sampleRate, @DataBuffer byte[] source, TCSource sourceType) throws NullPointerException, IllegalArgumentException
Creates and initializes a new SMPTE 12M-compliant timecode stream, which specifies a stream of timecode data in the SMPTE 12M format.
sampleRate
- Sample rate of the timecode data contained in the source property.source
- The timecode data.sourceType
- Kind of timecode data.
NullPointerException
- One or more of the arguments is null
and all
are required.
IllegalArgumentException
Method Detail |
---|
public final void setPropertiesFromInterface(TimecodeStream12M castFrom)
InterchangeObject.setPropertiesFromInterface(tv.amwa.maj.iface.InterchangeObject)
@AAFProperty(uuid1=67371265, uuid2=1024, uuid3=0, uuid4={6,14,43,52,1,1,1,1}, definedName="IncludeSync", typeName="Boolean", optional=true, uniqueIdentifier=false, pid=5889) public boolean getIncludeSync()
TimecodeStream12M
Returns true
if the synchronization data is included in the
timecode stream; otherwise false
if the synchronization data has a
fixed value and is omitted from the timecode stream.
If this optional property is omitted, the default value of false is returned.
getIncludeSync
in interface TimecodeStream12M
TimecodeStream12M.INCLUDESYNC_DEFAULT
public void setIncludeSync(Boolean includeSync)
TimecodeStream12M
Sets true
if synchronization data is included in this
timecode stream and false
if the synchronization data has a
fixed value and is omitted from the timecode stream.
The default value for this optional property is false.
Set this optional property to null
to omit it.
setIncludeSync
in interface TimecodeStream12M
includeSync
- Is synchronization data included in the timecode
stream?TimecodeStream12M.INCLUDESYNC_DEFAULT
public int getSampleSize()
TimecodeStream
Returns the size of one sample of the timecode data of this timecode stream, measured in bytes.
getSampleSize
in interface TimecodeStream
getSampleSize
in class TimecodeStream
public int getUserDataLength()
TimecodeStream
Returns the length of user data for one frame of this timecode stream.
getUserDataLength
in interface TimecodeStream
getUserDataLength
in class TimecodeStream
TimecodeStream.getUserDataAtPosition(long)
public byte[] packTimecode(TimecodeValue timecode, byte[] packedBuffer) throws NullPointerException, IllegalArgumentException
TimecodeStream
Pack a given timecode value into a give byte array. Any user bits in the given packed buffer are preserved.
packTimecode
in class TimecodeStream
timecode
- Timecode value to serialize.packedBuffer
- Array of bytes into which the timecode should be packed.
NullPointerException
- One or more of the arguments is null.
IllegalArgumentException
- The given array of packed bytes is the wrong length to allow
the packing of a timecode value.public byte[] packUserBits(byte[] userBits, byte[] packedBuffer) throws NullPointerException, IllegalArgumentException
TimecodeStream
Pack user data from the given byte array into the given packed buffer.
packUserBits
in class TimecodeStream
userBits
- User bits to set for a timecode value.packedBuffer
- Buffer to pack user bits into.
NullPointerException
- One or more of the arguments is null.
IllegalArgumentException
- The packed buffer or array of user bits are of
the wrong length.public TimecodeValue unpackTimecode(byte[] buffer, short fps) throws NullPointerException, IllegalArgumentException
TimecodeStream
Unpack a timecode value from the given buffer for the given number of frames per second.
unpackTimecode
in class TimecodeStream
buffer
- Data buffer containing bytes representing one timecode value.fps
- Frames per second of the current timecode stream.
NullPointerException
- Argument is null.
IllegalArgumentException
- The given buffer does not contain sufficient data to unpack a timecode
value or the frame per second value is not a positive value.public byte[] unpackUserBits(byte[] buffer) throws NullPointerException, IllegalArgumentException
TimecodeStream
Unpack user data from the given sample of the timecode stream.
unpackUserBits
in class TimecodeStream
buffer
- Buffer to use to unpack user data from.
NullPointerException
- Argument is null.
IllegalArgumentException
- The given data buffer is too short to enable user bits to be
extracted.public boolean equals(Object o)
MAJCommon
Tests to see if the given object is equal to this interchange object. To be equal, the given value must be not null, share the same interface to its value and each of the properties of the value must each be equal.
equals
in interface MAJCommon
equals
in class TimecodeStream
o
- Object to test for equality with.
Object.equals(Object)
public int hashCode()
MAJCommon
Returns a hash code value for this interchange object.
hashCode
in interface MAJCommon
hashCode
in class TimecodeStream
Object.hashCode()
public TimecodeStream12M clone()
MAJCommon
Creates a cloned copy of this entity. The clone will be initialized to have the same value as this value but exists independently from then on. Changes to this value will not effect the clone and changes to the clone will not effect this. MAJ API clones are true deep clones with no shared references to areas of memory within the original.
This method does not throw a CloneNotSupportedException
as all
entity values must implement the Cloneable
interface. If a cloning
error does occur, a null
value will be returned but this is very unlikely
to happen.
clone
in interface MAJCommon
clone
in class Segment
Object.clone()
public void appendXMLChildren(Node parent)
XMLSerializable
Append child elements to the given parent node to serialize the value of an object
to an XML fragment. Methods of the XMLBuilder
class are provided to help with this
process.
appendXMLChildren
in interface XMLSerializable
appendXMLChildren
in class TimecodeStream
parent
- XML parent element to append child nodes to.
|
Media Authoring with Java API |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |