summaryrefslogtreecommitdiff
path: root/src/asdcp
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-01-11 13:55:39 +0000
committerCarl Hetherington <cth@carlh.net>2017-01-11 13:55:39 +0000
commitf3b0fb8717242dc705cb4f21a1338c365d3d4f75 (patch)
tree57b5d90e38dbd55ce517c64090040810fa3ff72a /src/asdcp
parent592720c9716a260b72e5bff9760e733a066e2a97 (diff)
Make the IMP stuff usable.
Diffstat (limited to 'src/asdcp')
-rw-r--r--src/asdcp/AS_02.h498
-rwxr-xr-xsrc/asdcp/KLV.h261
-rwxr-xr-xsrc/asdcp/MDD.h439
-rwxr-xr-xsrc/asdcp/MXF.h555
-rwxr-xr-xsrc/asdcp/MXFTypes.h548
-rwxr-xr-xsrc/asdcp/Metadata.h1043
6 files changed, 3344 insertions, 0 deletions
diff --git a/src/asdcp/AS_02.h b/src/asdcp/AS_02.h
new file mode 100644
index 0000000..129949a
--- /dev/null
+++ b/src/asdcp/AS_02.h
@@ -0,0 +1,498 @@
+/*
+Copyright (c) 2011-2014, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
+John Hurst
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*! \file AS_02.h
+ \version $Id: AS_02.h,v 1.19 2015/03/21 05:26:06 jhurst Exp $
+ \brief AS-02 library, public interface
+
+This module implements MXF AS-02 is a set of file access objects that
+offer simplified access to files conforming to the standards published
+by the SMPTE Media and Packaging Technology Committee 35PM. The file
+format, labeled IMF Essence Component (AKA "AS-02" for historical
+reasons), is described in the following document:
+
+ o SMPTE 2067-5:2013 IMF Essence Component
+
+The following use cases are supported by the module:
+
+ o Write essence to a plaintext or ciphertext AS-02 file:
+ JPEG 2000 codestreams
+ PCM audio streams
+
+ o Read essence from a plaintext or ciphertext AS-02 file:
+ JPEG 2000 codestreams
+ PCM audio streams
+
+ o Read header metadata from an AS-02 file
+
+NOTE: ciphertext support for clip-wrapped PCM is not yet complete.
+*/
+
+#ifndef _AS_02_H_
+#define _AS_02_H_
+
+#include "Metadata.h"
+
+
+namespace AS_02
+{
+ using Kumu::Result_t;
+
+ KM_DECLARE_RESULT(AS02_FORMAT, -116, "The file format is not proper OP-1a/AS-02.");
+
+ namespace MXF {
+ //
+ // reads distributed index tables and provides a uniform lookup with
+ // translated StreamOffest values (that is, StreamOffest is adjusted
+ // to the actual file position
+ class AS02IndexReader : public ASDCP::MXF::Partition
+ {
+ Kumu::ByteString m_IndexSegmentData;
+ ui32_t m_Duration;
+ ui32_t m_BytesPerEditUnit;
+
+ Result_t InitFromBuffer(const byte_t* p, ui32_t l, const ui64_t& body_offset, const ui64_t& essence_container_offset);
+
+ ASDCP_NO_COPY_CONSTRUCT(AS02IndexReader);
+ AS02IndexReader();
+
+ public:
+ const ASDCP::Dictionary*& m_Dict;
+ ASDCP::IPrimerLookup *m_Lookup;
+
+ AS02IndexReader(const ASDCP::Dictionary*&);
+ virtual ~AS02IndexReader();
+
+ Result_t InitFromFile(const Kumu::FileReader& reader, const ASDCP::MXF::RIP& rip, const bool has_header_essence);
+ ui32_t GetDuration() const;
+ void Dump(FILE* = 0);
+ Result_t GetMDObjectByID(const Kumu::UUID&, ASDCP::MXF::InterchangeObject** = 0);
+ Result_t GetMDObjectByType(const byte_t*, ASDCP::MXF::InterchangeObject** = 0);
+ Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<ASDCP::MXF::InterchangeObject*>& ObjectList);
+ Result_t Lookup(ui32_t frame_num, ASDCP::MXF::IndexTableSegment::IndexEntry&) const;
+ };
+
+
+ // Returns size in bytes of a single sample of data described by ADesc
+ inline ui32_t CalcSampleSize(const ASDCP::MXF::WaveAudioDescriptor& d)
+ {
+ return (d.QuantizationBits / 8) * d.ChannelCount;
+ }
+
+ // Returns number of samples per frame of data described by ADesc
+ inline ui32_t CalcSamplesPerFrame(const ASDCP::MXF::WaveAudioDescriptor& d, const ASDCP::Rational& edit_rate)
+ {
+ double tmpd = d.AudioSamplingRate.Quotient() / edit_rate.Quotient();
+ return (ui32_t)ceil(tmpd);
+ }
+
+ // Returns the size in bytes of a frame of data described by ADesc
+ inline ui32_t CalcFrameBufferSize(const ASDCP::MXF::WaveAudioDescriptor& d, const ASDCP::Rational& edit_rate)
+ {
+ return CalcSampleSize(d) * CalcSamplesPerFrame(d, edit_rate);
+ }
+
+ // Returns number of frames for data described by ADesc, given a duration in samples and an edit rate
+ inline ui32_t CalcFramesFromDurationInSamples(const ui32_t duration_samples, const ASDCP::MXF::WaveAudioDescriptor& d,
+ const ASDCP::Rational& edit_rate)
+ {
+ ui32_t spf = CalcSamplesPerFrame(d, edit_rate);
+ ui32_t frames = duration_samples / spf;
+
+ if ( duration_samples % spf != 0 )
+ {
+ ++frames;
+ }
+
+ return frames;
+ }
+
+ } // namespace MXF
+
+
+ // IMF App 2 edit rates not already exposed in namespace ASDCP
+ const ASDCP::Rational EditRate_29_97 = ASDCP::Rational(30000, 1001);
+ const ASDCP::Rational EditRate_59_94 = ASDCP::Rational(60000, 1001);
+
+ //---------------------------------------------------------------------------------
+ // Accessors in the MXFReader and MXFWriter classes below return these types to
+ // provide direct access to MXF metadata structures declared in MXF.h and Metadata.h
+
+ // See ST 2067-5 Sec. x.y.z
+ enum IndexStrategy_t
+ {
+ IS_LEAD,
+ IS_FOLLOW,
+ IS_FILE_SPECIFIC,
+ IS_MAX
+ };
+
+ namespace JP2K
+ {
+ //
+ class MXFWriter
+ {
+ class h__Writer;
+ ASDCP::mem_ptr<h__Writer> m_Writer;
+ ASDCP_NO_COPY_CONSTRUCT(MXFWriter);
+
+ public:
+ MXFWriter();
+ virtual ~MXFWriter();
+
+ // Warning: direct manipulation of MXF structures can interfere
+ // with the normal operation of the wrapper. Caveat emptor!
+ virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
+ virtual ASDCP::MXF::RIP& RIP();
+
+ // Open the file for writing. The file must not exist. Returns error if
+ // the operation cannot be completed or if nonsensical data is discovered
+ // in the essence descriptor.
+ Result_t OpenWrite(const std::string& filename, const ASDCP::WriterInfo&,
+ ASDCP::MXF::FileDescriptor* essence_descriptor,
+ ASDCP::MXF::InterchangeObject_list_t& essence_sub_descriptor_list,
+ const ASDCP::Rational& edit_rate, const ui32_t& header_size = 16384,
+ const IndexStrategy_t& strategy = IS_FOLLOW, const ui32_t& partition_space = 10);
+
+ // Writes a frame of essence to the MXF file. If the optional AESEncContext
+ // argument is present, the essence is encrypted prior to writing.
+ // Fails if the file is not open, is finalized, or an operating system
+ // error occurs.
+ Result_t WriteFrame(const ASDCP::JP2K::FrameBuffer&, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0);
+
+ // Closes the MXF file, writing the index and revised header.
+ Result_t Finalize();
+ };
+
+ //
+ class MXFReader
+ {
+ class h__Reader;
+ ASDCP::mem_ptr<h__Reader> m_Reader;
+ ASDCP_NO_COPY_CONSTRUCT(MXFReader);
+
+ public:
+ MXFReader();
+ virtual ~MXFReader();
+
+ // Warning: direct manipulation of MXF structures can interfere
+ // with the normal operation of the wrapper. Caveat emptor!
+ virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
+ virtual AS_02::MXF::AS02IndexReader& AS02IndexReader();
+ virtual ASDCP::MXF::RIP& RIP();
+
+ // Open the file for reading. The file must exist. Returns error if the
+ // operation cannot be completed.
+ Result_t OpenRead(const std::string& filename) const;
+
+ // Returns RESULT_INIT if the file is not open.
+ Result_t Close() const;
+
+ // Fill a WriterInfo struct with the values from the file's header.
+ // Returns RESULT_INIT if the file is not open.
+ Result_t FillWriterInfo(ASDCP::WriterInfo&) const;
+
+ // Reads a frame of essence from the MXF file. If the optional AESEncContext
+ // argument is present, the essence is decrypted after reading. If the MXF
+ // file is encrypted and the AESDecContext argument is NULL, the frame buffer
+ // will contain the ciphertext frame data. If the HMACContext argument is
+ // not NULL, the HMAC will be calculated (if the file supports it).
+ // Returns RESULT_INIT if the file is not open, failure if the frame number is
+ // out of range, or if optional decrypt or HAMC operations fail.
+ Result_t ReadFrame(ui32_t frame_number, ASDCP::JP2K::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
+
+ // Print debugging information to stream
+ void DumpHeaderMetadata(FILE* = 0) const;
+ void DumpIndex(FILE* = 0) const;
+ };
+
+ } //namespace JP2K
+
+
+ //---------------------------------------------------------------------------------
+ //
+ namespace PCM
+ {
+ // see AS_DCP.h for related data types
+
+ // An AS-02 PCM file is clip-wrapped, but the interface defined below mimics that used
+ // for frame-wrapped essence elsewhere in this library. The concept of frame rate
+ // therefore is only relevant to these classes and is not reflected in or affected by
+ // the contents of the MXF file. The frame rate that is set on the writer is only
+ // for compatibility with the existing parsers, samples are packed contiguously into
+ // the same clip-wrapped packet. Similarly, the edit rate must be set when initializing
+ // the reader to signal the number of samples to be read by each call to ReadFrame();
+
+ //
+ class MXFWriter
+ {
+ class h__Writer;
+ ASDCP::mem_ptr<h__Writer> m_Writer;
+ ASDCP_NO_COPY_CONSTRUCT(MXFWriter);
+
+ public:
+ MXFWriter();
+ virtual ~MXFWriter();
+
+ // Warning: direct manipulation of MXF structures can interfere
+ // with the normal operation of the wrapper. Caveat emptor!
+ virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
+ virtual ASDCP::MXF::RIP& RIP();
+
+ // Open the file for writing. The file must not exist. Returns error if
+ // the operation cannot be completed or if nonsensical data is discovered
+ // in the essence descriptor.
+ Result_t OpenWrite(const std::string& filename, const ASDCP::WriterInfo&,
+ ASDCP::MXF::FileDescriptor* essence_descriptor,
+ ASDCP::MXF::InterchangeObject_list_t& essence_sub_descriptor_list,
+ const ASDCP::Rational& edit_rate, ui32_t HeaderSize = 16384);
+
+ // Writes a frame of essence to the MXF file. If the optional AESEncContext
+ // argument is present, the essence is encrypted prior to writing.
+ // Fails if the file is not open, is finalized, or an operating system
+ // error occurs.
+ Result_t WriteFrame(const ASDCP::FrameBuffer&, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0);
+
+ // Closes the MXF file, writing the index and revised header.
+ Result_t Finalize();
+ };
+
+ //
+ class MXFReader
+ {
+ class h__Reader;
+ ASDCP::mem_ptr<h__Reader> m_Reader;
+ ASDCP_NO_COPY_CONSTRUCT(MXFReader);
+
+ public:
+ MXFReader();
+ virtual ~MXFReader();
+
+ // Warning: direct manipulation of MXF structures can interfere
+ // with the normal operation of the wrapper. Caveat emptor!
+ virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
+ virtual AS_02::MXF::AS02IndexReader& AS02IndexReader();
+ virtual ASDCP::MXF::RIP& RIP();
+
+ // Open the file for reading. The file must exist. Returns error if the
+ // operation cannot be completed.
+ Result_t OpenRead(const std::string& filename, const ASDCP::Rational& EditRate);
+
+ // Returns RESULT_INIT if the file is not open.
+ Result_t Close() const;
+
+ // Fill a WriterInfo struct with the values from the file's header.
+ // Returns RESULT_INIT if the file is not open.
+ Result_t FillWriterInfo(ASDCP::WriterInfo&) const;
+
+ // Reads a frame of essence from the MXF file. If the optional AESEncContext
+ // argument is present, the essence is decrypted after reading. If the MXF
+ // file is encrypted and the AESDecContext argument is NULL, the frame buffer
+ // will contain the ciphertext frame data. If the HMACContext argument is
+ // not NULL, the HMAC will be calculated (if the file supports it).
+ // Returns RESULT_INIT if the file is not open, failure if the frame number is
+ // out of range, or if optional decrypt or HAMC operations fail.
+ Result_t ReadFrame(ui32_t frame_number, ASDCP::PCM::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
+
+ // Print debugging information to stream
+ void DumpHeaderMetadata(FILE* = 0) const;
+ void DumpIndex(FILE* = 0) const;
+ };
+ } // namespace PCM
+
+ //---------------------------------------------------------------------------------
+ //
+ namespace TimedText
+ {
+ using ASDCP::TimedText::TimedTextDescriptor;
+ using ASDCP::TimedText::TimedTextResourceDescriptor;
+ using ASDCP::TimedText::ResourceList_t;
+
+ //
+ class Type5UUIDFilenameResolver : public ASDCP::TimedText::IResourceResolver
+ {
+ typedef std::map<Kumu::UUID, std::string> ResourceMap;
+
+ ResourceMap m_ResourceMap;
+ std::string m_Dirname;
+ KM_NO_COPY_CONSTRUCT(Type5UUIDFilenameResolver);
+
+ public:
+ Type5UUIDFilenameResolver();
+ virtual ~Type5UUIDFilenameResolver();
+ Result_t OpenRead(const std::string& dirname);
+ Result_t ResolveRID(const byte_t* uuid, ASDCP::TimedText::FrameBuffer& FrameBuf) const;
+ };
+
+ //
+ class ST2052_TextParser
+ {
+ class h__TextParser;
+ ASDCP::mem_ptr<h__TextParser> m_Parser;
+ ASDCP_NO_COPY_CONSTRUCT(ST2052_TextParser);
+
+ public:
+ ST2052_TextParser();
+ virtual ~ST2052_TextParser();
+
+ // Opens an XML file for reading, parses data to provide a complete
+ // set of stream metadata for the MXFWriter below.
+ Result_t OpenRead(const std::string& filename) const;
+
+ // Parse an XML string
+ Result_t OpenRead(const std::string& xml_doc, const std::string& filename) const;
+
+ // Fill a TimedTextDescriptor struct with the values from the file's contents.
+ // Returns RESULT_INIT if the file is not open.
+ Result_t FillTimedTextDescriptor(ASDCP::TimedText::TimedTextDescriptor&) const;
+
+ // Reads the complete Timed Text Resource into the given string.
+ Result_t ReadTimedTextResource(std::string&) const;
+
+ // Reads the Ancillary Resource having the given ID. Fails if the buffer
+ // is too small or the resource does not exist. The optional Resolver
+ // argument can be provided which will be used to retrieve the resource
+ // having a particulat UUID. If a Resolver is not supplied, the default
+ // internal resolver will return the contents of the file having the UUID
+ // as the filename. The filename must exist in the same directory as the
+ // XML file opened with OpenRead().
+ Result_t ReadAncillaryResource(const Kumu::UUID&, ASDCP::TimedText::FrameBuffer&,
+ const ASDCP::TimedText::IResourceResolver* Resolver = 0) const;
+ };
+
+ //
+ class MXFWriter
+ {
+ class h__Writer;
+ ASDCP::mem_ptr<h__Writer> m_Writer;
+ ASDCP_NO_COPY_CONSTRUCT(MXFWriter);
+
+ public:
+ MXFWriter();
+ virtual ~MXFWriter();
+
+ // Warning: direct manipulation of MXF structures can interfere
+ // with the normal operation of the wrapper. Caveat emptor!
+ virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
+ virtual ASDCP::MXF::RIP& RIP();
+
+ // Open the file for writing. The file must not exist. Returns error if
+ // the operation cannot be completed or if nonsensical data is discovered
+ // in the essence descriptor.
+ Result_t OpenWrite(const std::string& filename, const ASDCP::WriterInfo&,
+ const ASDCP::TimedText::TimedTextDescriptor&, ui32_t HeaderSize = 16384);
+
+ // Writes the Timed-Text Resource to the MXF file. The file must be UTF-8
+ // encoded. If the optional AESEncContext argument is present, the essence
+ // is encrypted prior to writing. Fails if the file is not open, is finalized,
+ // or an operating system error occurs.
+ // This method may only be called once, and it must be called before any
+ // call to WriteAncillaryResource(). RESULT_STATE will be returned if these
+ // conditions are not met.
+ Result_t WriteTimedTextResource(const std::string& XMLDoc, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0);
+
+ // Writes an Ancillary Resource to the MXF file. If the optional AESEncContext
+ // argument is present, the essence is encrypted prior to writing.
+ // Fails if the file is not open, is finalized, or an operating system
+ // error occurs. RESULT_STATE will be returned if the method is called before
+ // WriteTimedTextResource()
+ Result_t WriteAncillaryResource(const ASDCP::TimedText::FrameBuffer&, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0);
+
+ // Closes the MXF file, writing the index and revised header.
+ Result_t Finalize();
+ };
+
+ //
+ class MXFReader
+ {
+ class h__Reader;
+ ASDCP::mem_ptr<h__Reader> m_Reader;
+ ASDCP_NO_COPY_CONSTRUCT(MXFReader);
+
+ public:
+ MXFReader();
+ virtual ~MXFReader();
+
+ // Warning: direct manipulation of MXF structures can interfere
+ // with the normal operation of the wrapper. Caveat emptor!
+ virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
+ virtual AS_02::MXF::AS02IndexReader& AS02IndexReader();
+ virtual ASDCP::MXF::RIP& RIP();
+
+ // Open the file for reading. The file must exist. Returns error if the
+ // operation cannot be completed.
+ Result_t OpenRead(const std::string& filename) const;
+
+ // Returns RESULT_INIT if the file is not open.
+ Result_t Close() const;
+
+ // Fill a TimedTextDescriptor struct with the values from the file's header.
+ // Returns RESULT_INIT if the file is not open.
+ Result_t FillTimedTextDescriptor(ASDCP::TimedText::TimedTextDescriptor&) const;
+
+ // Fill a WriterInfo struct with the values from the file's header.
+ // Returns RESULT_INIT if the file is not open.
+ Result_t FillWriterInfo(ASDCP::WriterInfo&) const;
+
+ // Reads the complete Timed Text Resource into the given string. Fails if the resource
+ // is encrypted and AESDecContext is NULL (use the following method to retrieve the
+ // raw ciphertet block).
+ Result_t ReadTimedTextResource(std::string&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
+
+ // Reads the complete Timed Text Resource from the MXF file. If the optional AESEncContext
+ // argument is present, the resource is decrypted after reading. If the MXF
+ // file is encrypted and the AESDecContext argument is NULL, the frame buffer
+ // will contain the ciphertext frame data. If the HMACContext argument is
+ // not NULL, the HMAC will be calculated (if the file supports it).
+ // Returns RESULT_INIT if the file is not open, failure if the frame number is
+ // out of range, or if optional decrypt or HAMC operations fail.
+ Result_t ReadTimedTextResource(ASDCP::TimedText::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
+
+ // Reads the timed-text resource having the given UUID from the MXF file. If the
+ // optional AESEncContext argument is present, the resource is decrypted after
+ // reading. If the MXF file is encrypted and the AESDecContext argument is NULL,
+ // the frame buffer will contain the ciphertext frame data. If the HMACContext
+ // argument is not NULL, the HMAC will be calculated (if the file supports it).
+ // Returns RESULT_INIT if the file is not open, failure if the frame number is
+ // out of range, or if optional decrypt or HAMC operations fail.
+ Result_t ReadAncillaryResource(const Kumu::UUID&, ASDCP::TimedText::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
+
+ // Print debugging information to stream
+ void DumpHeaderMetadata(FILE* = 0) const;
+ void DumpIndex(FILE* = 0) const;
+ };
+ } // namespace TimedText
+
+
+} // namespace AS_02
+
+#endif // _AS_02_H_
+
+//
+// end AS_02.h
+//
diff --git a/src/asdcp/KLV.h b/src/asdcp/KLV.h
new file mode 100755
index 0000000..f00e1f6
--- /dev/null
+++ b/src/asdcp/KLV.h
@@ -0,0 +1,261 @@
+/*
+Copyright (c) 2005-2011, John Hurst
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*! \file KLV.h
+ \version $Id: KLV.h,v 1.29 2014/09/21 13:27:43 jhurst Exp $
+ \brief KLV objects
+*/
+
+#ifndef _KLV_H_
+#define _KLV_H_
+
+#include <asdcp/KM_fileio.h>
+#include <asdcp/KM_memio.h>
+#include <asdcp/AS_DCP.h>
+#include <asdcp/MDD.h>
+#include <map>
+
+
+namespace ASDCP
+{
+ const ui32_t MXF_BER_LENGTH = 4;
+ const ui32_t MXF_TAG_LENGTH = 2;
+ const ui32_t SMPTE_UL_LENGTH = 16;
+ const ui32_t SMPTE_UMID_LENGTH = 32;
+ const byte_t SMPTE_UL_START[4] = { 0x06, 0x0e, 0x2b, 0x34 };
+
+#ifndef MAX_KLV_PACKET_LENGTH
+ const ui32_t MAX_KLV_PACKET_LENGTH = 1024*1024*64;
+#endif
+
+ const ui32_t IdentBufferLen = 128;
+ const ui32_t IntBufferLen = 64;
+
+inline const char* i64sz(i64_t i, char* buf)
+{
+ assert(buf);
+#ifdef WIN32
+ snprintf(buf, IntBufferLen, "%I64d", i);
+#else
+ snprintf(buf, IntBufferLen, "%lld", i);
+#endif
+ return buf;
+}
+
+inline const char* ui64sz(ui64_t i, char* buf)
+{
+ assert(buf);
+#ifdef WIN32
+ snprintf(buf, IntBufferLen, "%I64u", i);
+#else
+ snprintf(buf, IntBufferLen, "%llu", i);
+#endif
+ return buf;
+}
+
+ struct TagValue
+ {
+ byte_t a;
+ byte_t b;
+
+ inline bool operator<(const TagValue& rhs) const {
+ if ( a < rhs.a ) return true;
+ if ( a == rhs.a && b < rhs.b ) return true;
+ return false;
+ }
+
+ inline bool operator==(const TagValue& rhs) const {
+ if ( a != rhs.a ) return false;
+ if ( b != rhs.b ) return false;
+ return true;
+ }
+ };
+
+ using Kumu::UUID;
+
+ // Universal Label
+ class UL : public Kumu::Identifier<SMPTE_UL_LENGTH>
+ {
+ public:
+ UL() {}
+ UL(const UL& rhs) : Kumu::Identifier<SMPTE_UL_LENGTH>(rhs) {}
+ UL(const byte_t* value) : Kumu::Identifier<SMPTE_UL_LENGTH>(value) {}
+ virtual ~UL() {}
+
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ bool operator==(const UL& rhs) const;
+ bool MatchIgnoreStream(const UL& rhs) const;
+ bool ExactMatch(const UL& rhs) const;
+ };
+
+ // UMID
+ class UMID : public Kumu::Identifier<SMPTE_UMID_LENGTH>
+ {
+ public:
+ UMID() {}
+ UMID(const UMID& rhs) : Kumu::Identifier<SMPTE_UMID_LENGTH>(rhs) {}
+ UMID(const byte_t* value) : Kumu::Identifier<SMPTE_UMID_LENGTH>(value) {}
+ virtual ~UMID() {}
+
+ void MakeUMID(int Type);
+ void MakeUMID(int Type, const UUID& ID);
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ };
+
+ const byte_t nil_UMID[SMPTE_UMID_LENGTH] = {0};
+ const UMID NilUMID(nil_UMID);
+
+ //
+ struct MDDEntry
+ {
+ byte_t ul[SMPTE_UL_LENGTH];
+ TagValue tag;
+ bool optional;
+ const char* name;
+ };
+
+ const MDDEntry& MXFInterop_OPAtom_Entry();
+ const MDDEntry& SMPTE_390_OPAtom_Entry();
+
+ //
+ class Dictionary
+ {
+ std::map<ASDCP::UL, ui32_t> m_md_lookup;
+ std::map<std::string, ui32_t> m_md_sym_lookup;
+ std::map<ui32_t, ASDCP::UL> m_md_rev_lookup;
+
+ ASDCP_NO_COPY_CONSTRUCT(Dictionary);
+
+ public:
+ MDDEntry m_MDD_Table[(ui32_t)ASDCP::MDD_Max];
+
+ Dictionary();
+ ~Dictionary();
+
+ void Init();
+ bool AddEntry(const MDDEntry& Entry, ui32_t index);
+ bool DeleteEntry(ui32_t index);
+
+ const MDDEntry* FindUL(const byte_t*) const;
+ const MDDEntry* FindSymbol(const std::string&) const;
+ const MDDEntry& Type(MDD_t type_id) const;
+
+ inline const byte_t* ul(MDD_t type_id) const {
+ return Type(type_id).ul;
+ }
+
+ void Dump(FILE* = 0) const;
+ };
+
+
+ const Dictionary& DefaultSMPTEDict();
+ const Dictionary& DefaultInteropDict();
+ const Dictionary& DefaultCompositeDict();
+
+ void default_md_object_init();
+
+ //
+ class IPrimerLookup
+ {
+ public:
+ virtual ~IPrimerLookup() {}
+ virtual void ClearTagList() = 0;
+ virtual Result_t InsertTag(const MDDEntry& Entry, ASDCP::TagValue& Tag) = 0;
+ virtual Result_t TagForKey(const ASDCP::UL& Key, ASDCP::TagValue& Tag) = 0;
+ };
+
+ //
+ class KLVPacket
+ {
+ ASDCP_NO_COPY_CONSTRUCT(KLVPacket);
+
+ protected:
+ const byte_t* m_KeyStart;
+ ui32_t m_KLLength;
+ const byte_t* m_ValueStart;
+ ui64_t m_ValueLength;
+ UL m_UL;
+
+ public:
+ KLVPacket() : m_KeyStart(0), m_KLLength(0), m_ValueStart(0), m_ValueLength(0) {}
+ virtual ~KLVPacket() {}
+
+ inline ui64_t PacketLength() {
+ return m_KLLength + m_ValueLength;
+ }
+
+ inline ui64_t ValueLength() {
+ return m_ValueLength;
+ }
+
+ inline ui32_t KLLength() {
+ return m_KLLength;
+ }
+
+ virtual UL GetUL();
+ virtual bool SetUL(const UL&);
+ virtual bool HasUL(const byte_t*);
+ virtual Result_t InitFromBuffer(const byte_t*, ui32_t);
+ virtual Result_t InitFromBuffer(const byte_t*, ui32_t, const UL& label);
+ virtual Result_t WriteKLToBuffer(ASDCP::FrameBuffer&, const UL& label, ui32_t length);
+
+ virtual Result_t WriteKLToBuffer(ASDCP::FrameBuffer& fb, ui32_t length)
+ {
+ if ( ! m_UL.HasValue() )
+ {
+ return RESULT_STATE;
+ }
+
+ return WriteKLToBuffer(fb, m_UL, length);
+ }
+
+ virtual void Dump(FILE*, const Dictionary& Dict, bool show_value);
+ };
+
+ //
+ class KLVFilePacket : public KLVPacket
+ {
+ ASDCP_NO_COPY_CONSTRUCT(KLVFilePacket);
+
+ public:
+ ASDCP::FrameBuffer m_Buffer;
+
+ KLVFilePacket() {}
+ virtual ~KLVFilePacket() {}
+
+ virtual Result_t InitFromFile(const Kumu::FileReader&);
+ virtual Result_t InitFromFile(const Kumu::FileReader&, const UL& label);
+ virtual Result_t WriteKLToFile(Kumu::FileWriter& Writer, const UL& label, ui32_t length);
+ };
+
+} // namespace ASDCP
+
+#endif // _KLV_H_
+
+
+//
+// end KLV.h
+//
diff --git a/src/asdcp/MDD.h b/src/asdcp/MDD.h
new file mode 100755
index 0000000..fe18bee
--- /dev/null
+++ b/src/asdcp/MDD.h
@@ -0,0 +1,439 @@
+/*
+Copyright (c) 2006-2015, John Hurst
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*! \file MDD.[h|cpp]
+ \version $Id: MDD.h,v 1.35 2015/01/22 21:05:58 jhurst Exp $
+ \brief MXF Metadata Dictionary
+*/
+
+#ifndef _MDD_H_
+#define _MDD_H_
+
+//
+namespace ASDCP {
+ enum MDD_t {
+ MDD_MICAlgorithm_NONE, // 0
+ MDD_MXFInterop_OPAtom, // 1
+ MDD_OPAtom, // 2
+ MDD_OP1a, // 3
+ MDD_GCMulti, // 4
+ MDD_PictureDataDef, // 5
+ MDD_SoundDataDef, // 6
+ MDD_TimecodeDataDef, // 7
+ MDD_DescriptiveMetaDataDef, // 8
+ MDD_WAVWrappingFrame, // 9
+ MDD_MPEG2_VESWrappingFrame, // 10
+ MDD_JPEG_2000WrappingFrame, // 11
+ MDD_JPEG2000Essence, // 12
+ MDD_MPEG2Essence, // 13
+ MDD_MXFInterop_CryptEssence, // 14
+ MDD_CryptEssence, // 15
+ MDD_WAVEssence, // 16
+ MDD_JP2KEssenceCompression_2K, // 17
+ MDD_JP2KEssenceCompression_4K, // 18
+ MDD_CipherAlgorithm_AES, // 19
+ MDD_MICAlgorithm_HMAC_SHA1, // 20
+ MDD_KLVFill, // 21
+ MDD_PartitionMetadata_MajorVersion, // 22
+ MDD_PartitionMetadata_MinorVersion, // 23
+ MDD_PartitionMetadata_KAGSize, // 24
+ MDD_PartitionMetadata_ThisPartition, // 25
+ MDD_PartitionMetadata_PreviousPartition, // 26
+ MDD_PartitionMetadata_FooterPartition, // 27
+ MDD_PartitionMetadata_HeaderByteCount, // 28
+ MDD_PartitionMetadata_IndexByteCount, // 29
+ MDD_PartitionMetadata_IndexSID_DEPRECATED, // 30
+ MDD_PartitionMetadata_BodyOffset, // 31
+ MDD_PartitionMetadata_BodySID_DEPRECATED, // 32
+ MDD_PartitionMetadata_OperationalPattern_DEPRECATED, // 33
+ MDD_PartitionMetadata_EssenceContainers_DEPRECATED, // 34
+ MDD_OpenHeader, // 35
+ MDD_OpenCompleteHeader, // 36
+ MDD_ClosedHeader, // 37
+ MDD_ClosedCompleteHeader, // 38
+ MDD_OpenBodyPartition, // 39
+ MDD_OpenCompleteBodyPartition, // 40
+ MDD_ClosedBodyPartition, // 41
+ MDD_ClosedCompleteBodyPartition, // 42
+ MDD_Footer, // 43
+ MDD_CompleteFooter, // 44
+ MDD_Primer, // 45
+ MDD_Primer_LocalTagEntryBatch, // 46
+ MDD_LocalTagEntryBatch_Primer_LocalTag, // 47
+ MDD_LocalTagEntryBatch_Primer_UID, // 48
+ MDD_InterchangeObject_InstanceUID, // 49
+ MDD_GenerationInterchangeObject_GenerationUID, // 50
+ MDD_DefaultObject, // 51
+ MDD_IndexTableSegmentBase_IndexEditRate, // 52
+ MDD_IndexTableSegmentBase_IndexStartPosition, // 53
+ MDD_IndexTableSegmentBase_IndexDuration, // 54
+ MDD_IndexTableSegmentBase_EditUnitByteCount, // 55
+ MDD_IndexTableSegmentBase_IndexSID_DEPRECATED, // 56
+ MDD_IndexTableSegmentBase_BodySID_DEPRECATED, // 57
+ MDD_IndexTableSegmentBase_SliceCount, // 58
+ MDD_IndexTableSegmentBase_PosTableCount, // 59
+ MDD_IndexTableSegment, // 60
+ MDD_IndexTableSegment_DeltaEntryArray, // 61
+ MDD_DeltaEntryArray_IndexTableSegment_PosTableIndex, // 62
+ MDD_DeltaEntryArray_IndexTableSegment_Slice, // 63
+ MDD_DeltaEntryArray_IndexTableSegment_ElementDelta, // 64
+ MDD_IndexTableSegment_IndexEntryArray, // 65
+ MDD_IndexEntryArray_IndexTableSegment_TemporalOffset, // 66
+ MDD_IndexEntryArray_IndexTableSegment_AnchorOffset, // 67
+ MDD_IndexEntryArray_IndexTableSegment_Flags, // 68
+ MDD_IndexEntryArray_IndexTableSegment_StreamOffset, // 69
+ MDD_IndexEntryArray_IndexTableSegment_SliceOffsetArray, // 70
+ MDD_IndexEntryArray_IndexTableSegment_PosTableArray, // 71
+ MDD_RandomIndexMetadata, // 72
+ MDD_PartitionArray_RandomIndexMetadata_BodySID_DEPRECATED, // 73
+ MDD_PartitionArray_RandomIndexMetadata_ByteOffset, // 74
+ MDD_RandomIndexMetadata_Length, // 75
+ MDD_RandomIndexMetadataV10, // 76
+ MDD_Preface, // 77
+ MDD_Preface_LastModifiedDate, // 78
+ MDD_Preface_Version, // 79
+ MDD_Preface_ObjectModelVersion, // 80
+ MDD_Preface_PrimaryPackage, // 81
+ MDD_Preface_Identifications, // 82
+ MDD_Preface_ContentStorage, // 83
+ MDD_Preface_OperationalPattern_DEPRECATED, // 84
+ MDD_Preface_EssenceContainers_DEPRECATED, // 85
+ MDD_Preface_DMSchemes, // 86
+ MDD_Identification, // 87
+ MDD_Identification_ThisGenerationUID, // 88
+ MDD_Identification_CompanyName, // 89
+ MDD_Identification_ProductName, // 90
+ MDD_Identification_ProductVersion, // 91
+ MDD_Identification_VersionString, // 92
+ MDD_Identification_ProductUID, // 93
+ MDD_Identification_ModificationDate, // 94
+ MDD_Identification_ToolkitVersion, // 95
+ MDD_Identification_Platform, // 96
+ MDD_ContentStorage, // 97
+ MDD_ContentStorage_Packages, // 98
+ MDD_ContentStorage_EssenceContainerData, // 99
+ MDD_ContentStorageKludge_V10Packages, // 100
+ MDD_EssenceContainerData, // 101
+ MDD_EssenceContainerData_LinkedPackageUID, // 102
+ MDD_EssenceContainerData_IndexSID_DEPRECATED, // 103
+ MDD_EssenceContainerData_BodySID_DEPRECATED, // 104
+ MDD_GenericPackage_PackageUID, // 105
+ MDD_GenericPackage_Name, // 106
+ MDD_GenericPackage_PackageCreationDate, // 107
+ MDD_GenericPackage_PackageModifiedDate, // 108
+ MDD_GenericPackage_Tracks, // 109
+ MDD_NetworkLocator, // 110
+ MDD_NetworkLocator_URLString, // 111
+ MDD_TextLocator, // 112
+ MDD_TextLocator_LocatorName, // 113
+ MDD_GenericTrack_TrackID, // 114
+ MDD_GenericTrack_TrackNumber, // 115
+ MDD_GenericTrack_TrackName, // 116
+ MDD_GenericTrack_Sequence, // 117
+ MDD_StaticTrack, // 118
+ MDD_Track, // 119
+ MDD_Track_EditRate, // 120
+ MDD_Track_Origin, // 121
+ MDD_EventTrack, // 122
+ MDD_EventTrack_EventEditRate, // 123
+ MDD_EventTrack_EventOrigin, // 124
+ MDD_StructuralComponent_DataDefinition, // 125
+ MDD_StructuralComponent_Duration, // 126
+ MDD_Sequence, // 127
+ MDD_Sequence_StructuralComponents, // 128
+ MDD_TimecodeComponent, // 129
+ MDD_TimecodeComponent_RoundedTimecodeBase, // 130
+ MDD_TimecodeComponent_StartTimecode, // 131
+ MDD_TimecodeComponent_DropFrame, // 132
+ MDD_SourceClip, // 133
+ MDD_SourceClip_StartPosition, // 134
+ MDD_SourceClip_SourcePackageID, // 135
+ MDD_SourceClip_SourceTrackID, // 136
+ MDD_DMSegment, // 137
+ MDD_DMSegment_EventStartPosition, // 138
+ MDD_DMSegment_EventComment, // 139
+ MDD_DMSegment_TrackIDs, // 140
+ MDD_DMSegment_DMFramework, // 141
+ MDD_DMSourceClip, // 142
+ MDD_DMSourceClip_DMSourceClipTrackIDs, // 143
+ MDD_MaterialPackage, // 144
+ MDD_SourcePackage, // 145
+ MDD_SourcePackage_Descriptor, // 146
+ MDD_GenericDescriptor_Locators, // 147
+ MDD_GenericDescriptor_SubDescriptors, // 148
+ MDD_FileDescriptor, // 149
+ MDD_FileDescriptor_LinkedTrackID, // 150
+ MDD_FileDescriptor_SampleRate, // 151
+ MDD_FileDescriptor_ContainerDuration, // 152
+ MDD_FileDescriptor_EssenceContainer, // 153
+ MDD_FileDescriptor_Codec, // 154
+ MDD_GenericPictureEssenceDescriptor, // 155
+ MDD_GenericPictureEssenceDescriptor_SignalStandard, // 156
+ MDD_GenericPictureEssenceDescriptor_FrameLayout, // 157
+ MDD_GenericPictureEssenceDescriptor_StoredWidth, // 158
+ MDD_GenericPictureEssenceDescriptor_StoredHeight, // 159
+ MDD_GenericPictureEssenceDescriptor_StoredF2Offset, // 160
+ MDD_GenericPictureEssenceDescriptor_SampledWidth, // 161
+ MDD_GenericPictureEssenceDescriptor_SampledHeight, // 162
+ MDD_GenericPictureEssenceDescriptor_SampledXOffset, // 163
+ MDD_GenericPictureEssenceDescriptor_SampledYOffset, // 164
+ MDD_GenericPictureEssenceDescriptor_DisplayHeight, // 165
+ MDD_GenericPictureEssenceDescriptor_DisplayWidth, // 166
+ MDD_GenericPictureEssenceDescriptor_DisplayXOffset, // 167
+ MDD_GenericPictureEssenceDescriptor_DisplayYOffset, // 168
+ MDD_GenericPictureEssenceDescriptor_DisplayF2Offset, // 169
+ MDD_GenericPictureEssenceDescriptor_AspectRatio, // 170
+ MDD_GenericPictureEssenceDescriptor_ActiveFormatDescriptor, // 171
+ MDD_GenericPictureEssenceDescriptor_VideoLineMap, // 172
+ MDD_GenericPictureEssenceDescriptor_AlphaTransparency, // 173
+ MDD_GenericPictureEssenceDescriptor_TransferCharacteristic, // 174
+ MDD_GenericPictureEssenceDescriptor_ImageAlignmentOffset, // 175
+ MDD_GenericPictureEssenceDescriptor_ImageStartOffset, // 176
+ MDD_GenericPictureEssenceDescriptor_ImageEndOffset, // 177
+ MDD_GenericPictureEssenceDescriptor_FieldDominance, // 178
+ MDD_GenericPictureEssenceDescriptor_PictureEssenceCoding, // 179
+ MDD_CDCIEssenceDescriptor, // 180
+ MDD_CDCIEssenceDescriptor_ComponentDepth, // 181
+ MDD_CDCIEssenceDescriptor_HorizontalSubsampling, // 182
+ MDD_CDCIEssenceDescriptor_VerticalSubsampling, // 183
+ MDD_CDCIEssenceDescriptor_ColorSiting, // 184
+ MDD_CDCIEssenceDescriptor_ReversedByteOrder, // 185
+ MDD_CDCIEssenceDescriptor_PaddingBits, // 186
+ MDD_CDCIEssenceDescriptor_AlphaSampleDepth, // 187
+ MDD_CDCIEssenceDescriptor_BlackRefLevel, // 188
+ MDD_CDCIEssenceDescriptor_WhiteReflevel, // 189
+ MDD_CDCIEssenceDescriptor_ColorRange, // 190
+ MDD_RGBAEssenceDescriptor, // 191
+ MDD_RGBAEssenceDescriptor_ComponentMaxRef, // 192
+ MDD_RGBAEssenceDescriptor_ComponentMinRef, // 193
+ MDD_RGBAEssenceDescriptor_AlphaMaxRef, // 194
+ MDD_RGBAEssenceDescriptor_AlphaMinRef, // 195
+ MDD_RGBAEssenceDescriptor_ScanningDirection, // 196
+ MDD_RGBAEssenceDescriptor_PixelLayout, // 197
+ MDD_RGBAEssenceDescriptor_Palette, // 198
+ MDD_RGBAEssenceDescriptor_PaletteLayout, // 199
+ MDD_GenericSoundEssenceDescriptor, // 200
+ MDD_GenericSoundEssenceDescriptor_AudioSamplingRate, // 201
+ MDD_GenericSoundEssenceDescriptor_Locked, // 202
+ MDD_GenericSoundEssenceDescriptor_AudioRefLevel, // 203
+ MDD_GenericSoundEssenceDescriptor_ElectroSpatialFormulation, // 204
+ MDD_GenericSoundEssenceDescriptor_ChannelCount, // 205
+ MDD_GenericSoundEssenceDescriptor_QuantizationBits, // 206
+ MDD_GenericSoundEssenceDescriptor_DialNorm, // 207
+ MDD_GenericSoundEssenceDescriptor_SoundEssenceCoding, // 208
+ MDD_GenericDataEssenceDescriptor, // 209
+ MDD_GenericDataEssenceDescriptor_DataEssenceCoding, // 210
+ MDD_MultipleDescriptor, // 211
+ MDD_MultipleDescriptor_SubDescriptorUIDs, // 212
+ MDD_MPEG2VideoDescriptor, // 213
+ MDD_MPEG2VideoDescriptor_SingleSequence, // 214
+ MDD_MPEG2VideoDescriptor_ConstantBFrames, // 215
+ MDD_MPEG2VideoDescriptor_CodedContentType, // 216
+ MDD_MPEG2VideoDescriptor_LowDelay, // 217
+ MDD_MPEG2VideoDescriptor_ClosedGOP, // 218
+ MDD_MPEG2VideoDescriptor_IdenticalGOP, // 219
+ MDD_MPEG2VideoDescriptor_MaxGOP, // 220
+ MDD_MPEG2VideoDescriptor_BPictureCount, // 221
+ MDD_MPEG2VideoDescriptor_BitRate, // 222
+ MDD_MPEG2VideoDescriptor_ProfileAndLevel, // 223
+ MDD_WaveAudioDescriptor, // 224
+ MDD_WaveAudioDescriptor_BlockAlign, // 225
+ MDD_WaveAudioDescriptor_SequenceOffset, // 226
+ MDD_WaveAudioDescriptor_AvgBps, // 227
+ MDD_WaveAudioDescriptor_PeakEnvelope, // 228
+ MDD_JPEG2000PictureSubDescriptor, // 229
+ MDD_JPEG2000PictureSubDescriptor_Rsize, // 230
+ MDD_JPEG2000PictureSubDescriptor_Xsize, // 231
+ MDD_JPEG2000PictureSubDescriptor_Ysize, // 232
+ MDD_JPEG2000PictureSubDescriptor_XOsize, // 233
+ MDD_JPEG2000PictureSubDescriptor_YOsize, // 234
+ MDD_JPEG2000PictureSubDescriptor_XTsize, // 235
+ MDD_JPEG2000PictureSubDescriptor_YTsize, // 236
+ MDD_JPEG2000PictureSubDescriptor_XTOsize, // 237
+ MDD_JPEG2000PictureSubDescriptor_YTOsize, // 238
+ MDD_JPEG2000PictureSubDescriptor_Csize, // 239
+ MDD_JPEG2000PictureSubDescriptor_PictureComponentSizing, // 240
+ MDD_JPEG2000PictureSubDescriptor_CodingStyleDefault, // 241
+ MDD_JPEG2000PictureSubDescriptor_QuantizationDefault, // 242
+ MDD_DM_Framework, // 243
+ MDD_DM_Set, // 244
+ MDD_EncryptedContainerLabel, // 245
+ MDD_CryptographicFrameworkLabel, // 246
+ MDD_CryptographicFramework, // 247
+ MDD_CryptographicFramework_ContextSR, // 248
+ MDD_CryptographicContext, // 249
+ MDD_CryptographicContext_ContextID, // 250
+ MDD_CryptographicContext_SourceEssenceContainer, // 251
+ MDD_CryptographicContext_CipherAlgorithm, // 252
+ MDD_CryptographicContext_MICAlgorithm, // 253
+ MDD_CryptographicContext_CryptographicKeyID, // 254
+ MDD_TimedTextWrappingClip, // 255
+ MDD_TimedTextEssence, // 256
+ MDD_TimedTextDescriptor, // 257
+ MDD_TimedTextDescriptor_ResourceID, // 258
+ MDD_TimedTextDescriptor_UCSEncoding, // 259
+ MDD_TimedTextDescriptor_NamespaceURI, // 260
+ MDD_TimedTextResourceSubDescriptor, // 261
+ MDD_TimedTextResourceSubDescriptor_AncillaryResourceID, // 262
+ MDD_TimedTextResourceSubDescriptor_MIMEMediaType, // 263
+ MDD_TimedTextResourceSubDescriptor_EssenceStreamID_DEPRECATED, // 264
+ MDD_GenericStreamPartition, // 265
+ MDD_DMSegment_DataDefinition_DEPRECATED, // 266
+ MDD_DMSegment_Duration_DEPRECATED, // 267
+ MDD_DMSegment_TrackIDList, // 268
+ MDD_StereoscopicPictureSubDescriptor, // 269
+ MDD_WaveAudioDescriptor_ChannelAssignment, // 270
+ MDD_GenericStream_DataElement, // 271
+ MDD_MXFInterop_GenericDescriptor_SubDescriptors, // 272
+ MDD_Core_BodySID, // 273
+ MDD_Core_IndexSID, // 274
+ MDD_Core_OperationalPattern, // 275
+ MDD_Core_EssenceContainers, // 276
+ MDD_DCAudioChannelCfg_1_5p1, // 277
+ MDD_DCAudioChannelCfg_2_6p1, // 278
+ MDD_DCAudioChannelCfg_3_7p1, // 279
+ MDD_DCAudioChannelCfg_4_WTF, // 280
+ MDD_DCAudioChannelCfg_5_7p1_DS, // 281
+ MDD_MCALabelSubDescriptor, // 282
+ MDD_AudioChannelLabelSubDescriptor, // 283
+ MDD_SoundfieldGroupLabelSubDescriptor, // 284
+ MDD_GroupOfSoundfieldGroupsLabelSubDescriptor, // 285
+ MDD_MCALabelSubDescriptor_MCALabelDictionaryID, // 286
+ MDD_MCALabelSubDescriptor_MCALinkID, // 287
+ MDD_MCALabelSubDescriptor_MCATagSymbol, // 288
+ MDD_MCALabelSubDescriptor_MCATagName, // 289
+ MDD_MCALabelSubDescriptor_MCAChannelID, // 290
+ MDD_MCALabelSubDescriptor_RFC5646SpokenLanguage, // 291
+ MDD_AudioChannelLabelSubDescriptor_SoundfieldGroupLinkID, // 292
+ MDD_SoundfieldGroupLabelSubDescriptor_GroupOfSoundfieldGroupsLinkID, // 293
+ MDD_DCDataWrappingFrame, // 294
+ MDD_DCDataEssence, // 295
+ MDD_DCDataDescriptor, // 296
+ MDD_DolbyAtmosSubDescriptor, // 297
+ MDD_DolbyAtmosSubDescriptor_AtmosVersion, // 298
+ MDD_DolbyAtmosSubDescriptor_MaxChannelCount, // 299
+ MDD_DolbyAtmosSubDescriptor_MaxObjectCount, // 300
+ MDD_DolbyAtmosSubDescriptor_AtmosID, // 301
+ MDD_DolbyAtmosSubDescriptor_FirstFrame, // 302
+ MDD_DataDataDef, // 303
+ MDD_DCAudioChannelCfg_MCA, // 304
+ MDD_DCAudioChannel_L, // 305
+ MDD_DCAudioChannel_R, // 306
+ MDD_DCAudioChannel_C, // 307
+ MDD_DCAudioChannel_LFE, // 308
+ MDD_DCAudioChannel_Ls, // 309
+ MDD_DCAudioChannel_Rs, // 310
+ MDD_DCAudioChannel_Lss, // 311
+ MDD_DCAudioChannel_Rss, // 312
+ MDD_DCAudioChannel_Lrs, // 313
+ MDD_DCAudioChannel_Rrs, // 314
+ MDD_DCAudioChannel_Lc, // 315
+ MDD_DCAudioChannel_Rc, // 316
+ MDD_DCAudioChannel_Cs, // 317
+ MDD_DCAudioChannel_HI, // 318
+ MDD_DCAudioChannel_VIN, // 319
+ MDD_DCAudioSoundfield_51, // 320
+ MDD_DCAudioSoundfield_71, // 321
+ MDD_DCAudioSoundfield_SDS, // 322
+ MDD_DCAudioSoundfield_61, // 323
+ MDD_DCAudioSoundfield_M, // 324
+ MDD_WAVEssenceClip, // 325
+ MDD_IMFAudioChannelCfg_MCA, // 326
+ MDD_IMFAudioChannel_M1, // 327
+ MDD_IMFAudioChannel_M2, // 328
+ MDD_IMFAudioChannel_Lt, // 329
+ MDD_IMFAudioChannel_Rt, // 330
+ MDD_IMFAudioChannel_Lst, // 331
+ MDD_IMFAudioChannel_Rst, // 332
+ MDD_IMFAudioChannel_S, // 333
+ MDD_IMFNumberedSourceChannel, // 334
+ MDD_IMFAudioSoundfield_ST, // 335
+ MDD_IMFAudioSoundfield_DM, // 336
+ MDD_IMFAudioSoundfield_DNS, // 337
+ MDD_IMFAudioSoundfield_30, // 338
+ MDD_IMFAudioSoundfield_40, // 339
+ MDD_IMFAudioSoundfield_50, // 340
+ MDD_IMFAudioSoundfield_60, // 341
+ MDD_IMFAudioSoundfield_70, // 342
+ MDD_IMFAudioSoundfield_LtRt, // 343
+ MDD_IMFAudioSoundfield_51Ex, // 344
+ MDD_IMFAudioSoundfield_HI, // 345
+ MDD_IMFAudioSoundfield_VIN, // 346
+ MDD_IMFAudioGroup_MPg, // 347
+ MDD_IMFAudioGroup_DVS, // 348
+ MDD_IMFAudioGroup_Dcm, // 349
+ MDD_MaterialPackage_PackageMarker, // 350
+ MDD_GenericPictureEssenceDescriptor_CodingEquations, // 351
+ MDD_GenericPictureEssenceDescriptor_ColorPrimaries, // 352
+ MDD_JP2KEssenceCompression_BroadcastProfile_1, // 353
+ MDD_JP2KEssenceCompression_BroadcastProfile_2, // 354
+ MDD_JP2KEssenceCompression_BroadcastProfile_3, // 355
+ MDD_JP2KEssenceCompression_BroadcastProfile_4, // 356
+ MDD_JP2KEssenceCompression_BroadcastProfile_5, // 357
+ MDD_JP2KEssenceCompression_BroadcastProfile_6, // 358
+ MDD_JP2KEssenceCompression_BroadcastProfile_7, // 359
+ MDD_WaveAudioDescriptor_ReferenceImageEditRate, // 360
+ MDD_WaveAudioDescriptor_ReferenceAudioAlignmentLevel, // 361
+ MDD_GenericPictureEssenceDescriptor_AlternativeCenterCuts, // 362
+ MDD_GenericPictureEssenceDescriptor_ActiveHeight, // 363
+ MDD_GenericPictureEssenceDescriptor_ActiveWidth, // 364
+ MDD_GenericPictureEssenceDescriptor_ActiveXOffset, // 365
+ MDD_GenericPictureEssenceDescriptor_ActiveYOffset, // 366
+ MDD_TimedTextDescriptor_RFC5646LanguageTagList, // 367
+ MDD_AlternativeCenterCuts_4x3, // 368
+ MDD_AlternativeCenterCuts_14x9, // 369
+ MDD_WAVWrappingClip, // 370
+ MDD_DBOXMotionCodePrimaryStream, // 371
+ MDD_DBOXMotionCodeSecondaryStream, // 372
+ MDD_ContainerConstraintSubDescriptor, // 373
+ MDD_PHDRImageMetadataWrappingFrame, // 374
+ MDD_PHDRImageMetadataItem, // 375
+ MDD_PHDRMetadataTrackSubDescriptor, // 376
+ MDD_PHDRMetadataTrackSubDescriptor_DataDefinition, // 377
+ MDD_PHDRMetadataTrackSubDescriptor_SourceTrackID, // 378
+ MDD_PHDRMetadataTrackSubDescriptor_SimplePayloadSID, // 379
+ MDD_JPEG2000PictureSubDescriptor_J2CLayout, // 380
+ MDD_Max
+ }; // enum MDD_t
+
+ //
+ const MDD_t MDD_EssenceContainerData_BodySID = MDD_Core_BodySID;
+ const MDD_t MDD_IndexTableSegmentBase_IndexSID = MDD_Core_IndexSID;
+ const MDD_t MDD_EssenceContainerData_IndexSID = MDD_Core_IndexSID;
+ const MDD_t MDD_DMSegment_DataDefinition = MDD_StructuralComponent_DataDefinition;
+ const MDD_t MDD_DMSegment_Duration = MDD_StructuralComponent_Duration;
+ const MDD_t MDD_Preface_EssenceContainers = MDD_Core_EssenceContainers;
+ const MDD_t MDD_Preface_OperationalPattern = MDD_Core_OperationalPattern;
+ const MDD_t MDD_TimedTextResourceSubDescriptor_EssenceStreamID = MDD_Core_BodySID;
+
+} // namespaceASDCP
+
+
+#endif // _MDD_H_
+
+//
+// end MDD.h
+//
diff --git a/src/asdcp/MXF.h b/src/asdcp/MXF.h
new file mode 100755
index 0000000..93a4dbb
--- /dev/null
+++ b/src/asdcp/MXF.h
@@ -0,0 +1,555 @@
+/*
+Copyright (c) 2005-2015, John Hurst
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*! \file MXF.h
+ \version $Id: MXF.h,v 1.57 2015/10/10 20:26:29 jhurst Exp $
+ \brief MXF objects
+*/
+
+#ifndef _MXF_H_
+#define _MXF_H_
+
+#include "MXFTypes.h"
+#include <algorithm>
+
+namespace ASDCP
+{
+ namespace MXF
+ {
+ class InterchangeObject;
+
+ const ui32_t kl_length = ASDCP::SMPTE_UL_LENGTH + ASDCP::MXF_BER_LENGTH;
+
+ //
+ typedef ASDCP::MXF::InterchangeObject* (*MXFObjectFactory_t)(const Dictionary*&);
+
+ //
+ void SetObjectFactory(const UL& label, MXFObjectFactory_t factory);
+
+ //
+ InterchangeObject* CreateObject(const Dictionary*& Dict, const UL& label);
+
+
+ // seek an open file handle to the start of the RIP KLV packet
+ Result_t SeekToRIP(const Kumu::FileReader&);
+
+ //
+ class RIP : public ASDCP::KLVFilePacket
+ {
+ ASDCP_NO_COPY_CONSTRUCT(RIP);
+ RIP();
+
+ public:
+ //
+ class PartitionPair : public Kumu::IArchive
+ {
+ public:
+ ui32_t BodySID;
+ ui64_t ByteOffset;
+
+ PartitionPair() : BodySID(0), ByteOffset(0) {}
+ PartitionPair(ui32_t sid, ui64_t offset) : BodySID(sid), ByteOffset(offset) {}
+ virtual ~PartitionPair() {}
+
+ ui32_t Size() { return sizeof(ui32_t) + sizeof(ui64_t); }
+
+ inline const char* EncodeString(char* str_buf, ui32_t buf_len) const {
+ Kumu::ui64Printer offset_str(ByteOffset);
+ snprintf(str_buf, buf_len, "%-6u: %s", BodySID, offset_str.c_str());
+ return str_buf;
+ }
+
+ inline bool HasValue() const { return true; }
+ inline ui32_t ArchiveLength() const { return sizeof(ui32_t) + sizeof(ui64_t); }
+
+ inline bool Unarchive(Kumu::MemIOReader* Reader) {
+ if ( ! Reader->ReadUi32BE(&BodySID) ) return false;
+ if ( ! Reader->ReadUi64BE(&ByteOffset) ) return false;
+ return true;
+ }
+
+ inline bool Archive(Kumu::MemIOWriter* Writer) const {
+ if ( ! Writer->WriteUi32BE(BodySID) ) return false;
+ if ( ! Writer->WriteUi64BE(ByteOffset) ) return false;
+ return true;
+ }
+ };
+
+ const Dictionary*& m_Dict;
+
+ typedef SimpleArray<PartitionPair>::iterator pair_iterator;
+ typedef SimpleArray<PartitionPair>::const_iterator const_pair_iterator;
+
+ SimpleArray<PartitionPair> PairArray;
+
+ RIP(const Dictionary*& d) : m_Dict(d) {}
+ virtual ~RIP() {}
+ virtual Result_t InitFromFile(const Kumu::FileReader& Reader);
+ virtual Result_t WriteToFile(Kumu::FileWriter& Writer);
+ virtual bool GetPairBySID(ui32_t, PartitionPair&) const;
+ virtual void Dump(FILE* = 0);
+ };
+
+
+ //
+ class Partition : public ASDCP::KLVFilePacket
+ {
+ ASDCP_NO_COPY_CONSTRUCT(Partition);
+ Partition();
+
+ protected:
+ class PacketList
+ {
+ public:
+ std::list<InterchangeObject*> m_List;
+ std::map<UUID, InterchangeObject*> m_Map;
+
+ ~PacketList();
+ void AddPacket(InterchangeObject* ThePacket); // takes ownership
+ Result_t GetMDObjectByID(const UUID& ObjectID, InterchangeObject** Object);
+ Result_t GetMDObjectByType(const byte_t* ObjectID, InterchangeObject** Object);
+ Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<InterchangeObject*>& ObjectList);
+ };
+
+ mem_ptr<PacketList> m_PacketList;
+
+ public:
+ const Dictionary*& m_Dict;
+
+ ui16_t MajorVersion;
+ ui16_t MinorVersion;
+ ui32_t KAGSize;
+ ui64_t ThisPartition;
+ ui64_t PreviousPartition;
+ ui64_t FooterPartition;
+ ui64_t HeaderByteCount;
+ ui64_t IndexByteCount;
+ ui32_t IndexSID;
+ ui64_t BodyOffset;
+ ui32_t BodySID;
+ UL OperationalPattern;
+ Batch<UL> EssenceContainers;
+
+ Partition(const Dictionary*&);
+ virtual ~Partition();
+ virtual void AddChildObject(InterchangeObject*); // takes ownership
+ virtual Result_t InitFromFile(const Kumu::FileReader& Reader);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToFile(Kumu::FileWriter& Writer, UL& PartitionLabel);
+ virtual ui32_t ArchiveSize(); // returns the size of the archived structure
+ virtual void Dump(FILE* = 0);
+ };
+
+
+ //
+ class Primer : public ASDCP::KLVFilePacket, public ASDCP::IPrimerLookup
+ {
+ class h__PrimerLookup;
+ mem_ptr<h__PrimerLookup> m_Lookup;
+ ui8_t m_LocalTag;
+ ASDCP_NO_COPY_CONSTRUCT(Primer);
+ Primer();
+
+ public:
+ //
+ class LocalTagEntry : Kumu::IArchive
+ {
+ public:
+ TagValue Tag;
+ ASDCP::UL UL;
+
+ LocalTagEntry() { Tag.a = Tag.b = 0; }
+ LocalTagEntry(const TagValue& tag, ASDCP::UL& ul) : Tag(tag), UL(ul) {}
+
+ bool operator<(const LocalTagEntry& rhs) const {
+ return ( ( Tag.a < rhs.Tag.a ) || ( Tag.b < rhs.Tag.b ) );
+ }
+
+ inline const char* EncodeString(char* str_buf, ui32_t buf_len) const {
+ snprintf(str_buf, buf_len, "%02x %02x: ", Tag.a, Tag.b);
+ UL.EncodeString(str_buf + strlen(str_buf), buf_len - strlen(str_buf));
+ return str_buf;
+ }
+
+ inline bool HasValue() const { return UL.HasValue(); }
+ inline ui32_t ArchiveLength() const { return 2 + UL.ArchiveLength(); }
+
+ inline bool Unarchive(Kumu::MemIOReader* Reader) {
+ if ( ! Reader->ReadUi8(&Tag.a) ) return false;
+ if ( ! Reader->ReadUi8(&Tag.b) ) return false;
+ return UL.Unarchive(Reader);
+ }
+
+ inline bool Archive(Kumu::MemIOWriter* Writer) const {
+ if ( ! Writer->WriteUi8(Tag.a) ) return false;
+ if ( ! Writer->WriteUi8(Tag.b) ) return false;
+ return UL.Archive(Writer);
+ }
+ };
+
+ Batch<LocalTagEntry> LocalTagEntryBatch;
+ const Dictionary*& m_Dict;
+
+ Primer(const Dictionary*&);
+ virtual ~Primer();
+
+ virtual void ClearTagList();
+ virtual Result_t InsertTag(const MDDEntry& Entry, ASDCP::TagValue& Tag);
+ virtual Result_t TagForKey(const ASDCP::UL& Key, ASDCP::TagValue& Tag);
+
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ virtual Result_t WriteToFile(Kumu::FileWriter& Writer);
+ virtual void Dump(FILE* = 0);
+ };
+
+ // wrapper object manages optional properties
+ template <class PropertyType>
+ class optional_property
+ {
+ PropertyType m_property;
+ bool m_has_value;
+
+ public:
+ optional_property() : m_has_value(false) {}
+ optional_property(const PropertyType& value) : m_property(value), m_has_value(true) {}
+ const optional_property<PropertyType>& operator=(const PropertyType& rhs) {
+ this->m_property = rhs;
+ this->m_has_value = true;
+ return *this;
+ }
+ bool operator==(const PropertyType& rhs) const { return this->m_property == rhs; }
+ bool operator==(const optional_property<PropertyType>& rhs) const { return this->m_property == rhs.m_property; }
+ operator PropertyType&() { return this->m_property; }
+ void set(const PropertyType& rhs) { this->m_property = rhs; this->m_has_value = true; }
+ void set_has_value(bool has_value = true) { this->m_has_value = has_value; }
+ void reset(const PropertyType& rhs) { this->m_has_value = false; }
+ bool empty() const { return ! m_has_value; }
+ PropertyType& get() { return m_property; }
+ const PropertyType& const_get() const { return m_property; }
+ };
+
+ // wrapper object manages optional properties
+ template <class PropertyType>
+ class optional_container_property
+ {
+ PropertyType m_property;
+
+ public:
+ optional_container_property() {}
+ optional_container_property(const PropertyType& value) : m_property(value) {}
+ const optional_container_property<PropertyType>& operator=(const PropertyType& rhs) {
+ this->Copy(rhs.m_property);
+ return *this;
+ }
+
+ bool operator==(const PropertyType& rhs) const { return this->m_property == rhs; }
+ bool operator==(const optional_property<PropertyType>& rhs) const { return this->m_property == rhs.m_property; }
+ operator PropertyType&() { return this->m_property; }
+ void set(const PropertyType& rhs) { this->m_property = rhs; }
+ void reset(const PropertyType& rhs) { this->clear(); }
+ bool empty() const { return ! this->m_property.HasValue(); }
+ PropertyType& get() { return m_property; }
+ const PropertyType& const_get() const { return m_property; }
+ };
+
+ // base class of all metadata objects
+ //
+ class InterchangeObject : public ASDCP::KLVPacket
+ {
+ InterchangeObject();
+
+ public:
+ const Dictionary*& m_Dict;
+ IPrimerLookup* m_Lookup;
+ UUID InstanceUID;
+ optional_property<UUID> GenerationUID;
+
+ InterchangeObject(const Dictionary*& d) : m_Dict(d), m_Lookup(0) {}
+ virtual ~InterchangeObject() {}
+
+ virtual void Copy(const InterchangeObject& rhs);
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ virtual bool IsA(const byte_t* label);
+ virtual const char* ObjectName() { return "InterchangeObject"; }
+ virtual void Dump(FILE* stream = 0);
+ };
+
+ //
+ typedef std::list<InterchangeObject*> InterchangeObject_list_t;
+
+ //
+ class Preface : public InterchangeObject
+ {
+ ASDCP_NO_COPY_CONSTRUCT(Preface);
+ Preface();
+
+ public:
+ const Dictionary*& m_Dict;
+ Kumu::Timestamp LastModifiedDate;
+ ui16_t Version;
+ optional_property<ui32_t> ObjectModelVersion;
+ optional_property<UUID> PrimaryPackage;
+ Array<UUID> Identifications;
+ UUID ContentStorage;
+ UL OperationalPattern;
+ Batch<UL> EssenceContainers;
+ Batch<UL> DMSchemes;
+ optional_property<Batch<UL> > ApplicationSchemes;
+
+ Preface(const Dictionary*& d);
+ virtual ~Preface() {}
+
+ virtual void Copy(const Preface& rhs);
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ virtual void Dump(FILE* = 0);
+ };
+
+ const ui32_t MaxIndexSegmentSize = 65536;
+
+ //
+ class IndexTableSegment : public InterchangeObject
+ {
+ IndexTableSegment();
+ ASDCP_NO_COPY_CONSTRUCT(IndexTableSegment);
+
+ public:
+ //
+ class DeltaEntry : public Kumu::IArchive
+ {
+ public:
+ i8_t PosTableIndex;
+ ui8_t Slice;
+ ui32_t ElementData;
+
+ DeltaEntry() : PosTableIndex(0), Slice(0), ElementData(0) {}
+ DeltaEntry(i8_t pos, ui8_t slice, ui32_t data) : PosTableIndex(pos), Slice(slice), ElementData(data) {}
+ inline bool HasValue() const { return true; }
+ ui32_t ArchiveLength() const { return sizeof(ui32_t) + 2; }
+ bool Unarchive(Kumu::MemIOReader* Reader);
+ bool Archive(Kumu::MemIOWriter* Writer) const;
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ };
+
+ //
+ class IndexEntry : public Kumu::IArchive
+ {
+ public:
+ i8_t TemporalOffset;
+ i8_t KeyFrameOffset;
+ ui8_t Flags;
+ ui64_t StreamOffset;
+
+ // if you use these, you will need to change CBRIndexEntriesPerSegment in MXF.cpp
+ // to a more suitable value
+ // std::list<ui32_t> SliceOffset;
+ // Array<Rational> PosTable;
+
+ IndexEntry() : TemporalOffset(0), KeyFrameOffset(0), Flags(0), StreamOffset(0) {}
+ IndexEntry(i8_t t_ofst, i8_t k_ofst, ui8_t flags, ui64_t s_ofst) :
+ TemporalOffset(t_ofst), KeyFrameOffset(k_ofst), Flags(flags), StreamOffset(s_ofst) {}
+ inline bool HasValue() const { return true; }
+ ui32_t ArchiveLength() const { return sizeof(ui64_t) + 3; };
+ bool Unarchive(Kumu::MemIOReader* Reader);
+ bool Archive(Kumu::MemIOWriter* Writer) const;
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ };
+
+ const Dictionary*& m_Dict;
+ ui64_t RtFileOffset; // not part of the MXF structure: used to manage runtime index access
+ ui64_t RtEntryOffset;
+
+ Rational IndexEditRate;
+ ui64_t IndexStartPosition;
+ ui64_t IndexDuration;
+ ui32_t EditUnitByteCount;
+ ui32_t IndexSID;
+ ui32_t BodySID;
+ ui8_t SliceCount;
+ ui8_t PosTableCount;
+ Array<DeltaEntry> DeltaEntryArray;
+ Array<IndexEntry> IndexEntryArray;
+
+ IndexTableSegment(const Dictionary*&);
+ virtual ~IndexTableSegment();
+
+ virtual void Copy(const IndexTableSegment& rhs);
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ virtual void Dump(FILE* = 0);
+ };
+
+ //---------------------------------------------------------------------------------
+ //
+ class Identification;
+ class SourcePackage;
+
+ //
+ class OP1aHeader : public Partition
+ {
+ Kumu::ByteString m_HeaderData;
+ ASDCP_NO_COPY_CONSTRUCT(OP1aHeader);
+ OP1aHeader();
+
+ public:
+ const Dictionary*& m_Dict;
+ ASDCP::MXF::Primer m_Primer;
+ Preface* m_Preface;
+
+ OP1aHeader(const Dictionary*&);
+ virtual ~OP1aHeader();
+ virtual Result_t InitFromFile(const Kumu::FileReader& Reader);
+ virtual Result_t InitFromPartitionBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToFile(Kumu::FileWriter& Writer, ui32_t HeaderLength = 16384);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t GetMDObjectByID(const UUID&, InterchangeObject** = 0);
+ virtual Result_t GetMDObjectByType(const byte_t*, InterchangeObject** = 0);
+ virtual Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<InterchangeObject*>& ObjectList);
+ Identification* GetIdentification();
+ SourcePackage* GetSourcePackage();
+ };
+
+ // Searches the header object and returns the edit rate based on the contents of the
+ // File Package items. Logs an error message and returns false if anthing goes wrong.
+ bool GetEditRateFromFP(ASDCP::MXF::OP1aHeader& header, ASDCP::Rational& edit_rate);
+
+ //
+ class OPAtomIndexFooter : public Partition
+ {
+ Kumu::ByteString m_FooterData;
+ IndexTableSegment* m_CurrentSegment;
+ ui32_t m_BytesPerEditUnit;
+ Rational m_EditRate;
+ ui32_t m_BodySID;
+ IndexTableSegment::DeltaEntry m_DefaultDeltaEntry;
+
+ ASDCP_NO_COPY_CONSTRUCT(OPAtomIndexFooter);
+ OPAtomIndexFooter();
+
+ public:
+ const Dictionary*& m_Dict;
+ Kumu::fpos_t m_ECOffset;
+ IPrimerLookup* m_Lookup;
+
+ OPAtomIndexFooter(const Dictionary*&);
+ virtual ~OPAtomIndexFooter();
+ virtual Result_t InitFromFile(const Kumu::FileReader& Reader);
+ virtual Result_t InitFromPartitionBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToFile(Kumu::FileWriter& Writer, ui64_t duration);
+ virtual void Dump(FILE* = 0);
+
+ virtual Result_t GetMDObjectByID(const UUID&, InterchangeObject** = 0);
+ virtual Result_t GetMDObjectByType(const byte_t*, InterchangeObject** = 0);
+ virtual Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list<InterchangeObject*>& ObjectList);
+
+ virtual Result_t Lookup(ui32_t frame_num, IndexTableSegment::IndexEntry&) const;
+ virtual void PushIndexEntry(const IndexTableSegment::IndexEntry&);
+ virtual void SetDeltaParams(const IndexTableSegment::DeltaEntry&);
+ virtual void SetIndexParamsCBR(IPrimerLookup* lookup, ui32_t size, const Rational& Rate);
+ virtual void SetIndexParamsVBR(IPrimerLookup* lookup, const Rational& Rate, Kumu::fpos_t offset);
+ };
+
+ //---------------------------------------------------------------------------------
+ //
+
+ //
+ inline std::string to_lower(std::string str) {
+ std::transform(str.begin(), str.end(), str.begin(), ::tolower);
+ return str;
+ }
+
+ // ignore case when searching for audio labels
+ struct ci_comp
+ {
+ inline bool operator()(const std::string& a, const std::string& b) const {
+ return to_lower(a) < to_lower(b);
+ }
+ };
+
+ struct label_traits
+ {
+ const std::string tag_name;
+ const bool requires_prefix;
+ const UL ul;
+
+ label_traits(const std::string& tag_name, const bool requires_prefix, const UL ul) :
+ tag_name(tag_name), requires_prefix(requires_prefix), ul(ul) { }
+ };
+
+ typedef std::map<const std::string, const label_traits, ci_comp> mca_label_map_t;
+
+ bool decode_mca_string(const std::string& s, const mca_label_map_t& labels,
+ const Dictionary*& dict, const std::string& language, InterchangeObject_list_t&, ui32_t&);
+
+ //
+ class ASDCP_MCAConfigParser : public InterchangeObject_list_t
+ {
+ KM_NO_COPY_CONSTRUCT(ASDCP_MCAConfigParser);
+ ASDCP_MCAConfigParser();
+
+ protected:
+ mca_label_map_t m_LabelMap;
+ ui32_t m_ChannelCount;
+ const Dictionary*& m_Dict;
+
+
+ public:
+ ASDCP_MCAConfigParser(const Dictionary*&);
+ bool DecodeString(const std::string& s, const std::string& language = "en-US");
+
+ // Valid only after a successful call to DecodeString
+ ui32_t ChannelCount() const;
+ };
+
+ //
+ class AS02_MCAConfigParser : public ASDCP_MCAConfigParser
+ {
+ KM_NO_COPY_CONSTRUCT(AS02_MCAConfigParser);
+ AS02_MCAConfigParser();
+
+ public:
+ AS02_MCAConfigParser(const Dictionary*&);
+ };
+
+ } // namespace MXF
+} // namespace ASDCP
+
+
+#endif // _MXF_H_
+
+//
+// end MXF.h
+//
diff --git a/src/asdcp/MXFTypes.h b/src/asdcp/MXFTypes.h
new file mode 100755
index 0000000..236e4c2
--- /dev/null
+++ b/src/asdcp/MXFTypes.h
@@ -0,0 +1,548 @@
+/*
+Copyright (c) 2005-2015, John Hurst
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*! \file MXFTypes.h
+ \version $Id: MXFTypes.h,v 1.38 2015/10/12 15:30:46 jhurst Exp $
+ \brief MXF objects
+*/
+
+#ifndef _MXFTYPES_H_
+#define _MXFTYPES_H_
+
+#include <asdcp/KLV.h>
+#include <list>
+#include <vector>
+#include <set>
+#include <map>
+#include <wchar.h>
+
+// used with TLVReader::Read*
+//
+// these are used below to manufacture arguments
+#define OBJ_READ_ARGS(s,l) m_Dict->Type(MDD_##s##_##l), &l
+#define OBJ_WRITE_ARGS(s,l) m_Dict->Type(MDD_##s##_##l), &l
+#define OBJ_READ_ARGS_OPT(s,l) m_Dict->Type(MDD_##s##_##l), &l.get()
+#define OBJ_WRITE_ARGS_OPT(s,l) m_Dict->Type(MDD_##s##_##l), &l.get()
+#define OBJ_TYPE_ARGS(t) m_Dict->Type(MDD_##t).ul
+
+
+namespace ASDCP
+{
+ namespace MXF
+ {
+ typedef std::pair<ui32_t, ui32_t> ItemInfo;
+ typedef std::map<TagValue, ItemInfo> TagMap;
+
+ //
+ class TLVReader : public Kumu::MemIOReader
+ {
+
+ TagMap m_ElementMap;
+ IPrimerLookup* m_Lookup;
+
+ TLVReader();
+ ASDCP_NO_COPY_CONSTRUCT(TLVReader);
+ bool FindTL(const MDDEntry&);
+
+ public:
+ TLVReader(const byte_t* p, ui32_t c, IPrimerLookup* = 0);
+ Result_t ReadObject(const MDDEntry&, Kumu::IArchive*);
+ Result_t ReadUi8(const MDDEntry&, ui8_t*);
+ Result_t ReadUi16(const MDDEntry&, ui16_t*);
+ Result_t ReadUi32(const MDDEntry&, ui32_t*);
+ Result_t ReadUi64(const MDDEntry&, ui64_t*);
+ };
+
+ //
+ class TLVWriter : public Kumu::MemIOWriter
+ {
+
+ TagMap m_ElementMap;
+ IPrimerLookup* m_Lookup;
+
+ TLVWriter();
+ ASDCP_NO_COPY_CONSTRUCT(TLVWriter);
+ Result_t WriteTag(const MDDEntry&);
+
+ public:
+ TLVWriter(byte_t* p, ui32_t c, IPrimerLookup* = 0);
+ Result_t WriteObject(const MDDEntry&, Kumu::IArchive*);
+ Result_t WriteUi8(const MDDEntry&, ui8_t*);
+ Result_t WriteUi16(const MDDEntry&, ui16_t*);
+ Result_t WriteUi32(const MDDEntry&, ui32_t*);
+ Result_t WriteUi64(const MDDEntry&, ui64_t*);
+ };
+
+ //
+ template <class ContainerType>
+ class FixedSizeItemCollection : public ContainerType, public Kumu::IArchive
+ {
+ public:
+ FixedSizeItemCollection() {}
+ virtual ~FixedSizeItemCollection() {}
+
+ ui32_t ItemSize() const {
+ typename ContainerType::value_type tmp_item;
+ return tmp_item.ArchiveLength();
+ }
+
+ bool HasValue() const { return ! this->empty(); }
+
+ ui32_t ArchiveLength() const {
+ return ( sizeof(ui32_t) * 2 ) + ( this->size() * this->ItemSize() );
+ }
+
+ bool Archive(Kumu::MemIOWriter* Writer) const {
+ if ( ! Writer->WriteUi32BE(this->size()) ) return false;
+ if ( ! Writer->WriteUi32BE(this->ItemSize()) ) return false;
+ if ( this->empty() ) return true;
+
+ typename ContainerType::const_iterator i;
+ bool result = true;
+ for ( i = this->begin(); i != this->end() && result; ++i )
+ {
+ result = i->Archive(Writer);
+ }
+
+ return result;
+ }
+
+ //
+ bool Unarchive(Kumu::MemIOReader* Reader) {
+ ui32_t item_count, item_size;
+ if ( ! Reader->ReadUi32BE(&item_count) ) return false;
+ if ( ! Reader->ReadUi32BE(&item_size) ) return false;
+
+ if ( item_count > 0 )
+ {
+ if ( this->ItemSize() != item_size ) return false;
+ }
+
+ bool result = true;
+ for ( ui32_t i = 0; i < item_count && result; ++i )
+ {
+ typename ContainerType::value_type tmp_item;
+ result = tmp_item.Unarchive(Reader);
+
+ if ( result )
+ {
+ this->push_back(tmp_item);
+ }
+ }
+
+ return result;
+ }
+
+ void Dump(FILE* stream = 0, ui32_t = 0) {
+ char identbuf[IdentBufferLen];
+
+ if ( stream == 0 )
+ {
+ stream = stderr;
+ }
+
+ typename ContainerType::const_iterator i;
+ for ( i = this->begin(); i != this->end(); ++i )
+ {
+ fprintf(stream, " %s\n", (*i).EncodeString(identbuf, IdentBufferLen));
+ }
+ }
+ };
+
+
+ template <class item_type>
+ class PushSet : public std::set<item_type>
+ {
+ public:
+ PushSet() {}
+ virtual ~PushSet() {}
+ void push_back(const item_type& item) { this->insert(item); }
+ };
+
+ template <class ItemType>
+ class Batch : public FixedSizeItemCollection<PushSet<ItemType> >
+ {
+ public:
+ Batch() {}
+ virtual ~Batch() {}
+ };
+
+ template <class ItemType>
+ class Array : public FixedSizeItemCollection<std::vector<ItemType> >
+ {
+ public:
+ Array() {}
+ virtual ~Array() {}
+ };
+
+ //
+ template <class T>
+ class SimpleArray : public std::list<T>, public Kumu::IArchive
+ {
+ public:
+ SimpleArray() {}
+ virtual ~SimpleArray() {}
+
+ //
+ bool Unarchive(Kumu::MemIOReader* Reader)
+ {
+ bool result = true;
+
+ while ( Reader->Remainder() > 0 && result )
+ {
+ T Tmp;
+ result = Tmp.Unarchive(Reader);
+
+ if ( result )
+ {
+ this->push_back(Tmp);
+ }
+ }
+
+ return result;
+ }
+
+ inline bool HasValue() const { return ! this->empty(); }
+
+ ui32_t ArchiveLength() const {
+ ui32_t arch_size = 0;
+
+ typename std::list<T>::const_iterator l_i = this->begin();
+
+ for ( ; l_i != this->end(); l_i++ )
+ arch_size += l_i->ArchiveLength();
+
+ return arch_size;
+ }
+
+ //
+ bool Archive(Kumu::MemIOWriter* Writer) const {
+ bool result = true;
+ typename std::list<T>::const_iterator l_i = this->begin();
+
+ for ( ; l_i != this->end() && result; l_i++ )
+ result = (*l_i).Archive(Writer);
+
+ return result;
+ }
+
+ //
+ void Dump(FILE* stream = 0, ui32_t = 0)
+ {
+ char identbuf[IdentBufferLen];
+
+ if ( stream == 0 )
+ stream = stderr;
+
+ typename std::list<T>::iterator i = this->begin();
+ for ( ; i != this->end(); i++ )
+ fprintf(stream, " %s\n", (*i).EncodeString(identbuf, IdentBufferLen));
+ }
+ };
+
+ //
+ class ISO8String : public std::string, public Kumu::IArchive
+ {
+ public:
+ ISO8String() {}
+ ISO8String(const char*);
+ ISO8String(const std::string&);
+ ~ISO8String() {}
+
+ const ISO8String& operator=(const char*);
+ const ISO8String& operator=(const std::string&);
+
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ inline virtual bool HasValue() const { return ! empty(); }
+ inline virtual ui32_t ArchiveLength() const { return sizeof(ui32_t) + size(); }
+ virtual bool Unarchive(Kumu::MemIOReader* Reader);
+ virtual bool Archive(Kumu::MemIOWriter* Writer) const;
+ };
+
+ //
+ class UTF16String : public std::string, public Kumu::IArchive
+ {
+ public:
+ UTF16String() {}
+ UTF16String(const char*);
+ UTF16String(const std::string&);
+ ~UTF16String() {}
+
+ const UTF16String& operator=(const char*);
+ const UTF16String& operator=(const std::string&);
+
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ inline virtual bool HasValue() const { return ! empty(); }
+ inline virtual ui32_t ArchiveLength() const { return sizeof(ui32_t) + size(); }
+ virtual bool Unarchive(Kumu::MemIOReader* Reader);
+ virtual bool Archive(Kumu::MemIOWriter* Writer) const;
+ };
+
+ //
+ class Rational : public ASDCP::Rational, public Kumu::IArchive
+ {
+ public:
+ Rational() {}
+ ~Rational() {}
+
+ Rational(const Rational& rhs) : ASDCP::Rational(), IArchive() {
+ Numerator = rhs.Numerator;
+ Denominator = rhs.Denominator;
+ }
+
+ const Rational& operator=(const Rational& rhs) {
+ Numerator = rhs.Numerator;
+ Denominator = rhs.Denominator;
+ return *this;
+ }
+
+ Rational(const ASDCP::Rational& rhs) {
+ Numerator = rhs.Numerator;
+ Denominator = rhs.Denominator;
+ }
+
+ const Rational& operator=(const ASDCP::Rational& rhs) {
+ Numerator = rhs.Numerator;
+ Denominator = rhs.Denominator;
+ return *this;
+ }
+
+ //
+ inline const char* EncodeString(char* str_buf, ui32_t buf_len) const {
+ snprintf(str_buf, buf_len, "%d/%d", Numerator, Denominator);
+ return str_buf;
+ }
+
+ inline virtual bool Unarchive(Kumu::MemIOReader* Reader) {
+ if ( ! Reader->ReadUi32BE((ui32_t*)&Numerator) ) return false;
+ if ( ! Reader->ReadUi32BE((ui32_t*)&Denominator) ) return false;
+ return true;
+ }
+
+ inline virtual bool HasValue() const { return true; }
+ inline virtual ui32_t ArchiveLength() const { return sizeof(ui32_t)*2; }
+
+ inline virtual bool Archive(Kumu::MemIOWriter* Writer) const {
+ if ( ! Writer->WriteUi32BE((ui32_t)Numerator) ) return false;
+ if ( ! Writer->WriteUi32BE((ui32_t)Denominator) ) return false;
+ return true;
+ }
+ };
+
+ //
+ class VersionType : public Kumu::IArchive
+ {
+ public:
+ enum Release_t { RL_UNKNOWN, RL_RELEASE, RL_DEVELOPMENT, RL_PATCHED, RL_BETA, RL_PRIVATE, RL_MAX };
+ ui16_t Major;
+ ui16_t Minor;
+ ui16_t Patch;
+ ui16_t Build;
+ Release_t Release;
+
+ VersionType() : Major(0), Minor(0), Patch(0), Build(0), Release(RL_UNKNOWN) {}
+ VersionType(const VersionType& rhs) { Copy(rhs); }
+ virtual ~VersionType() {}
+
+ const VersionType& operator=(const VersionType& rhs) { Copy(rhs); return *this; }
+ void Copy(const VersionType& rhs) {
+ Major = rhs.Major;
+ Minor = rhs.Minor;
+ Patch = rhs.Patch;
+ Build = rhs.Build;
+ Release = rhs.Release;
+ }
+
+ void Dump(FILE* = 0);
+
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const {
+ snprintf(str_buf, buf_len, "%hu.%hu.%hu.%hur%hu", Major, Minor, Patch, Build, ui16_t(Release));
+ return str_buf;
+ }
+
+ virtual bool Unarchive(Kumu::MemIOReader* Reader) {
+ if ( ! Reader->ReadUi16BE(&Major) ) return false;
+ if ( ! Reader->ReadUi16BE(&Minor) ) return false;
+ if ( ! Reader->ReadUi16BE(&Patch) ) return false;
+ if ( ! Reader->ReadUi16BE(&Build) ) return false;
+ ui16_t tmp_release;
+ if ( ! Reader->ReadUi16BE(&tmp_release) ) return false;
+ Release = (Release_t)tmp_release;
+ return true;
+ }
+
+ inline virtual bool HasValue() const { return true; }
+ inline virtual ui32_t ArchiveLength() const { return sizeof(ui16_t)*5; }
+
+ virtual bool Archive(Kumu::MemIOWriter* Writer) const {
+ if ( ! Writer->WriteUi16BE(Major) ) return false;
+ if ( ! Writer->WriteUi16BE(Minor) ) return false;
+ if ( ! Writer->WriteUi16BE(Patch) ) return false;
+ if ( ! Writer->WriteUi16BE(Build) ) return false;
+ if ( ! Writer->WriteUi16BE((ui16_t)(Release & 0x0000ffffL)) ) return false;
+ return true;
+ }
+ };
+
+ /*
+ The RGBALayout type shall be a fixed-size 8 element sequence with a total length
+ of 16 bytes, where each element shall consist of the RGBAComponent type with the
+ following fields:
+
+ Code (UInt8): Enumerated value specifying component (i.e., component identifier).
+ "0" is the layout terminator.
+
+ Depth (UInt8): Integer specifying the number of bits occupied (see also G.2.26)
+ 1->32 indicates integer depth
+ 253 = HALF (floating point 16-bit value)
+ 254 = IEEE floating point 32-bit value
+ 255 = IEEE floating point 64-bit value
+ 0 = RGBALayout terminator
+
+ A Fill component indicates unused bits. After the components have been specified,
+ the remaining Code and Size fields shall be set to zero (0).
+
+ For each component in the Pixel, one of the following Codes or the terminator
+ shall be specified (explained below):
+
+ Code ASCII
+
+ */
+ struct RGBALayoutTableEntry
+ {
+ byte_t code;
+ char symbol;
+ const char* label;
+ };
+
+ struct RGBALayoutTableEntry const RGBALayoutTable[] = {
+ { 0x52, 'R', "Red component" },
+ { 0x47, 'G', "Green component" },
+ { 0x42, 'B', "Blue component" },
+ { 0x41, 'A', "Alpha component" },
+ { 0x72, 'r', "Red component (LSBs)" },
+ { 0x67, 'g', "Green component (LSBs)" },
+ { 0x62, 'b', "Blue component (LSBs)" },
+ { 0x61, 'a', "Alpha component (LSBs)" },
+ { 0x46, 'F', "Fill component" },
+ { 0x50, 'P', "Palette code" },
+ { 0x55, 'U', "Color Difference Sample (e.g. U, Cb, I etc.)" },
+ { 0x56, 'V', "Color Difference Sample (e.g. V, Cr, Q etc.)" },
+ { 0x57, 'W', "Composite Video" },
+ { 0x58, 'X', "Non co-sited luma component" },
+ { 0x59, 'Y', "Luma component" },
+ { 0x5a, 'Z', "Depth component (SMPTE ST 268 compatible)" },
+ { 0x75, 'u', "Color Difference Sample (e.g. U, Cb, I etc.) (LSBs)" },
+ { 0x76, 'v', "Color Difference Sample (e.g. V, Cr, Q etc.) (LSBs)" },
+ { 0x77, 'w', "Composite Video (LSBs)" },
+ { 0x78, 'x', "Non co-sited luma component (LSBs)" },
+ { 0x79, 'y', "Luma component (LSBs)" },
+ { 0x7a, 'z', "Depth component (LSBs) (SMPTE ST 268 compatible)" },
+ { 0xd8, 'X', "The DCDM X color component (see SMPTE ST 428-1 X')" },
+ { 0xd9, 'Y', "The DCDM Y color component (see SMPTE ST 428-1 Y')" },
+ { 0xda, 'Z', "The DCDM Z color component (see SMPTE ST 428-1 Z')" },
+ { 0x00, '_', "Terminator" }
+ };
+
+
+ size_t const RGBAValueLength = 16;
+
+ byte_t const RGBAValue_RGB_10[RGBAValueLength] = { 'R', 10, 'G', 10, 'B', 10, 0, 0 };
+ byte_t const RGBAValue_RGB_8[RGBAValueLength] = { 'R', 8, 'G', 8, 'B', 8, 0, 0 };
+ byte_t const RGBAValue_YUV_10[RGBAValueLength] = { 'Y', 10, 'U', 10, 'V', 10, 0, 0 };
+ byte_t const RGBAValue_YUV_8[RGBAValueLength] = { 'Y', 8, 'U', 8, 'V', 8, 0, 0 };
+ byte_t const RGBAValue_DCDM[RGBAValueLength] = { 0xd8, 10, 0xd9, 10, 0xda, 10, 0, 0 };
+
+
+ class RGBALayout : public Kumu::IArchive
+ {
+ byte_t m_value[RGBAValueLength];
+
+ public:
+ RGBALayout();
+ RGBALayout(const byte_t* value);
+ ~RGBALayout();
+
+ RGBALayout(const RGBALayout& rhs) { Set(rhs.m_value); }
+ const RGBALayout& operator=(const RGBALayout& rhs) { Set(rhs.m_value); return *this; }
+
+ void Set(const byte_t* value) {
+ memcpy(m_value, value, RGBAValueLength);
+ }
+
+ const char* EncodeString(char* buf, ui32_t buf_len) const;
+
+ bool HasValue() const { return true; }
+ ui32_t ArchiveLength() const { return RGBAValueLength; }
+
+ bool Archive(Kumu::MemIOWriter* Writer) const {
+ return Writer->WriteRaw(m_value, RGBAValueLength);
+ }
+
+ bool Unarchive(Kumu::MemIOReader* Reader) {
+ if ( Reader->Remainder() < RGBAValueLength )
+ {
+ return false;
+ }
+
+ memcpy(m_value, Reader->CurrentData(), RGBAValueLength);
+ Reader->SkipOffset(RGBAValueLength);
+ return true;
+ }
+ };
+
+
+ //
+ class Raw : public Kumu::ByteString
+ {
+ public:
+ Raw();
+ Raw(const Raw& rhs) : Kumu::ByteString() { Copy(rhs); }
+ virtual ~Raw();
+
+ const Raw& operator=(const Raw& rhs) { Copy(rhs); return *this; }
+ void Copy(const Raw& rhs) {
+ if ( KM_SUCCESS(Capacity(rhs.Length())) )
+ {
+ Set(rhs);
+ }
+ }
+
+ //
+ virtual bool Unarchive(Kumu::MemIOReader* Reader);
+ virtual bool Archive(Kumu::MemIOWriter* Writer) const;
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const;
+ };
+
+ } // namespace MXF
+} // namespace ASDCP
+
+
+#endif //_MXFTYPES_H_
+
+//
+// end MXFTypes.h
+//
diff --git a/src/asdcp/Metadata.h b/src/asdcp/Metadata.h
new file mode 100755
index 0000000..3faa406
--- /dev/null
+++ b/src/asdcp/Metadata.h
@@ -0,0 +1,1043 @@
+/*
+Copyright (c) 2005-2015, John Hurst
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*! \file Metadata.h
+ \version $Id: Metadata.h,v 1.39 2015/10/10 20:26:29 jhurst Exp $
+ \brief MXF metadata objects
+*/
+
+#ifndef _Metadata_H_
+#define _Metadata_H_
+
+#include "MXF.h"
+
+namespace ASDCP
+{
+ namespace MXF
+ {
+ void Metadata_InitTypes(const Dictionary*& Dict);
+
+ //
+
+ //
+ class Identification : public InterchangeObject
+ {
+ Identification();
+
+ public:
+ const Dictionary*& m_Dict;
+ UUID ThisGenerationUID;
+ UTF16String CompanyName;
+ UTF16String ProductName;
+ VersionType ProductVersion;
+ UTF16String VersionString;
+ UUID ProductUID;
+ Kumu::Timestamp ModificationDate;
+ VersionType ToolkitVersion;
+ optional_property<UTF16String > Platform;
+
+ Identification(const Dictionary*& d);
+ Identification(const Identification& rhs);
+ virtual ~Identification() {}
+
+ const Identification& operator=(const Identification& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const Identification& rhs);
+ virtual const char* HasName() { return "Identification"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class ContentStorage : public InterchangeObject
+ {
+ ContentStorage();
+
+ public:
+ const Dictionary*& m_Dict;
+ Batch<UUID> Packages;
+ Batch<UUID> EssenceContainerData;
+
+ ContentStorage(const Dictionary*& d);
+ ContentStorage(const ContentStorage& rhs);
+ virtual ~ContentStorage() {}
+
+ const ContentStorage& operator=(const ContentStorage& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const ContentStorage& rhs);
+ virtual const char* HasName() { return "ContentStorage"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class EssenceContainerData : public InterchangeObject
+ {
+ EssenceContainerData();
+
+ public:
+ const Dictionary*& m_Dict;
+ UMID LinkedPackageUID;
+ optional_property<ui32_t > IndexSID;
+ ui32_t BodySID;
+
+ EssenceContainerData(const Dictionary*& d);
+ EssenceContainerData(const EssenceContainerData& rhs);
+ virtual ~EssenceContainerData() {}
+
+ const EssenceContainerData& operator=(const EssenceContainerData& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const EssenceContainerData& rhs);
+ virtual const char* HasName() { return "EssenceContainerData"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class GenericPackage : public InterchangeObject
+ {
+ GenericPackage();
+
+ public:
+ const Dictionary*& m_Dict;
+ UMID PackageUID;
+ optional_property<UTF16String > Name;
+ Kumu::Timestamp PackageCreationDate;
+ Kumu::Timestamp PackageModifiedDate;
+ Array<UUID> Tracks;
+
+ GenericPackage(const Dictionary*& d);
+ GenericPackage(const GenericPackage& rhs);
+ virtual ~GenericPackage() {}
+
+ const GenericPackage& operator=(const GenericPackage& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const GenericPackage& rhs);
+ virtual const char* HasName() { return "GenericPackage"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ };
+
+ //
+ class MaterialPackage : public GenericPackage
+ {
+ MaterialPackage();
+
+ public:
+ const Dictionary*& m_Dict;
+ optional_property<UUID > PackageMarker;
+
+ MaterialPackage(const Dictionary*& d);
+ MaterialPackage(const MaterialPackage& rhs);
+ virtual ~MaterialPackage() {}
+
+ const MaterialPackage& operator=(const MaterialPackage& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const MaterialPackage& rhs);
+ virtual const char* HasName() { return "MaterialPackage"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class SourcePackage : public GenericPackage
+ {
+ SourcePackage();
+
+ public:
+ const Dictionary*& m_Dict;
+ UUID Descriptor;
+
+ SourcePackage(const Dictionary*& d);
+ SourcePackage(const SourcePackage& rhs);
+ virtual ~SourcePackage() {}
+
+ const SourcePackage& operator=(const SourcePackage& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const SourcePackage& rhs);
+ virtual const char* HasName() { return "SourcePackage"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class GenericTrack : public InterchangeObject
+ {
+ GenericTrack();
+
+ public:
+ const Dictionary*& m_Dict;
+ ui32_t TrackID;
+ ui32_t TrackNumber;
+ optional_property<UTF16String > TrackName;
+ optional_property<UUID > Sequence;
+
+ GenericTrack(const Dictionary*& d);
+ GenericTrack(const GenericTrack& rhs);
+ virtual ~GenericTrack() {}
+
+ const GenericTrack& operator=(const GenericTrack& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const GenericTrack& rhs);
+ virtual const char* HasName() { return "GenericTrack"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ };
+
+ //
+ class StaticTrack : public GenericTrack
+ {
+ StaticTrack();
+
+ public:
+ const Dictionary*& m_Dict;
+
+ StaticTrack(const Dictionary*& d);
+ StaticTrack(const StaticTrack& rhs);
+ virtual ~StaticTrack() {}
+
+ const StaticTrack& operator=(const StaticTrack& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const StaticTrack& rhs);
+ virtual const char* HasName() { return "StaticTrack"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class Track : public GenericTrack
+ {
+ Track();
+
+ public:
+ const Dictionary*& m_Dict;
+ Rational EditRate;
+ ui64_t Origin;
+
+ Track(const Dictionary*& d);
+ Track(const Track& rhs);
+ virtual ~Track() {}
+
+ const Track& operator=(const Track& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const Track& rhs);
+ virtual const char* HasName() { return "Track"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class StructuralComponent : public InterchangeObject
+ {
+ StructuralComponent();
+
+ public:
+ const Dictionary*& m_Dict;
+ UL DataDefinition;
+ optional_property<ui64_t > Duration;
+
+ StructuralComponent(const Dictionary*& d);
+ StructuralComponent(const StructuralComponent& rhs);
+ virtual ~StructuralComponent() {}
+
+ const StructuralComponent& operator=(const StructuralComponent& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const StructuralComponent& rhs);
+ virtual const char* HasName() { return "StructuralComponent"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ };
+
+ //
+ class Sequence : public StructuralComponent
+ {
+ Sequence();
+
+ public:
+ const Dictionary*& m_Dict;
+ Array<UUID> StructuralComponents;
+
+ Sequence(const Dictionary*& d);
+ Sequence(const Sequence& rhs);
+ virtual ~Sequence() {}
+
+ const Sequence& operator=(const Sequence& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const Sequence& rhs);
+ virtual const char* HasName() { return "Sequence"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class SourceClip : public StructuralComponent
+ {
+ SourceClip();
+
+ public:
+ const Dictionary*& m_Dict;
+ ui64_t StartPosition;
+ UMID SourcePackageID;
+ ui32_t SourceTrackID;
+
+ SourceClip(const Dictionary*& d);
+ SourceClip(const SourceClip& rhs);
+ virtual ~SourceClip() {}
+
+ const SourceClip& operator=(const SourceClip& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const SourceClip& rhs);
+ virtual const char* HasName() { return "SourceClip"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class TimecodeComponent : public StructuralComponent
+ {
+ TimecodeComponent();
+
+ public:
+ const Dictionary*& m_Dict;
+ ui16_t RoundedTimecodeBase;
+ ui64_t StartTimecode;
+ ui8_t DropFrame;
+
+ TimecodeComponent(const Dictionary*& d);
+ TimecodeComponent(const TimecodeComponent& rhs);
+ virtual ~TimecodeComponent() {}
+
+ const TimecodeComponent& operator=(const TimecodeComponent& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const TimecodeComponent& rhs);
+ virtual const char* HasName() { return "TimecodeComponent"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class GenericDescriptor : public InterchangeObject
+ {
+ GenericDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ Array<UUID> Locators;
+ Array<UUID> SubDescriptors;
+
+ GenericDescriptor(const Dictionary*& d);
+ GenericDescriptor(const GenericDescriptor& rhs);
+ virtual ~GenericDescriptor() {}
+
+ const GenericDescriptor& operator=(const GenericDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const GenericDescriptor& rhs);
+ virtual const char* HasName() { return "GenericDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ };
+
+ //
+ class FileDescriptor : public GenericDescriptor
+ {
+ FileDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ optional_property<ui32_t > LinkedTrackID;
+ Rational SampleRate;
+ optional_property<ui64_t > ContainerDuration;
+ UL EssenceContainer;
+ optional_property<UL > Codec;
+
+ FileDescriptor(const Dictionary*& d);
+ FileDescriptor(const FileDescriptor& rhs);
+ virtual ~FileDescriptor() {}
+
+ const FileDescriptor& operator=(const FileDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const FileDescriptor& rhs);
+ virtual const char* HasName() { return "FileDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class GenericSoundEssenceDescriptor : public FileDescriptor
+ {
+ GenericSoundEssenceDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ Rational AudioSamplingRate;
+ ui8_t Locked;
+ optional_property<ui8_t > AudioRefLevel;
+ optional_property<ui8_t > ElectroSpatialFormulation;
+ ui32_t ChannelCount;
+ ui32_t QuantizationBits;
+ optional_property<ui8_t > DialNorm;
+ UL SoundEssenceCoding;
+
+ GenericSoundEssenceDescriptor(const Dictionary*& d);
+ GenericSoundEssenceDescriptor(const GenericSoundEssenceDescriptor& rhs);
+ virtual ~GenericSoundEssenceDescriptor() {}
+
+ const GenericSoundEssenceDescriptor& operator=(const GenericSoundEssenceDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const GenericSoundEssenceDescriptor& rhs);
+ virtual const char* HasName() { return "GenericSoundEssenceDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class WaveAudioDescriptor : public GenericSoundEssenceDescriptor
+ {
+ WaveAudioDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ ui16_t BlockAlign;
+ optional_property<ui8_t > SequenceOffset;
+ ui32_t AvgBps;
+ optional_property<UL > ChannelAssignment;
+ optional_property<Rational > ReferenceImageEditRate;
+ optional_property<ui8_t > ReferenceAudioAlignmentLevel;
+
+ WaveAudioDescriptor(const Dictionary*& d);
+ WaveAudioDescriptor(const WaveAudioDescriptor& rhs);
+ virtual ~WaveAudioDescriptor() {}
+
+ const WaveAudioDescriptor& operator=(const WaveAudioDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const WaveAudioDescriptor& rhs);
+ virtual const char* HasName() { return "WaveAudioDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class GenericPictureEssenceDescriptor : public FileDescriptor
+ {
+ GenericPictureEssenceDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ optional_property<ui8_t > SignalStandard;
+ ui8_t FrameLayout;
+ ui32_t StoredWidth;
+ ui32_t StoredHeight;
+ optional_property<ui32_t > StoredF2Offset;
+ optional_property<ui32_t > SampledWidth;
+ optional_property<ui32_t > SampledHeight;
+ optional_property<ui32_t > SampledXOffset;
+ optional_property<ui32_t > SampledYOffset;
+ optional_property<ui32_t > DisplayHeight;
+ optional_property<ui32_t > DisplayWidth;
+ optional_property<ui32_t > DisplayXOffset;
+ optional_property<ui32_t > DisplayYOffset;
+ optional_property<ui32_t > DisplayF2Offset;
+ Rational AspectRatio;
+ optional_property<ui8_t > ActiveFormatDescriptor;
+ optional_property<ui8_t > AlphaTransparency;
+ optional_property<UL > TransferCharacteristic;
+ optional_property<ui32_t > ImageAlignmentOffset;
+ optional_property<ui32_t > ImageStartOffset;
+ optional_property<ui32_t > ImageEndOffset;
+ optional_property<ui8_t > FieldDominance;
+ UL PictureEssenceCoding;
+ optional_property<UL > CodingEquations;
+ optional_property<UL > ColorPrimaries;
+ optional_property<Batch<UL> > AlternativeCenterCuts;
+ optional_property<ui32_t > ActiveWidth;
+ optional_property<ui32_t > ActiveHeight;
+ optional_property<ui32_t > ActiveXOffset;
+ optional_property<ui32_t > ActiveYOffset;
+
+ GenericPictureEssenceDescriptor(const Dictionary*& d);
+ GenericPictureEssenceDescriptor(const GenericPictureEssenceDescriptor& rhs);
+ virtual ~GenericPictureEssenceDescriptor() {}
+
+ const GenericPictureEssenceDescriptor& operator=(const GenericPictureEssenceDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const GenericPictureEssenceDescriptor& rhs);
+ virtual const char* HasName() { return "GenericPictureEssenceDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class RGBAEssenceDescriptor : public GenericPictureEssenceDescriptor
+ {
+ RGBAEssenceDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ optional_property<ui32_t > ComponentMaxRef;
+ optional_property<ui32_t > ComponentMinRef;
+ optional_property<ui32_t > AlphaMinRef;
+ optional_property<ui32_t > AlphaMaxRef;
+ optional_property<ui8_t > ScanningDirection;
+
+ RGBAEssenceDescriptor(const Dictionary*& d);
+ RGBAEssenceDescriptor(const RGBAEssenceDescriptor& rhs);
+ virtual ~RGBAEssenceDescriptor() {}
+
+ const RGBAEssenceDescriptor& operator=(const RGBAEssenceDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const RGBAEssenceDescriptor& rhs);
+ virtual const char* HasName() { return "RGBAEssenceDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class JPEG2000PictureSubDescriptor : public InterchangeObject
+ {
+ JPEG2000PictureSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ ui16_t Rsize;
+ ui32_t Xsize;
+ ui32_t Ysize;
+ ui32_t XOsize;
+ ui32_t YOsize;
+ ui32_t XTsize;
+ ui32_t YTsize;
+ ui32_t XTOsize;
+ ui32_t YTOsize;
+ ui16_t Csize;
+ optional_property<Raw > PictureComponentSizing;
+ optional_property<Raw > CodingStyleDefault;
+ optional_property<Raw > QuantizationDefault;
+ optional_property<RGBALayout > J2CLayout;
+
+ JPEG2000PictureSubDescriptor(const Dictionary*& d);
+ JPEG2000PictureSubDescriptor(const JPEG2000PictureSubDescriptor& rhs);
+ virtual ~JPEG2000PictureSubDescriptor() {}
+
+ const JPEG2000PictureSubDescriptor& operator=(const JPEG2000PictureSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const JPEG2000PictureSubDescriptor& rhs);
+ virtual const char* HasName() { return "JPEG2000PictureSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class CDCIEssenceDescriptor : public GenericPictureEssenceDescriptor
+ {
+ CDCIEssenceDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ ui32_t ComponentDepth;
+ ui32_t HorizontalSubsampling;
+ optional_property<ui32_t > VerticalSubsampling;
+ optional_property<ui8_t > ColorSiting;
+ optional_property<ui8_t > ReversedByteOrder;
+ optional_property<ui16_t > PaddingBits;
+ optional_property<ui32_t > AlphaSampleDepth;
+ optional_property<ui32_t > BlackRefLevel;
+ optional_property<ui32_t > WhiteReflevel;
+ optional_property<ui32_t > ColorRange;
+
+ CDCIEssenceDescriptor(const Dictionary*& d);
+ CDCIEssenceDescriptor(const CDCIEssenceDescriptor& rhs);
+ virtual ~CDCIEssenceDescriptor() {}
+
+ const CDCIEssenceDescriptor& operator=(const CDCIEssenceDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const CDCIEssenceDescriptor& rhs);
+ virtual const char* HasName() { return "CDCIEssenceDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class MPEG2VideoDescriptor : public CDCIEssenceDescriptor
+ {
+ MPEG2VideoDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ optional_property<ui8_t > SingleSequence;
+ optional_property<ui8_t > ConstantBFrames;
+ optional_property<ui8_t > CodedContentType;
+ optional_property<ui8_t > LowDelay;
+ optional_property<ui8_t > ClosedGOP;
+ optional_property<ui8_t > IdenticalGOP;
+ optional_property<ui8_t > MaxGOP;
+ optional_property<ui8_t > BPictureCount;
+ optional_property<ui32_t > BitRate;
+ optional_property<ui8_t > ProfileAndLevel;
+
+ MPEG2VideoDescriptor(const Dictionary*& d);
+ MPEG2VideoDescriptor(const MPEG2VideoDescriptor& rhs);
+ virtual ~MPEG2VideoDescriptor() {}
+
+ const MPEG2VideoDescriptor& operator=(const MPEG2VideoDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const MPEG2VideoDescriptor& rhs);
+ virtual const char* HasName() { return "MPEG2VideoDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class DMSegment : public InterchangeObject
+ {
+ DMSegment();
+
+ public:
+ const Dictionary*& m_Dict;
+ UL DataDefinition;
+ ui64_t EventStartPosition;
+ ui64_t Duration;
+ UTF16String EventComment;
+ UUID DMFramework;
+
+ DMSegment(const Dictionary*& d);
+ DMSegment(const DMSegment& rhs);
+ virtual ~DMSegment() {}
+
+ const DMSegment& operator=(const DMSegment& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const DMSegment& rhs);
+ virtual const char* HasName() { return "DMSegment"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class CryptographicFramework : public InterchangeObject
+ {
+ CryptographicFramework();
+
+ public:
+ const Dictionary*& m_Dict;
+ UUID ContextSR;
+
+ CryptographicFramework(const Dictionary*& d);
+ CryptographicFramework(const CryptographicFramework& rhs);
+ virtual ~CryptographicFramework() {}
+
+ const CryptographicFramework& operator=(const CryptographicFramework& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const CryptographicFramework& rhs);
+ virtual const char* HasName() { return "CryptographicFramework"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class CryptographicContext : public InterchangeObject
+ {
+ CryptographicContext();
+
+ public:
+ const Dictionary*& m_Dict;
+ UUID ContextID;
+ UL SourceEssenceContainer;
+ UL CipherAlgorithm;
+ UL MICAlgorithm;
+ UUID CryptographicKeyID;
+
+ CryptographicContext(const Dictionary*& d);
+ CryptographicContext(const CryptographicContext& rhs);
+ virtual ~CryptographicContext() {}
+
+ const CryptographicContext& operator=(const CryptographicContext& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const CryptographicContext& rhs);
+ virtual const char* HasName() { return "CryptographicContext"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class GenericDataEssenceDescriptor : public FileDescriptor
+ {
+ GenericDataEssenceDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ UL DataEssenceCoding;
+
+ GenericDataEssenceDescriptor(const Dictionary*& d);
+ GenericDataEssenceDescriptor(const GenericDataEssenceDescriptor& rhs);
+ virtual ~GenericDataEssenceDescriptor() {}
+
+ const GenericDataEssenceDescriptor& operator=(const GenericDataEssenceDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const GenericDataEssenceDescriptor& rhs);
+ virtual const char* HasName() { return "GenericDataEssenceDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class TimedTextDescriptor : public GenericDataEssenceDescriptor
+ {
+ TimedTextDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ UUID ResourceID;
+ UTF16String UCSEncoding;
+ UTF16String NamespaceURI;
+ optional_property<UTF16String > RFC5646LanguageTagList;
+
+ TimedTextDescriptor(const Dictionary*& d);
+ TimedTextDescriptor(const TimedTextDescriptor& rhs);
+ virtual ~TimedTextDescriptor() {}
+
+ const TimedTextDescriptor& operator=(const TimedTextDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const TimedTextDescriptor& rhs);
+ virtual const char* HasName() { return "TimedTextDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class TimedTextResourceSubDescriptor : public InterchangeObject
+ {
+ TimedTextResourceSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ UUID AncillaryResourceID;
+ UTF16String MIMEMediaType;
+ ui32_t EssenceStreamID;
+
+ TimedTextResourceSubDescriptor(const Dictionary*& d);
+ TimedTextResourceSubDescriptor(const TimedTextResourceSubDescriptor& rhs);
+ virtual ~TimedTextResourceSubDescriptor() {}
+
+ const TimedTextResourceSubDescriptor& operator=(const TimedTextResourceSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const TimedTextResourceSubDescriptor& rhs);
+ virtual const char* HasName() { return "TimedTextResourceSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class StereoscopicPictureSubDescriptor : public InterchangeObject
+ {
+ StereoscopicPictureSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+
+ StereoscopicPictureSubDescriptor(const Dictionary*& d);
+ StereoscopicPictureSubDescriptor(const StereoscopicPictureSubDescriptor& rhs);
+ virtual ~StereoscopicPictureSubDescriptor() {}
+
+ const StereoscopicPictureSubDescriptor& operator=(const StereoscopicPictureSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const StereoscopicPictureSubDescriptor& rhs);
+ virtual const char* HasName() { return "StereoscopicPictureSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class ContainerConstraintSubDescriptor : public InterchangeObject
+ {
+ ContainerConstraintSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+
+ ContainerConstraintSubDescriptor(const Dictionary*& d);
+ ContainerConstraintSubDescriptor(const ContainerConstraintSubDescriptor& rhs);
+ virtual ~ContainerConstraintSubDescriptor() {}
+
+ const ContainerConstraintSubDescriptor& operator=(const ContainerConstraintSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const ContainerConstraintSubDescriptor& rhs);
+ virtual const char* HasName() { return "ContainerConstraintSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class NetworkLocator : public InterchangeObject
+ {
+ NetworkLocator();
+
+ public:
+ const Dictionary*& m_Dict;
+ UTF16String URLString;
+
+ NetworkLocator(const Dictionary*& d);
+ NetworkLocator(const NetworkLocator& rhs);
+ virtual ~NetworkLocator() {}
+
+ const NetworkLocator& operator=(const NetworkLocator& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const NetworkLocator& rhs);
+ virtual const char* HasName() { return "NetworkLocator"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class MCALabelSubDescriptor : public InterchangeObject
+ {
+ MCALabelSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ UL MCALabelDictionaryID;
+ UUID MCALinkID;
+ UTF16String MCATagSymbol;
+ optional_property<UTF16String > MCATagName;
+ optional_property<ui32_t > MCAChannelID;
+ optional_property<ISO8String > RFC5646SpokenLanguage;
+
+ MCALabelSubDescriptor(const Dictionary*& d);
+ MCALabelSubDescriptor(const MCALabelSubDescriptor& rhs);
+ virtual ~MCALabelSubDescriptor() {}
+
+ const MCALabelSubDescriptor& operator=(const MCALabelSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const MCALabelSubDescriptor& rhs);
+ virtual const char* HasName() { return "MCALabelSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class AudioChannelLabelSubDescriptor : public MCALabelSubDescriptor
+ {
+ AudioChannelLabelSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ optional_property<UUID > SoundfieldGroupLinkID;
+
+ AudioChannelLabelSubDescriptor(const Dictionary*& d);
+ AudioChannelLabelSubDescriptor(const AudioChannelLabelSubDescriptor& rhs);
+ virtual ~AudioChannelLabelSubDescriptor() {}
+
+ const AudioChannelLabelSubDescriptor& operator=(const AudioChannelLabelSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const AudioChannelLabelSubDescriptor& rhs);
+ virtual const char* HasName() { return "AudioChannelLabelSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class SoundfieldGroupLabelSubDescriptor : public MCALabelSubDescriptor
+ {
+ SoundfieldGroupLabelSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ optional_property<Array<UUID> > GroupOfSoundfieldGroupsLinkID;
+
+ SoundfieldGroupLabelSubDescriptor(const Dictionary*& d);
+ SoundfieldGroupLabelSubDescriptor(const SoundfieldGroupLabelSubDescriptor& rhs);
+ virtual ~SoundfieldGroupLabelSubDescriptor() {}
+
+ const SoundfieldGroupLabelSubDescriptor& operator=(const SoundfieldGroupLabelSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const SoundfieldGroupLabelSubDescriptor& rhs);
+ virtual const char* HasName() { return "SoundfieldGroupLabelSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class GroupOfSoundfieldGroupsLabelSubDescriptor : public MCALabelSubDescriptor
+ {
+ GroupOfSoundfieldGroupsLabelSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+
+ GroupOfSoundfieldGroupsLabelSubDescriptor(const Dictionary*& d);
+ GroupOfSoundfieldGroupsLabelSubDescriptor(const GroupOfSoundfieldGroupsLabelSubDescriptor& rhs);
+ virtual ~GroupOfSoundfieldGroupsLabelSubDescriptor() {}
+
+ const GroupOfSoundfieldGroupsLabelSubDescriptor& operator=(const GroupOfSoundfieldGroupsLabelSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const GroupOfSoundfieldGroupsLabelSubDescriptor& rhs);
+ virtual const char* HasName() { return "GroupOfSoundfieldGroupsLabelSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class DCDataDescriptor : public GenericDataEssenceDescriptor
+ {
+ DCDataDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+
+ DCDataDescriptor(const Dictionary*& d);
+ DCDataDescriptor(const DCDataDescriptor& rhs);
+ virtual ~DCDataDescriptor() {}
+
+ const DCDataDescriptor& operator=(const DCDataDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const DCDataDescriptor& rhs);
+ virtual const char* HasName() { return "DCDataDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class DolbyAtmosSubDescriptor : public InterchangeObject
+ {
+ DolbyAtmosSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ UUID AtmosID;
+ ui32_t FirstFrame;
+ ui16_t MaxChannelCount;
+ ui16_t MaxObjectCount;
+ ui8_t AtmosVersion;
+
+ DolbyAtmosSubDescriptor(const Dictionary*& d);
+ DolbyAtmosSubDescriptor(const DolbyAtmosSubDescriptor& rhs);
+ virtual ~DolbyAtmosSubDescriptor() {}
+
+ const DolbyAtmosSubDescriptor& operator=(const DolbyAtmosSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const DolbyAtmosSubDescriptor& rhs);
+ virtual const char* HasName() { return "DolbyAtmosSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ //
+ class PHDRMetadataTrackSubDescriptor : public InterchangeObject
+ {
+ PHDRMetadataTrackSubDescriptor();
+
+ public:
+ const Dictionary*& m_Dict;
+ UL DataDefinition;
+ ui32_t SourceTrackID;
+ ui32_t SimplePayloadSID;
+
+ PHDRMetadataTrackSubDescriptor(const Dictionary*& d);
+ PHDRMetadataTrackSubDescriptor(const PHDRMetadataTrackSubDescriptor& rhs);
+ virtual ~PHDRMetadataTrackSubDescriptor() {}
+
+ const PHDRMetadataTrackSubDescriptor& operator=(const PHDRMetadataTrackSubDescriptor& rhs) { Copy(rhs); return *this; }
+ virtual void Copy(const PHDRMetadataTrackSubDescriptor& rhs);
+ virtual const char* HasName() { return "PHDRMetadataTrackSubDescriptor"; }
+ virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
+ virtual Result_t WriteToTLVSet(TLVWriter& TLVSet);
+ virtual void Dump(FILE* = 0);
+ virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
+ virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
+ };
+
+ } // namespace MXF
+} // namespace ASDCP
+
+
+#endif // _Metadata_H_
+
+//
+// end Metadata.h
+//