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

tv.amwa.maj.model.impl

## Class CodecDefinitionImpl

- java.lang.Object
- - tv.amwa.maj.model.impl.InterchangeObjectImpl
  - - tv.amwa.maj.model.impl.DefinitionObjectImpl
    - - tv.amwa.maj.model.impl.CodecDefinitionImpl

- All Implemented Interfaces:
    Serializable, Cloneable, CodecConstant, MediaEntity, MetadataObject, WeakReferenceTarget, CodecDefinition, DefinitionObject, DefinitionType, InterchangeObject

      @MediaClass(uuid1=218169601,
                  uuid2=257,
                  uuid3=7936,
                  uuid4={6,14,43,52,2,6,1,1},
                  definedName="CodecDefinition",
                  description="The CodecDefinition specifies an essence codec.",
                  symbol="CodecDefinition")
      public class CodecDefinitionImpl
      extends DefinitionObjectImpl
      implements CodecDefinition, Serializable, CodecConstant, Cloneable

  Implements the definition of an essence codec. A codec is a program or system capable of performing encoding and decoding on a digital data stream, which is often the case for the data streams represented by essence data in the MAJ API.

  See Also:
    `TypeDefinitions.CodecDefinitionWeakReference`, `TypeDefinitions.CodecDefinitionStrongReference`, `TypeDefinitions.CodecDefinitionStrongReferenceSet`, Serialized Form

- - ### Field Summary

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

      `ObjectClassPropertyID`

    - ### Fields inherited from interface tv.amwa.maj.constant.CodecConstant

      `AIFC, CDCI, JPEG, None, PCM, RGBA, WAVE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CodecDefinitionImpl()` Default constructor is not public to avoid unset required fields.
    `CodecDefinitionImpl(AUID identification, String name, ClassDefinition fileDescriptorClass, Set<DataDefinition> dataDefinitions)` Create and initialize all the fields of the codec definition object, which specifies an essence codec.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendEssenceKind(DataDefinition essenceKind)` Appends the given essence kind to the list of those supported by the codec, which specify the data definitions of the essence formats that the defined codec processes.
    `void` | `clearEssenceKinds()` Clears the list of essence kinds for this codec definition.
    `CodecDefinitionImpl` | `clone()` Create a cloned copy of this interchange object.
    `static int` | `count()`
    `int` | `countEssenceKinds()` Returns the number of supported essence kinds of this codec definition, which specify the data definitions of the essence formats that the defined codec processes.
    `static CodecDefinition` | `forAUID(AUID identification)`
    `static CodecDefinition` | `forIdentification(AUID identification)`
    `static CodecDefinition` | `forName(String codecName)`
    `Set<AUID>` | `getCodecFlavours()` Returns `null` in this implementation.
    `DataDefinition` | `getEssenceKindAt(int index)` Returns the essence kind at the given index in the list of supported essence kinds of this codec.
    `List<DataDefinition>` | `getEssenceKinds()` Returns a set of the essence kinds for the defined codec, which specify the data definitions of the essence formats that the defined codec processes.
    `ClassDefinition` | `getFileDescriptorClass()` Returns the file descriptor class object associated with the defined codec, which specifies the class definition of the sub-class of file descriptor that identifies the essence format that the defined codec processes.
    `String` | `getWeakTargetReference()` Provides a name that can be used to make a weak object reference to an instance of the implementing class.
    `static List<DataDefinition>` | `initializeCodecDataDefinitions()`
    `static ClassDefinition` | `initializeFileDescriptorClass()`
    `void` | `insertEssenceKind(int index, DataDefinition essenceKind)` Inserts the given essence kind to the list of those supported by the codec at the given index.
    `static Collection<String>` | `inventory()`
    `boolean` | `isEssenceKindSupported(DataDefinition essenceKind)` Returns `true` if the given codec supports transfers to essence of the given essence kind.
    `void` | `prependEssenceKind(DataDefinition essenceKind)` Prepends the given essence kind to the list of those supported by the codec, which specify the data definitions of the essence formats that the defined codec processes.
    `static boolean` | `registerCodecDefinition(CodecDefinition definedCodec)`
    `static int` | `registerCodecsFromClass(Class<?> classWithCodecs)`
    `void` | `removeEssenceKind(DataDefinition essenceKind)` Removes the given essence kind from the list of those supported by the codec, which specify the data definitions of the essence formats that the defined codec processes.
    `void` | `removeEssenceKindAt(int index)` Removes the essence kind at the given index in the list of essence kinds for this codec definition.
    `void` | `setFileDescriptorClass(ClassDefinition fileClass)` Sets the file descriptor class associated with this codec, which specifies the class definition of the sub-class of `FileDescriptor` that identifies the essence format that the defined codec processes.

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

      `getAUID, getDefinitionObjectIdentificationString, getDescription, getLocalizedUID, getName, initializeDefinitionObjectIdentification, initializeDefinitionObjectName, setAUID, setDefinitionObjectIdentificationString, setDescription, setLocalizedUID, setName`

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

      `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, toString`

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

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

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

      `getAUID, getDescription, getName, setDescription, setName`

    - ### 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

    - #### CodecDefinitionImpl

          public CodecDefinitionImpl()

      Default constructor is not public to avoid unset required fields.

    - #### CodecDefinitionImpl

          public CodecDefinitionImpl(AUID identification,
                                     @AAFString
                                     String name,
                                     ClassDefinition fileDescriptorClass,
                                     Set<DataDefinition> dataDefinitions)
                              throws NullPointerException,
                                     IllegalArgumentException

      Create and initialize all the fields of the codec definition object, which specifies an essence codec. The set of data definitions for essence kinds processed by the codec must contain at least one item, otherwise an `IllegalArgumentException` will be thrown.

      Parameters:
        `identification` - Unique identifier for new codec definition.
        `name` - Display name for the new codec definition.
        `fileDescriptorClass` - Class definition of the sub-class of file descriptor that identifies the essence format that this codec processes.
        `dataDefinitions` - Data definitions of the essence formats that the new codec processes.
      Throws:
        `NullPointerException` - One or more of the arguments is `null`.
        `IllegalArgumentException` - Cannot crate a codec definition with and empty set of data definitions.

  - ### Method Detail

    - #### registerCodecsFromClass

          public static final int registerCodecsFromClass(Class<?> classWithCodecs)
                                                   throws NullPointerException

      Throws:
        `NullPointerException`

    - #### registerCodecDefinition

          public static final boolean registerCodecDefinition(CodecDefinition definedCodec)
                                                       throws NullPointerException

      Throws:
        `NullPointerException`

    - #### forName

          public static final CodecDefinition forName(String codecName)
                                               throws NullPointerException

      Throws:
        `NullPointerException`

    - #### forIdentification

          public static final CodecDefinition forIdentification(AUID identification)
                                                         throws NullPointerException

      Throws:
        `NullPointerException`

    - #### forAUID

          public static final CodecDefinition forAUID(AUID identification)
                                               throws NullPointerException

      Throws:
        `NullPointerException`

    - #### inventory

          public static final Collection<String> inventory()

    - #### count

          public static final int count()

    - #### appendEssenceKind

          @MediaListAppend(value="CodecDataDefinitions")
          public void appendEssenceKind(DataDefinition essenceKind)
                                                                                throws NullPointerException,
                                                                                       DuplicateEssenceKindException

      Description copied from interface: `CodecDefinition`

      Appends the given essence kind to the list of those supported by the codec, which specify the data definitions of the essence formats that the defined codec processes. The content of the list is dependent upon the specified format for the codec, not on whether an implementation supports all parts of the format.

      Specified by:
        `appendEssenceKind` in interface `CodecDefinition`
      Parameters:
        `essenceKind` - The essence kind to append.
      Throws:
        `NullPointerException` - The given essence kind is `null`.
        `DuplicateEssenceKindException` - The given essence kind is already contained.
      See Also:
        `CodecDefinition.prependEssenceKind(DataDefinition)`, `CodecDefinition.insertEssenceKind(int, DataDefinition)`, `DataDefinitionConstant`

    - #### countEssenceKinds

          @MediaPropertyCount(value="CodecDataDefinitions")
          public int countEssenceKinds()

      Description copied from interface: `CodecDefinition`

      Returns the number of supported essence kinds of this codec definition, which specify the data definitions of the essence formats that the defined codec processes.

      Specified by:
        `countEssenceKinds` in interface `CodecDefinition`
      Returns:
        The number of supported essence kinds.

    - #### getCodecFlavours

          public Set<AUID> getCodecFlavours()

      Returns `null` in this implementation.

      See Also:
        `tv.amwa.maj.model.CodecDefinition#getCodecFlavours()`

    - #### getEssenceKinds

          @MediaProperty(uuid1=100729092,
                         uuid2=769,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="CodecDataDefinitions",
                         aliases={"DataDefinitions","CodecDefinitionDataDefinitions"},
                         typeName="DataDefinitionWeakReferenceVector",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=8962,
                         symbol="CodecDataDefinitions")
          public List<DataDefinition> getEssenceKinds()

      Description copied from interface: `CodecDefinition`

      Returns a set of the essence kinds for the defined codec, which specify the data definitions of the essence formats that the defined codec processes.

      Specified by:
        `getEssenceKinds` in interface `CodecDefinition`
      Returns:
        Shallow copy of a set of the essence kinds that the defined codec processes.
      See Also:
        `CodecDefinition.getEssenceKindAt(int)`, `DataDefinitionConstant`, `TypeDefinitions.DataDefinitionWeakReferenceSet`, `TypeDefinitions.DataDefinitionWeakReferenceVector`

    - #### initializeCodecDataDefinitions

          public static final List<DataDefinition> initializeCodecDataDefinitions()

    - #### getFileDescriptorClass

          @MediaProperty(uuid1=100729092,
                         uuid2=263,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="FileDescriptorClass",
                         typeName="ClassDefinitionWeakReference",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=8961,
                         symbol="FileDescriptorClass")
          public ClassDefinition getFileDescriptorClass()

      Description copied from interface: `CodecDefinition`

      Returns the file descriptor class object associated with the defined codec, which specifies the class definition of the sub-class of file descriptor that identifies the essence format that the defined codec processes.

      Specified by:
        `getFileDescriptorClass` in interface `CodecDefinition`
      Returns:
        The class definition of the sub-class of `FileDescriptor` that identifies the essence format that the defined codec processes.

    - #### setFileDescriptorClass

          @MediaPropertySetter(value="FileDescriptorClass")
          public void setFileDescriptorClass(ClassDefinition fileClass)
                                                                                        throws NullPointerException,
                                                                                               IllegalArgumentException

      Description copied from interface: `CodecDefinition`

      Sets the file descriptor class associated with this codec, which specifies the class definition of the sub-class of `FileDescriptor` that identifies the essence format that the defined codec processes.

      Specified by:
        `setFileDescriptorClass` in interface `CodecDefinition`
      Parameters:
        `fileClass` - Specifies the class definition of the sub-class of `AAFFileDescriptor` that identifies the essence format that the defined codec processes.
      Throws:
        `NullPointerException` - The given class definition for a sub-class of file descriptor is `null`.
        `IllegalArgumentException` - The given class definition is not for a sub-class of `FileDescriptor`.
      See Also:
        `CodecConstant`

    - #### initializeFileDescriptorClass

          public static final ClassDefinition initializeFileDescriptorClass()

    - #### isEssenceKindSupported

          @MediaPropertyContains(value="CodecDataDefinitions")
          public boolean isEssenceKindSupported(DataDefinition essenceKind)
                                                                                              throws NullPointerException

      Description copied from interface: `CodecDefinition`

      Returns `true` if the given codec supports transfers to essence of the given essence kind.

      Specified by:
        `isEssenceKindSupported` in interface `CodecDefinition`
      Parameters:
        `essenceKind` - The essence kind to test.
      Returns:
        Is this essence kind supported by the codec?
      Throws:
        `NullPointerException` - The given essence kind is `null`.
      See Also:
        `DataDefinitionConstant`

    - #### removeEssenceKind

          @MediaPropertyRemove(value="CodecDataDefinitions")
          public void removeEssenceKind(DataDefinition essenceKind)
                                                                                    throws NullPointerException,
                                                                                           ObjectNotFoundException,
                                                                                           IllegalArgumentException

      Description copied from interface: `CodecDefinition`

      Removes the given essence kind from the list of those supported by the codec, which specify the data definitions of the essence formats that the defined codec processes.

      Specified by:
        `removeEssenceKind` in interface `CodecDefinition`
      Parameters:
        `essenceKind` - The essence kind to remove.
      Throws:
        `NullPointerException` - Argument is null.
        `ObjectNotFoundException` - The given kind of essence is not already contained.
        `IllegalArgumentException` - Cannot remove an item from the set if it will become empty.
      See Also:
        `CodecDefinition.removeEssenceKindAt(int)`, `DataDefinitionConstant`

    - #### clearEssenceKinds

          @MediaPropertyClear(value="CodecDataDefinitions")
          public void clearEssenceKinds()

      Description copied from interface: `CodecDefinition`

      Clears the list of essence kinds for this codec definition. Note that the list of essence kinds is a required property and so a call to this method should be followed by a call to add another essence kind.

      Specified by:
        `clearEssenceKinds` in interface `CodecDefinition`

    - #### clone

          public CodecDefinitionImpl 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 `CodecDefinition`
      Specified by:
        `clone` in interface `DefinitionObject`
      Specified by:
        `clone` in interface `InterchangeObject`
      Overrides:
        `clone` in class `DefinitionObjectImpl`
      Returns:
        Cloned copy of this interchange object.

    - #### getWeakTargetReference

          public String getWeakTargetReference()

      Description copied from interface: `WeakReferenceTarget`

      Provides a name that can be used to make a weak object reference to an instance of the implementing class.

      Specified by:
        `getWeakTargetReference` in interface `WeakReferenceTarget`
      Overrides:
        `getWeakTargetReference` in class `DefinitionObjectImpl`
      Returns:
        A name to use to make weak reference to this object.

    - #### getEssenceKindAt

          @MediaListGetAt(value="CodecDataDefinitions")
          public DataDefinition getEssenceKindAt(int index)
                                                                                        throws IndexOutOfBoundsException

      Description copied from interface: `CodecDefinition`

      Returns the essence kind at the given index in the list of supported essence kinds of this codec.

      Specified by:
        `getEssenceKindAt` in interface `CodecDefinition`
      Parameters:
        `index` - Index of the essence kind to retrieve.
      Returns:
        Data definition defining the essence kind at the given index.
      Throws:
        `IndexOutOfBoundsException` - The given index is outside the acceptable range for the current list of supported essence kinds.
      See Also:
        `CodecDefinition.getEssenceKinds()`

    - #### insertEssenceKind

          @MediaListInsertAt(value="CodecDataDefinitions")
          public void insertEssenceKind(int index,
                                                                                         DataDefinition essenceKind)
                                                                                  throws NullPointerException,
                                                                                         DuplicateEssenceKindException,
                                                                                         IndexOutOfBoundsException

      Description copied from interface: `CodecDefinition`

      Inserts the given essence kind to the list of those supported by the codec at the given index. Essence kinds specify the data definitions of the essence formats that the defined codec processes. The content of the list is dependent upon the specified format for the codec, not on whether an implementation supports all parts of the format.

      Specified by:
        `insertEssenceKind` in interface `CodecDefinition`
      Parameters:
        `index` - Index in the list where the essence kind is to be inserted.
        `essenceKind` - The essence kind to insert.
      Throws:
        `NullPointerException` - The given essence kind is `null`.
        `DuplicateEssenceKindException` - The given essence kind is already contained.
        `IndexOutOfBoundsException` - The given index is outside the acceptable range for the current list of supported essence kinds.
      See Also:
        `CodecDefinition.appendEssenceKind(DataDefinition)`, `CodecDefinition.prependEssenceKind(DataDefinition)`, `DataDefinitionConstant`

    - #### prependEssenceKind

          @MediaListPrepend(value="CodecDataDefinitions")
          public void prependEssenceKind(DataDefinition essenceKind)
                                                                                  throws NullPointerException,
                                                                                         DuplicateEssenceKindException

      Description copied from interface: `CodecDefinition`

      Prepends the given essence kind to the list of those supported by the codec, which specify the data definitions of the essence formats that the defined codec processes. The content of the list is dependent upon the specified format for the codec, not on whether an implementation supports all parts of the format.

      Specified by:
        `prependEssenceKind` in interface `CodecDefinition`
      Parameters:
        `essenceKind` - The essence kind to prepend.
      Throws:
        `NullPointerException` - The given essence kind is `null`.
        `DuplicateEssenceKindException` - The given essence kind is already contained.
      See Also:
        `CodecDefinition.appendEssenceKind(DataDefinition)`, `CodecDefinition.insertEssenceKind(int, DataDefinition)`, `DataDefinitionConstant`

    - #### removeEssenceKindAt

          @MediaListRemoveAt(value="CodecDataDefinitions")
          public void removeEssenceKindAt(int index)
                                                                                    throws IndexOutOfBoundsException

      Description copied from interface: `CodecDefinition`

      Removes the essence kind at the given index in the list of essence kinds for this codec definition.

      Specified by:
        `removeEssenceKindAt` in interface `CodecDefinition`
      Parameters:
        `index` - Index of the essence kind to remove.
      Throws:
        `IndexOutOfBoundsException` - The given index is outside the acceptable range for the current list of supported essence kinds.
      See Also:
        `CodecDefinition.removeEssenceKind(DataDefinition)`

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