TimecodeStream12MImpl (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.model.impl

## Class TimecodeStream12MImpl

- java.lang.Object
- - tv.amwa.maj.model.impl.InterchangeObjectImpl
  - - tv.amwa.maj.model.impl.ComponentImpl
    - - tv.amwa.maj.model.impl.SegmentImpl
      - - tv.amwa.maj.model.impl.TimecodeStreamImpl
        - - tv.amwa.maj.model.impl.TimecodeStream12MImpl

- All Implemented Interfaces:
    Serializable, Cloneable, QComponent, QSegment, MediaEntity, MetadataObject, Component, InterchangeObject, Segment, TimecodeStream, TimecodeStream12M

      @MediaClass(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.",
                  symbol="TimecodeStream12M")
      public class TimecodeStream12MImpl
      extends TimecodeStreamImpl
      implements TimecodeStream12M, Serializable, Cloneable

  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.

  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `ObjectClassPropertyID`

    - ### Fields inherited from interface tv.amwa.maj.model.TimecodeStream12M

      `INCLUDESYNC_DEFAULT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimecodeStream12MImpl()`
    `TimecodeStream12MImpl(Rational sampleRate, Stream 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

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TimecodeStream12M` | `clone()` Create a cloned copy of 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.
    `static boolean` | `initializeIncludeSync()`
    `ByteBuffer` | `packTimecode(TimecodeValue timecode, ByteBuffer packedBuffer)` Pack a given timecode value into a give byte array.
    `ByteBuffer` | `packUserBits(ByteBuffer userBitsBuffer, ByteBuffer 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.
    `TimecodeValue` | `unpackTimecode(ByteBuffer timecodeBuffer, short fps)` Unpack a timecode value from the given buffer for the given number of frames per second.
    `ByteBuffer` | `unpackUserBits(ByteBuffer buffer)` Unpack user data from the given sample of the timecode stream.

    - ### Methods inherited from class tv.amwa.maj.model.impl.TimecodeStreamImpl

      `getPositionTimecode, getSourceBufferLength, getTimecodeSource, getTimecodeStreamData, getTimecodeStreamSampleRate, getTimecodeStreamSampleRateString, getUserDataAtPosition, initializeTimecodeSource, initializeTimecodeStreamData, initializeTimecodeStreamSampleRate, segmentOffsetToTC, segmentTCToOffset, setPositionTimecode, setTimecodeSource, setTimecodeStreamData, setTimecodeStreamSampleRate, setTimecodeStreamSampleRateString, setUserDataAtPosition`

    - ### Methods inherited from class tv.amwa.maj.model.impl.SegmentImpl

      `generateSequence, getCutPoint, getKeyOffset, getPackLayerKeyIndicator, getSegmentBlob, getTrackBlob, getTrackKeyRenderSequence, getTrackName, getTrackRenderSequence, setCutPoint, setKeyOffset, setPackLayerKeyIndicator, setSegmentBlob, setTrackBlob, setTrackKeyRenderSequence, setTrackName, setTrackRenderSequence`

    - ### Methods inherited from class tv.amwa.maj.model.impl.ComponentImpl

      `appendComponentAttribute, appendComponentAttribute, appendComponentKLVData, appendComponentUserComment, appendComponentUserComment, clearComponentAttributes, clearComponentKLVData, clearComponentUserComments, countComponentAttributes, countComponentKLVData, countComponentUserComments, getComment, getComponentAttributes, getComponentDataDefinition, getComponentKLVData, getComponentLength, getComponentUserComments, getEditName, getJupiterClipOffset, getJupiterID, getLengthPresent, initializeComponentDataDefinition, prependComponentAttribute, prependComponentKLVData, prependComponentUserComment, removeComponentAttribute, removeComponentKLVData, removeComponentUserComment, setComponentDataDefinition, setComponentLength, setComponentLengthFromStream, setEditName, setJupiterClipOffset, setJupiterID, setLengthPresent`

    - ### Methods inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `addApplicationPlugin, appendXMLChildren, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getLinkedGenerationIDString, getObjectClass, getPersistentID, getPersistentIndex, hashCode, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setLinkedGenerationIDString, setObjectClass, setPersistentID, setPersistentIndex, toString`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface tv.amwa.maj.model.TimecodeStream

      `getPositionTimecode, getSourceBufferLength, getTimecodeSource, getTimecodeStreamData, getTimecodeStreamSampleRate, getUserDataAtPosition, setPositionTimecode, setTimecodeSource, setTimecodeStreamData, setTimecodeStreamSampleRate, setUserDataAtPosition`

    - ### Methods inherited from interface tv.amwa.maj.model.Segment

      `generateSequence, segmentOffsetToTC, segmentTCToOffset`

    - ### Methods inherited from interface tv.amwa.maj.model.Component

      `appendComponentAttribute, appendComponentAttribute, appendComponentKLVData, appendComponentUserComment, appendComponentUserComment, clearComponentAttributes, clearComponentKLVData, clearComponentUserComments, countComponentAttributes, countComponentKLVData, countComponentUserComments, getComponentAttributes, getComponentDataDefinition, getComponentKLVData, getComponentLength, getComponentUserComments, getLengthPresent, removeComponentAttribute, removeComponentKLVData, removeComponentUserComment, setComponentDataDefinition, setComponentLength, setLengthPresent`

    - ### Methods inherited from interface tv.amwa.maj.model.InterchangeObject

      `addApplicationPlugin, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getObjectClass, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setObjectClass, toString`

    - ### Methods inherited from interface tv.amwa.maj.industry.MediaEntity

      `getPersistentID, setPersistentIndex`

- - ### Constructor Detail

    - #### TimecodeStream12MImpl

          public TimecodeStream12MImpl()

    - #### TimecodeStream12MImpl

          public TimecodeStream12MImpl(Rational sampleRate,
                                       @DataBuffer
                                       Stream 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.

      Parameters:
        `sampleRate` - Sample rate of the timecode data contained in the source property.
        `source` - The timecode data.
        `sourceType` - Kind of timecode data.
      Throws:
        `NullPointerException` - One or more of the arguments is `null` and all are required.
        `IllegalArgumentException`

  - ### Method Detail

    - #### getIncludeSync

          @MediaProperty(uuid1=67371265,
                         uuid2=1024,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,1},
                         definedName="IncludeSync",
                         typeName="Boolean",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=5889,
                         symbol="IncludeSync")
          public boolean getIncludeSync()

      Description copied from interface: `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.

      Specified by:
        `getIncludeSync` in interface `TimecodeStream12M`
      Returns:
        Is synchronization data included in the timecode stream?
      See Also:
        `TimecodeStream12M.INCLUDESYNC_DEFAULT`

    - #### setIncludeSync

          @MediaPropertySetter(value="IncludeSync")
          public void setIncludeSync(Boolean includeSync)

      Description copied from interface: `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.

      Specified by:
        `setIncludeSync` in interface `TimecodeStream12M`
      Parameters:
        `includeSync` - Is synchronization data included in the timecode stream?
      See Also:
        `TimecodeStream12M.INCLUDESYNC_DEFAULT`

    - #### initializeIncludeSync

          public static final boolean initializeIncludeSync()

    - #### getSampleSize

          public int getSampleSize()

      Description copied from interface: `TimecodeStream`

      Returns the size of one sample of the timecode data of this timecode stream, measured in bytes.

      Specified by:
        `getSampleSize` in interface `TimecodeStream`
      Specified by:
        `getSampleSize` in class `TimecodeStreamImpl`
      Returns:
        Size of one sample of the timecode data of this timecode stream.

    - #### getUserDataLength

          public int getUserDataLength()

      Description copied from interface: `TimecodeStream`

      Returns the length of user data for one frame of this timecode stream.

      Specified by:
        `getUserDataLength` in interface `TimecodeStream`
      Specified by:
        `getUserDataLength` in class `TimecodeStreamImpl`
      Returns:
        Length of user data for one frame of this timecode stream.
      See Also:
        `TimecodeStream.getUserDataAtPosition(long)`

    - #### packTimecode

          public ByteBuffer packTimecode(TimecodeValue timecode,
                                         ByteBuffer packedBuffer)
                                  throws NullPointerException,
                                         IllegalArgumentException

      Description copied from class: `TimecodeStreamImpl`

      Pack a given timecode value into a give byte array. Any user bits in the given packed buffer are preserved.

      Specified by:
        `packTimecode` in class `TimecodeStreamImpl`
      Parameters:
        `timecode` - Timecode value to serialize.
        `packedBuffer` - Array of bytes into which the timecode should be packed.
      Returns:
        Serialized version of the given timecode value.
      Throws:
        `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.

    - #### packUserBits

          public ByteBuffer packUserBits(ByteBuffer userBitsBuffer,
                                         ByteBuffer packedBuffer)
                                  throws NullPointerException,
                                         IllegalArgumentException

      Description copied from class: `TimecodeStreamImpl`

      Pack user data from the given byte array into the given packed buffer.

      Specified by:
        `packUserBits` in class `TimecodeStreamImpl`
      Parameters:
        `userBitsBuffer` - User bits to set for a timecode value.
        `packedBuffer` - Buffer to pack user bits into.
      Returns:
        Buffer with the given user bits set.
      Throws:
        `NullPointerException` - One or more of the arguments is null.
        `IllegalArgumentException` - The packed buffer or array of user bits are of the wrong length.

    - #### unpackTimecode

          public TimecodeValue unpackTimecode(ByteBuffer timecodeBuffer,
                                              short fps)
                                       throws NullPointerException,
                                              IllegalArgumentException

      Description copied from class: `TimecodeStreamImpl`

      Unpack a timecode value from the given buffer for the given number of frames per second.

      Specified by:
        `unpackTimecode` in class `TimecodeStreamImpl`
      Parameters:
        `timecodeBuffer` - Data buffer containing bytes representing one timecode value.
        `fps` - Frames per second of the current timecode stream.
      Returns:
        Deserialized timecode value from the given data buffer.
      Throws:
        `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.

    - #### unpackUserBits

          public ByteBuffer unpackUserBits(ByteBuffer buffer)
                                    throws NullPointerException,
                                           IllegalArgumentException

      Description copied from class: `TimecodeStreamImpl`

      Unpack user data from the given sample of the timecode stream.

      Specified by:
        `unpackUserBits` in class `TimecodeStreamImpl`
      Parameters:
        `buffer` - Buffer to use to unpack user data from.
      Returns:
        User data contained within the given sample.
      Throws:
        `NullPointerException` - Argument is null.
        `IllegalArgumentException` - The given data buffer is too short to enable user bits to be extracted.

    - #### clone

          public TimecodeStream12M clone()

      Description copied from interface: `InterchangeObject`

      Create a cloned copy of this interchange object.

      Specified by:
        `clone` in interface `MediaEntity`
      Specified by:
        `clone` in interface `Component`
      Specified by:
        `clone` in interface `InterchangeObject`
      Specified by:
        `clone` in interface `Segment`
      Specified by:
        `clone` in interface `TimecodeStream`
      Specified by:
        `clone` in interface `TimecodeStream12M`
      Overrides:
        `clone` in class `TimecodeStreamImpl`
      Returns:
        Cloned copy of this interchange object.

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.