Media Authoring
with Java API

tv.amwa.maj.entity
Class CodecDefinition

java.lang.Object
  extended by tv.amwa.maj.entity.InterchangeObject
      extended by tv.amwa.maj.entity.DefinitionObject
          extended by tv.amwa.maj.entity.CodecDefinition
All Implemented Interfaces:
Serializable, Cloneable, CodecConstant, DefinitionType, MAJCommon, CodecDefinition, DefinitionObject, InterchangeObject, XMLSerializable

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

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.

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class CodecDefinition.DataDefinitionHandler
           
static class CodecDefinition.XMLHandler
           
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.DefinitionObject
DefinitionObject.DefinitionObjectXMLHandler
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.InterchangeObject
InterchangeObject.InterchangeObjectXMLHandler
 
Field Summary
 
Fields inherited from interface tv.amwa.maj.constant.CodecConstant
AIFC, CDCI, JPEG, None, PCM, RGBA, WAVE
 
Constructor Summary
CodecDefinition(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
 void addEssenceKind(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 appendXMLChildren(Node parent)
          Append child elements to the given parent node to serialize the value of an object to an XML fragment.
 boolean areThereFlavours()
          Find out whether the optional codec flavours property is present for the defined codec.
 CodecDefinition clone()
          Creates a cloned copy of this entity.
 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 forIdentification(AUID identification)
           
static CodecDefinition forName(String codecName)
           
 Set<AUID> getCodecFlavours()
          Returns null in this implementation.
 Set<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 getLocalizedUID()
           
 boolean isEssenceKindSupported(DataDefinition essenceKind)
          Returns true if the given codec supports transfers to essence of the given essence kind.
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 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.
 void setPropertiesFromInterface(CodecDefinition castFrom)
           
 
Methods inherited from class tv.amwa.maj.entity.DefinitionObject
equals, getAUID, getDescription, getName, hashCode, setDescription, setLocalizedUID, setName
 
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, toString, wait, wait, wait
 
Methods inherited from interface tv.amwa.maj.iface.DefinitionObject
getAUID, getDescription, getName, setDescription, setName
 
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
equals, hashCode, toString
 

Constructor Detail

CodecDefinition

public CodecDefinition(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

setPropertiesFromInterface

public final void setPropertiesFromInterface(CodecDefinition castFrom)
See Also:
InterchangeObject.setPropertiesFromInterface(tv.amwa.maj.iface.InterchangeObject)

addEssenceKind

public void addEssenceKind(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 is implements all parts of the format.

Specified by:
addEssenceKind 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:
DataDefinitionConstant

areThereFlavours

public boolean areThereFlavours()
Description copied from interface: CodecDefinition

Find out whether the optional codec flavours property is present for the defined codec. Flavours are used when a single codec can support multiple formats. An example would be a codec which would accept a "resolution id" for a particular manufacturer and set up all of the parameters. When a new resolution id is released, then a new codec plugin would give users the ability to use the new resolutions without upgrading the application.

Specified by:
areThereFlavours in interface CodecDefinition
Returns:
Are there any flavours?

countEssenceKinds

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.

Specified by:
getCodecFlavours in interface CodecDefinition
Returns:
List of supported codec flavours.
See Also:
CodecDefinition.getCodecFlavours()

getEssenceKinds

@AAFProperty(uuid1=100729092,
             uuid2=769,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="DataDefinitions",
             typeName="WeakReferenceSet of DataDefinition",
             optional=false,
             uniqueIdentifier=false,
             pid=8962)
public Set<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:
DataDefinitionConstant

getFileDescriptorClass

@AAFProperty(uuid1=100729092,
             uuid2=263,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="FileDescriptorClass",
             typeName="WeakReference to ClassDefinition",
             optional=false,
             uniqueIdentifier=false,
             pid=8961)
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

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

isEssenceKindSupported

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, AAFFactory.dataDefinitionForName(String)

removeEssenceKind

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:
DataDefinitionConstant

clone

public CodecDefinition clone()
Description copied from interface: 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.

Specified by:
clone in interface MAJCommon
Overrides:
clone in class DefinitionObject
Returns:
Independent clone of this value, which is a deep copy.
See Also:
Object.clone()

getLocalizedUID

public String getLocalizedUID()
Overrides:
getLocalizedUID in class DefinitionObject

appendXMLChildren

public void appendXMLChildren(Node parent)
Description copied from interface: 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.

Specified by:
appendXMLChildren in interface XMLSerializable
Overrides:
appendXMLChildren in class DefinitionObject
Parameters:
parent - XML parent element to append child nodes to.

Media Authoring
with Java API

(c) 2007-2008 Richard Cartwright, all rights reserved. Subject to the terms of the AAF SDK Public Source License.