Skip navigation links
Media Authoring with Java API (MAJ)

Package tv.amwa.maj.enumeration

Defines Java enumerations representing the enumerations specified in the AAF object specification and other enumerations used across the MAJ API.

See: Description

Package tv.amwa.maj.enumeration Description

Defines Java enumerations representing the enumerations specified in the AAF object specification and other enumerations used across the MAJ API. The enumerations in this package have a fixed number of defined elements, unlike extendible enumerations that can be extended at runtime.

Enumeration kinds

Section 21.2 of the AAF object specification v1.1 specifies a number of enumeration data types. Enumerations are made up of a fixed set of elements with each element represented by a name and an ordinal value. All of these enumerations are represented in this package by a Java enumeration.

As Java enumerations do not have to have an ordinal value associated with them, the AAF-specified ordinal value is provided through the MediaEnumerationValue interface that is implemented by all enumerations. The ordinal value of an element can be retrieved using the value() method. Some of the enumerations also provide a static fromOrdinal(int) method that can be used to return an enumeration element from its specified ordinal value.

Other enumerations are defined for implementation-specific reasons, such as ByteOrder. In general, these enumerations provide a convenient way to configure features the API or refer to property values in a user-friendly way.

Extendible enumeration

Extendible enumeration data types do not have a fixed set of specified elements, although a currently known set of built-in elements is provided in section 23.1 of the AAF object specification v1.1. An extendible enumeration element consists of a name and AUID unique identifier pair, suitable for the representation of reference data sets. The built-in elements are defined in the constant package using the extendible enumeration annotation. Additional elements can be registered with a JVM using the registration methods of the warehouse.

Heritage

The original versions of the enumerations of this package were derived from the enum type definitions in the existing C-based AAF reference implementation, from file "AAFTypes.h". A typical source enum definition looks like the code below:

    typedef aafInt32 aafContentScanningType_t;
    typedef enum _aafContentScanningType_e
    {
        kAAFContentScanning_NotKnown = 0,
        kAAFContentScanning_Progressive = 1,
        kAAFContentScanning_Interlace = 2,
        kAAFContentScanning_Mixed = 3
    } aafContentScanningType_e;

The following steps have been taken to convert the C-based enum type definitions into Java enumerations, taking advantage of Java's class-based representation of enumerations wherever possible:

The resulting underlying Java code for the content scanning type is:

    public enum ContentScanningType
        implements AAFEnumerationValue {

        NotKnown(0),
        Progressive(1),
        Interlace(2),
        Mixed(3);

        private int value;

        private ContentScanningType(
                int value) {

            this.value = value;
        }

        @Int64 public long value() {

            return (long) value;
        }
    }
See Also:
TypeDefinitionEnumeration, TypeDefinitionExtendibleEnumeration
Skip navigation links
Media Authoring with Java API (MAJ)

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