Change History
+2012-01-30 - bug fixes v1.8.45
+ o Corrected UL version segment in "7.1 DS" and "WTF" audio format
+ labels (corresponds with publication of ST 429-2:2011).
+ o Exposed MXF object interface (MXF.h, Metadata.h) via ASDCP MXFReader
+ and MXFWriter classes.
+ o Added UL values from ST 377-4:2012. >>>>NOTE: These are preliminary
+ values, subject to change upon final publication of not only ST 377-4
+ but also the relevant registries. This is a good time to compare them
+ to the standard and complain if you think they are wrong!
+ o Added MCALabelSubDescriptor, AudioChannelLabelSubDescriptor,
+ SoundfieldGroupLabelSubDescriptor, and
+ GroupOfSoundfieldGroupsLabelSubDescriptor (from ST 377-4:2012) to
+ Metadata.h
+
+
2011-11-30 - bug fixes v1.8.44
o Corrected a wrong decryption UL selection when unwrapping MXF.
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-# Copyright (c) 2007-2010 John Hurst. All rights reserved.
+# Copyright (c) 2007-2012 John Hurst. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# For example, if asdcplib version 1.0.0 were modified to accomodate changes
# in file format, and if no changes were made to AS_DCP.h, the new version would be
# 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1.
-
-AC_INIT([asdcplib], [1.8.44b], [asdcplib@cinecert.com])
+AC_INIT([asdcplib], [1.9.44c], [asdcplib@cinecert.com])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/KM_error.h])
/*
-Copyright (c) 2005-2009, John Hurst
+Copyright (c) 2005-2012, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
IndexStartPosition(0), IndexDuration(0), EditUnitByteCount(0),
IndexSID(129), BodySID(1), SliceCount(0), PosTableCount(0)
{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_IndexTableSegment);
}
//
{
}
+//
+void
+ASDCP::MXF::IndexTableSegment::Copy(const IndexTableSegment& rhs)
+{
+ InterchangeObject::Copy(rhs);
+ IndexEditRate = rhs.IndexEditRate;
+ IndexStartPosition = rhs.IndexStartPosition;
+ IndexDuration = rhs.IndexDuration;
+ EditUnitByteCount = rhs.EditUnitByteCount;
+ IndexSID = rhs.IndexSID;
+ BodySID = rhs.BodySID;
+ SliceCount = rhs.SliceCount;
+ PosTableCount = rhs.PosTableCount;
+ DeltaEntryArray = rhs.DeltaEntryArray;
+ IndexEntryArray = rhs.IndexEntryArray;
+}
+
//
ASDCP::Result_t
ASDCP::MXF::IndexTableSegment::InitFromTLVSet(TLVReader& TLVSet)
ASDCP::Result_t
ASDCP::MXF::IndexTableSegment::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_IndexTableSegment));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
ASDCP::MXF::IndexTableSegment::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_IndexTableSegment));
return InterchangeObject::WriteToBuffer(Buffer);
}
//
ASDCP::UL
-ASDCP::KLVPacket::GetUL() {
- return UL(m_KeyStart);
+ASDCP::KLVPacket::GetUL()
+{
+ if ( m_KeyStart != 0 )
+ return UL(m_KeyStart);
+
+ return m_UL;
+}
+
+//
+bool
+ASDCP::KLVPacket::SetUL(const UL& new_ul)
+{
+ if ( m_KeyStart != 0 )
+ return false;
+
+ m_UL = new_ul;
+ return true;
}
//
bool
ASDCP::KLVPacket::HasUL(const byte_t* ul)
{
- if ( m_KeyStart == 0 )
- return false;
+ if ( m_KeyStart != 0 )
+ {
+ return ( memcmp(ul, m_KeyStart, SMPTE_UL_LENGTH) == 0 ) ? true : false;
+ }
- return ( memcmp(ul, m_KeyStart, SMPTE_UL_LENGTH) == 0 ) ? true : false;
+ if ( m_UL.HasValue() )
+ {
+ return UL(ul) == m_UL;
+ }
+
+ return false;
}
//
ASDCP::Result_t
ASDCP::KLVPacket::WriteKLToBuffer(ASDCP::FrameBuffer& Buffer, const UL& label, ui32_t length)
{
+ assert(label.HasValue());
+
if ( Buffer.Size() + kl_length > Buffer.Capacity() )
{
DefaultLogSink().Error("Small write buffer\n");
void
ASDCP::KLVPacket::Dump(FILE* stream, const Dictionary& Dict, bool show_value)
{
+ char buf[64];
+
if ( stream == 0 )
stream = stderr;
{
assert(m_ValueStart);
UL TmpUL(m_KeyStart);
- char buf[64];
fprintf(stream, "%s", TmpUL.EncodeString(buf, 64));
const MDDEntry* Entry = Dict.FindUL(m_KeyStart);
if ( show_value && m_ValueLength < 1000 )
Kumu::hexdump(m_ValueStart, Kumu::xmin(m_ValueLength, (ui32_t)128), stream);
}
+ else if ( m_UL.HasValue() )
+ {
+ fprintf(stream, "%s\n", m_UL.EncodeString(buf, 64));
+ }
else
{
fprintf(stream, "*** Malformed KLV packet ***\n");
ui32_t m_KLLength;
const byte_t* m_ValueStart;
ui32_t m_ValueLength;
+ UL m_UL;
public:
KLVPacket() : m_KeyStart(0), m_KLLength(0), m_ValueStart(0), m_ValueLength(0) {}
}
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);
};
//
-ASDCP::MXF::Primer::Primer(const Dictionary*& d) : m_LocalTag(0xff), m_Dict(d) {}
+ASDCP::MXF::Primer::Primer(const Dictionary*& d) : m_LocalTag(0xff), m_Dict(d) {
+ m_UL = m_Dict->ul(MDD_Primer);
+}
//
ASDCP::MXF::Primer::~Primer() {}
if ( ASDCP_SUCCESS(result) )
{
ui32_t packet_length = MemWRT.Length();
- result = WriteKLToBuffer(Buffer, m_Dict->ul(MDD_Primer), packet_length);
+ result = WriteKLToBuffer(Buffer, packet_length);
if ( ASDCP_SUCCESS(result) )
Buffer.Size(Buffer.Size() + packet_length);
//------------------------------------------------------------------------------------------
//
+//
+ASDCP::MXF::Preface::Preface(const Dictionary*& d) :
+ InterchangeObject(d), m_Dict(d), Version(258), ObjectModelVersion(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->Type(MDD_Preface).ul;
+}
+
+//
+void
+ASDCP::MXF::Preface::Copy(const Preface& rhs)
+{
+ InterchangeObject::Copy(rhs);
+
+ LastModifiedDate = rhs.LastModifiedDate;
+ Version = rhs.Version;
+ ObjectModelVersion = rhs.ObjectModelVersion;
+ PrimaryPackage = rhs.PrimaryPackage;
+ Identifications = rhs.Identifications;
+ ContentStorage = rhs.ContentStorage;
+ OperationalPattern = rhs.OperationalPattern;
+ EssenceContainers = rhs.EssenceContainers;
+ DMSchemes = rhs.DMSchemes;
+}
+
//
ASDCP::Result_t
ASDCP::MXF::Preface::InitFromTLVSet(TLVReader& TLVSet)
ASDCP::Result_t
ASDCP::MXF::Preface::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Preface));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
ASDCP::MXF::Preface::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Preface));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
//
+//
+void
+ASDCP::MXF::InterchangeObject::Copy(const InterchangeObject& rhs)
+{
+ m_UL = rhs.m_UL;
+ InstanceUID = rhs.InstanceUID;
+ GenerationUID = rhs.GenerationUID;
+}
+
//
ASDCP::Result_t
ASDCP::MXF::InterchangeObject::InitFromTLVSet(TLVReader& TLVSet)
ASDCP_TEST_NULL(p);
Result_t result = RESULT_FALSE;
- if ( m_Typeinfo == 0 )
+ if ( m_UL.HasValue() )
{
- result = KLVPacket::InitFromBuffer(p, l);
- }
- else
- {
- result = KLVPacket::InitFromBuffer(p, l, m_Typeinfo->ul);
+ result = KLVPacket::InitFromBuffer(p, l, m_UL);
if ( ASDCP_SUCCESS(result) )
{
result = InitFromTLVSet(MemRDR);
}
}
+ else
+ {
+ result = KLVPacket::InitFromBuffer(p, l);
+ }
return result;
}
ASDCP::Result_t
ASDCP::MXF::InterchangeObject::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- if ( m_Typeinfo == 0 )
+ if ( ! m_UL.HasValue() )
return RESULT_STATE;
TLVWriter MemWRT(Buffer.Data() + kl_length, Buffer.Capacity() - kl_length, m_Lookup);
if ( ASDCP_SUCCESS(result) )
{
ui32_t packet_length = MemWRT.Length();
- result = WriteKLToBuffer(Buffer, m_Typeinfo->ul, packet_length);
+ result = WriteKLToBuffer(Buffer, packet_length);
if ( ASDCP_SUCCESS(result) )
Buffer.Size(Buffer.Size() + packet_length);
{
InterchangeObject();
- protected:
- const MDDEntry* m_Typeinfo;
-
public:
const Dictionary*& m_Dict;
IPrimerLookup* m_Lookup;
UUID InstanceUID;
UUID GenerationUID;
- InterchangeObject(const Dictionary*& d) : m_Typeinfo(0), m_Dict(d), m_Lookup(0) {}
+ 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);
public:
const Dictionary*& m_Dict;
- UUID GenerationUID;
+ //// UUID GenerationUID;
Timestamp LastModifiedDate;
ui16_t Version;
ui32_t ObjectModelVersion;
Batch<UL> EssenceContainers;
Batch<UL> DMSchemes;
- Preface(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), Version(258), ObjectModelVersion(0) {}
+ 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);
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);
endif
# list of programs to be built and installed
-bin_PROGRAMS = asdcp-test j2c-test blackwave klvwalk kmfilegen kmrandgen \
- kmuuidgen wavesplit
+bin_PROGRAMS = \
+ asdcp-wrap asdcp-unwrap asdcp-util asdcp-info asdcp-test \
+ j2c-test blackwave klvwalk wavesplit \
+ kmfilegen kmrandgen kmuuidgen
-# sources for a program
+# sources and linkage for CLI utilities
asdcp_test_SOURCES = asdcp-test.cpp
-
-# list of libraries to link against for a program
asdcp_test_LDADD = libasdcp.la
+
+asdcp_wrap_SOURCES = asdcp-wrap.cpp
+asdcp_wrap_LDADD = libasdcp.la
+
+asdcp_unwrap_SOURCES = asdcp-unwrap.cpp
+asdcp_unwrap_LDADD = libasdcp.la
+
+asdcp_util_SOURCES = asdcp-util.cpp
+asdcp_util_LDADD = libasdcp.la
+
+asdcp_info_SOURCES = asdcp-info.cpp
+asdcp_info_LDADD = libasdcp.la
+
kmfilegen_SOURCES = kmfilegen.cpp
kmfilegen_LDADD = libkumu.la
+
kmrandgen_SOURCES = kmrandgen.cpp
kmrandgen_LDADD = libkumu.la
+
kmuuidgen_SOURCES = kmuuidgen.cpp
kmuuidgen_LDADD = libkumu.la
+
blackwave_SOURCES = blackwave.cpp
blackwave_LDADD = libasdcp.la
+
klvwalk_SOURCES = klvwalk.cpp
klvwalk_LDADD = libasdcp.la
+
wavesplit_SOURCES = wavesplit.cpp
wavesplit_LDADD = libasdcp.la
+
j2c_test_SOURCES = j2c-test.cpp
j2c_test_LDADD = libasdcp.la
# list of programs that need to be compiled for use in test suite
-check_PROGRAMS = asdcp-mem-test path-test S429-5-cgi \
+check_PROGRAMS = asdcp-mem-test path-test \
fips-186-rng-test asdcp-version
if DEV_HEADERS
check_PROGRAMS += tt-xform
# list of libraries to link against for a test program
asdcp_mem_test_SOURCES = asdcp-mem-test.cpp
asdcp_mem_test_LDADD = libasdcp.la
+
path_test_SOURCES = path-test.cpp
path_test_LDADD = libkumu.la
-S429_5_cgi_SOURCES = S429-5-cgi.cpp
-S429_5_cgi_LDADD = libasdcp.la
+
fips_186_rng_test_SOURCES = fips-186-rng-test.cpp
fips_186_rng_test_LDADD = libasdcp.la
+
asdcp_version_SOURCES = asdcp-version.cpp
asdcp_version_LDADD = libkumu.la
+
if DEV_HEADERS
nodist_tt_xform_SOURCES = tt-xform.cpp
tt_xform_LDADD = libasdcp.la
//------------------------------------------------------------------------------------------
// Identification
+//
+
+Identification::Identification(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_Identification);
+}
+
+Identification::Identification(const Identification& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_Identification);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
Identification::InitFromTLVSet(TLVReader& TLVSet)
void
Identification::Copy(const Identification& rhs)
{
+ InterchangeObject::Copy(rhs);
ThisGenerationUID = rhs.ThisGenerationUID;
CompanyName = rhs.CompanyName;
ProductName = rhs.ProductName;
ASDCP::Result_t
Identification::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Identification));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
Identification::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Identification));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// ContentStorage
+//
+
+ContentStorage::ContentStorage(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_ContentStorage);
+}
+
+ContentStorage::ContentStorage(const ContentStorage& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_ContentStorage);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
ContentStorage::InitFromTLVSet(TLVReader& TLVSet)
void
ContentStorage::Copy(const ContentStorage& rhs)
{
+ InterchangeObject::Copy(rhs);
Packages = rhs.Packages;
EssenceContainerData = rhs.EssenceContainerData;
}
ASDCP::Result_t
ContentStorage::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_ContentStorage));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
ContentStorage::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_ContentStorage));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// EssenceContainerData
+//
+
+EssenceContainerData::EssenceContainerData(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), IndexSID(0), BodySID(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_EssenceContainerData);
+}
+
+EssenceContainerData::EssenceContainerData(const EssenceContainerData& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_EssenceContainerData);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
EssenceContainerData::InitFromTLVSet(TLVReader& TLVSet)
void
EssenceContainerData::Copy(const EssenceContainerData& rhs)
{
+ InterchangeObject::Copy(rhs);
LinkedPackageUID = rhs.LinkedPackageUID;
IndexSID = rhs.IndexSID;
BodySID = rhs.BodySID;
ASDCP::Result_t
EssenceContainerData::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_EssenceContainerData));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
EssenceContainerData::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_EssenceContainerData));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// GenericPackage
+//
+GenericPackage::GenericPackage(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
+
+GenericPackage::GenericPackage(const GenericPackage& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
GenericPackage::InitFromTLVSet(TLVReader& TLVSet)
void
GenericPackage::Copy(const GenericPackage& rhs)
{
+ InterchangeObject::Copy(rhs);
PackageUID = rhs.PackageUID;
Name = rhs.Name;
PackageCreationDate = rhs.PackageCreationDate;
//------------------------------------------------------------------------------------------
// MaterialPackage
+//
+
+MaterialPackage::MaterialPackage(const Dictionary*& d) : GenericPackage(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_MaterialPackage);
+}
+
+MaterialPackage::MaterialPackage(const MaterialPackage& rhs) : GenericPackage(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_MaterialPackage);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
MaterialPackage::InitFromTLVSet(TLVReader& TLVSet)
void
MaterialPackage::Copy(const MaterialPackage& rhs)
{
+ GenericPackage::Copy(rhs);
}
//
ASDCP::Result_t
MaterialPackage::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_MaterialPackage));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
MaterialPackage::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_MaterialPackage));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// SourcePackage
+//
+
+SourcePackage::SourcePackage(const Dictionary*& d) : GenericPackage(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_SourcePackage);
+}
+
+SourcePackage::SourcePackage(const SourcePackage& rhs) : GenericPackage(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_SourcePackage);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
SourcePackage::InitFromTLVSet(TLVReader& TLVSet)
void
SourcePackage::Copy(const SourcePackage& rhs)
{
+ GenericPackage::Copy(rhs);
Descriptor = rhs.Descriptor;
}
ASDCP::Result_t
SourcePackage::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_SourcePackage));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
SourcePackage::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_SourcePackage));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// GenericTrack
+//
+GenericTrack::GenericTrack(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), TrackID(0), TrackNumber(0) {}
+
+GenericTrack::GenericTrack(const GenericTrack& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
GenericTrack::InitFromTLVSet(TLVReader& TLVSet)
void
GenericTrack::Copy(const GenericTrack& rhs)
{
+ InterchangeObject::Copy(rhs);
TrackID = rhs.TrackID;
TrackNumber = rhs.TrackNumber;
TrackName = rhs.TrackName;
//------------------------------------------------------------------------------------------
// StaticTrack
+//
+
+StaticTrack::StaticTrack(const Dictionary*& d) : GenericTrack(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_StaticTrack);
+}
+
+StaticTrack::StaticTrack(const StaticTrack& rhs) : GenericTrack(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_StaticTrack);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
StaticTrack::InitFromTLVSet(TLVReader& TLVSet)
void
StaticTrack::Copy(const StaticTrack& rhs)
{
+ GenericTrack::Copy(rhs);
}
//
ASDCP::Result_t
StaticTrack::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_StaticTrack));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
StaticTrack::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_StaticTrack));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// Track
+//
+
+Track::Track(const Dictionary*& d) : GenericTrack(d), m_Dict(d), Origin(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_Track);
+}
+
+Track::Track(const Track& rhs) : GenericTrack(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_Track);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
Track::InitFromTLVSet(TLVReader& TLVSet)
void
Track::Copy(const Track& rhs)
{
+ GenericTrack::Copy(rhs);
EditRate = rhs.EditRate;
Origin = rhs.Origin;
}
ASDCP::Result_t
Track::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Track));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
Track::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Track));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// StructuralComponent
+//
+StructuralComponent::StructuralComponent(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), Duration(0) {}
+
+StructuralComponent::StructuralComponent(const StructuralComponent& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
StructuralComponent::InitFromTLVSet(TLVReader& TLVSet)
void
StructuralComponent::Copy(const StructuralComponent& rhs)
{
+ InterchangeObject::Copy(rhs);
DataDefinition = rhs.DataDefinition;
Duration = rhs.Duration;
}
//------------------------------------------------------------------------------------------
// Sequence
+//
+
+Sequence::Sequence(const Dictionary*& d) : StructuralComponent(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_Sequence);
+}
+
+Sequence::Sequence(const Sequence& rhs) : StructuralComponent(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_Sequence);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
Sequence::InitFromTLVSet(TLVReader& TLVSet)
void
Sequence::Copy(const Sequence& rhs)
{
+ StructuralComponent::Copy(rhs);
StructuralComponents = rhs.StructuralComponents;
}
ASDCP::Result_t
Sequence::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Sequence));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
Sequence::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_Sequence));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// SourceClip
+//
+
+SourceClip::SourceClip(const Dictionary*& d) : StructuralComponent(d), m_Dict(d), StartPosition(0), SourceTrackID(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_SourceClip);
+}
+
+SourceClip::SourceClip(const SourceClip& rhs) : StructuralComponent(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_SourceClip);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
SourceClip::InitFromTLVSet(TLVReader& TLVSet)
void
SourceClip::Copy(const SourceClip& rhs)
{
+ StructuralComponent::Copy(rhs);
StartPosition = rhs.StartPosition;
SourcePackageID = rhs.SourcePackageID;
SourceTrackID = rhs.SourceTrackID;
ASDCP::Result_t
SourceClip::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_SourceClip));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
SourceClip::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_SourceClip));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// TimecodeComponent
+//
+
+TimecodeComponent::TimecodeComponent(const Dictionary*& d) : StructuralComponent(d), m_Dict(d), RoundedTimecodeBase(0), StartTimecode(0), DropFrame(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_TimecodeComponent);
+}
+
+TimecodeComponent::TimecodeComponent(const TimecodeComponent& rhs) : StructuralComponent(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_TimecodeComponent);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
TimecodeComponent::InitFromTLVSet(TLVReader& TLVSet)
void
TimecodeComponent::Copy(const TimecodeComponent& rhs)
{
+ StructuralComponent::Copy(rhs);
RoundedTimecodeBase = rhs.RoundedTimecodeBase;
StartTimecode = rhs.StartTimecode;
DropFrame = rhs.DropFrame;
ASDCP::Result_t
TimecodeComponent::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_TimecodeComponent));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
TimecodeComponent::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_TimecodeComponent));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// GenericDescriptor
+//
+GenericDescriptor::GenericDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
+
+GenericDescriptor::GenericDescriptor(const GenericDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
GenericDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
GenericDescriptor::Copy(const GenericDescriptor& rhs)
{
+ InterchangeObject::Copy(rhs);
Locators = rhs.Locators;
SubDescriptors = rhs.SubDescriptors;
}
//------------------------------------------------------------------------------------------
// FileDescriptor
+//
+
+FileDescriptor::FileDescriptor(const Dictionary*& d) : GenericDescriptor(d), m_Dict(d), LinkedTrackID(0), ContainerDuration(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_FileDescriptor);
+}
+
+FileDescriptor::FileDescriptor(const FileDescriptor& rhs) : GenericDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_FileDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
FileDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
FileDescriptor::Copy(const FileDescriptor& rhs)
{
+ GenericDescriptor::Copy(rhs);
LinkedTrackID = rhs.LinkedTrackID;
SampleRate = rhs.SampleRate;
ContainerDuration = rhs.ContainerDuration;
ASDCP::Result_t
FileDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_FileDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
FileDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_FileDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// GenericSoundEssenceDescriptor
+//
+
+GenericSoundEssenceDescriptor::GenericSoundEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d), Locked(0), AudioRefLevel(0), ChannelCount(0), QuantizationBits(0), DialNorm(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GenericSoundEssenceDescriptor);
+}
+
+GenericSoundEssenceDescriptor::GenericSoundEssenceDescriptor(const GenericSoundEssenceDescriptor& rhs) : FileDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GenericSoundEssenceDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
GenericSoundEssenceDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
GenericSoundEssenceDescriptor::Copy(const GenericSoundEssenceDescriptor& rhs)
{
+ FileDescriptor::Copy(rhs);
AudioSamplingRate = rhs.AudioSamplingRate;
Locked = rhs.Locked;
AudioRefLevel = rhs.AudioRefLevel;
ASDCP::Result_t
GenericSoundEssenceDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GenericSoundEssenceDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
GenericSoundEssenceDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GenericSoundEssenceDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// WaveAudioDescriptor
+//
+
+WaveAudioDescriptor::WaveAudioDescriptor(const Dictionary*& d) : GenericSoundEssenceDescriptor(d), m_Dict(d), BlockAlign(0), SequenceOffset(0), AvgBps(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_WaveAudioDescriptor);
+}
+
+WaveAudioDescriptor::WaveAudioDescriptor(const WaveAudioDescriptor& rhs) : GenericSoundEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_WaveAudioDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
WaveAudioDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
WaveAudioDescriptor::Copy(const WaveAudioDescriptor& rhs)
{
+ GenericSoundEssenceDescriptor::Copy(rhs);
BlockAlign = rhs.BlockAlign;
SequenceOffset = rhs.SequenceOffset;
AvgBps = rhs.AvgBps;
ASDCP::Result_t
WaveAudioDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_WaveAudioDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
WaveAudioDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_WaveAudioDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// GenericPictureEssenceDescriptor
+//
+
+GenericPictureEssenceDescriptor::GenericPictureEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d), FrameLayout(0), StoredWidth(0), StoredHeight(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GenericPictureEssenceDescriptor);
+}
+
+GenericPictureEssenceDescriptor::GenericPictureEssenceDescriptor(const GenericPictureEssenceDescriptor& rhs) : FileDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GenericPictureEssenceDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
GenericPictureEssenceDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
GenericPictureEssenceDescriptor::Copy(const GenericPictureEssenceDescriptor& rhs)
{
+ FileDescriptor::Copy(rhs);
FrameLayout = rhs.FrameLayout;
StoredWidth = rhs.StoredWidth;
StoredHeight = rhs.StoredHeight;
ASDCP::Result_t
GenericPictureEssenceDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GenericPictureEssenceDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
GenericPictureEssenceDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GenericPictureEssenceDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// RGBAEssenceDescriptor
+//
+
+RGBAEssenceDescriptor::RGBAEssenceDescriptor(const Dictionary*& d) : GenericPictureEssenceDescriptor(d), m_Dict(d), ComponentMaxRef(0), ComponentMinRef(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_RGBAEssenceDescriptor);
+}
+
+RGBAEssenceDescriptor::RGBAEssenceDescriptor(const RGBAEssenceDescriptor& rhs) : GenericPictureEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_RGBAEssenceDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
RGBAEssenceDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
RGBAEssenceDescriptor::Copy(const RGBAEssenceDescriptor& rhs)
{
+ GenericPictureEssenceDescriptor::Copy(rhs);
ComponentMaxRef = rhs.ComponentMaxRef;
ComponentMinRef = rhs.ComponentMinRef;
}
ASDCP::Result_t
RGBAEssenceDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_RGBAEssenceDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
RGBAEssenceDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_RGBAEssenceDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// JPEG2000PictureSubDescriptor
+//
+
+JPEG2000PictureSubDescriptor::JPEG2000PictureSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), Rsize(0), Xsize(0), Ysize(0), XOsize(0), YOsize(0), XTsize(0), YTsize(0), XTOsize(0), YTOsize(0), Csize(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_JPEG2000PictureSubDescriptor);
+}
+
+JPEG2000PictureSubDescriptor::JPEG2000PictureSubDescriptor(const JPEG2000PictureSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_JPEG2000PictureSubDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
JPEG2000PictureSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
JPEG2000PictureSubDescriptor::Copy(const JPEG2000PictureSubDescriptor& rhs)
{
+ InterchangeObject::Copy(rhs);
Rsize = rhs.Rsize;
Xsize = rhs.Xsize;
Ysize = rhs.Ysize;
ASDCP::Result_t
JPEG2000PictureSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_JPEG2000PictureSubDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
JPEG2000PictureSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_JPEG2000PictureSubDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// CDCIEssenceDescriptor
+//
+
+CDCIEssenceDescriptor::CDCIEssenceDescriptor(const Dictionary*& d) : GenericPictureEssenceDescriptor(d), m_Dict(d), ComponentDepth(0), HorizontalSubsampling(0), VerticalSubsampling(0), ColorSiting(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_CDCIEssenceDescriptor);
+}
+
+CDCIEssenceDescriptor::CDCIEssenceDescriptor(const CDCIEssenceDescriptor& rhs) : GenericPictureEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_CDCIEssenceDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
CDCIEssenceDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
CDCIEssenceDescriptor::Copy(const CDCIEssenceDescriptor& rhs)
{
+ GenericPictureEssenceDescriptor::Copy(rhs);
ComponentDepth = rhs.ComponentDepth;
HorizontalSubsampling = rhs.HorizontalSubsampling;
VerticalSubsampling = rhs.VerticalSubsampling;
ASDCP::Result_t
CDCIEssenceDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_CDCIEssenceDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
CDCIEssenceDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_CDCIEssenceDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// MPEG2VideoDescriptor
+//
+
+MPEG2VideoDescriptor::MPEG2VideoDescriptor(const Dictionary*& d) : CDCIEssenceDescriptor(d), m_Dict(d), CodedContentType(0), LowDelay(0), BitRate(0), ProfileAndLevel(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_MPEG2VideoDescriptor);
+}
+
+MPEG2VideoDescriptor::MPEG2VideoDescriptor(const MPEG2VideoDescriptor& rhs) : CDCIEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_MPEG2VideoDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
MPEG2VideoDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
MPEG2VideoDescriptor::Copy(const MPEG2VideoDescriptor& rhs)
{
+ CDCIEssenceDescriptor::Copy(rhs);
CodedContentType = rhs.CodedContentType;
LowDelay = rhs.LowDelay;
BitRate = rhs.BitRate;
ASDCP::Result_t
MPEG2VideoDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_MPEG2VideoDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
MPEG2VideoDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_MPEG2VideoDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// DMSegment
+//
+
+DMSegment::DMSegment(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), EventStartPosition(0), Duration(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_DMSegment);
+}
+
+DMSegment::DMSegment(const DMSegment& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_DMSegment);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
DMSegment::InitFromTLVSet(TLVReader& TLVSet)
void
DMSegment::Copy(const DMSegment& rhs)
{
+ InterchangeObject::Copy(rhs);
DataDefinition = rhs.DataDefinition;
EventStartPosition = rhs.EventStartPosition;
Duration = rhs.Duration;
ASDCP::Result_t
DMSegment::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_DMSegment));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
DMSegment::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_DMSegment));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// CryptographicFramework
+//
+
+CryptographicFramework::CryptographicFramework(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_CryptographicFramework);
+}
+
+CryptographicFramework::CryptographicFramework(const CryptographicFramework& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_CryptographicFramework);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
CryptographicFramework::InitFromTLVSet(TLVReader& TLVSet)
void
CryptographicFramework::Copy(const CryptographicFramework& rhs)
{
+ InterchangeObject::Copy(rhs);
ContextSR = rhs.ContextSR;
}
ASDCP::Result_t
CryptographicFramework::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_CryptographicFramework));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
CryptographicFramework::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_CryptographicFramework));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// CryptographicContext
+//
+
+CryptographicContext::CryptographicContext(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_CryptographicContext);
+}
+
+CryptographicContext::CryptographicContext(const CryptographicContext& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_CryptographicContext);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
CryptographicContext::InitFromTLVSet(TLVReader& TLVSet)
void
CryptographicContext::Copy(const CryptographicContext& rhs)
{
+ InterchangeObject::Copy(rhs);
ContextID = rhs.ContextID;
SourceEssenceContainer = rhs.SourceEssenceContainer;
CipherAlgorithm = rhs.CipherAlgorithm;
ASDCP::Result_t
CryptographicContext::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_CryptographicContext));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
CryptographicContext::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_CryptographicContext));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// GenericDataEssenceDescriptor
+//
+
+GenericDataEssenceDescriptor::GenericDataEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GenericDataEssenceDescriptor);
+}
+
+GenericDataEssenceDescriptor::GenericDataEssenceDescriptor(const GenericDataEssenceDescriptor& rhs) : FileDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GenericDataEssenceDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
GenericDataEssenceDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
GenericDataEssenceDescriptor::Copy(const GenericDataEssenceDescriptor& rhs)
{
+ FileDescriptor::Copy(rhs);
DataEssenceCoding = rhs.DataEssenceCoding;
}
ASDCP::Result_t
GenericDataEssenceDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GenericDataEssenceDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
GenericDataEssenceDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GenericDataEssenceDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// TimedTextDescriptor
+//
+
+TimedTextDescriptor::TimedTextDescriptor(const Dictionary*& d) : GenericDataEssenceDescriptor(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_TimedTextDescriptor);
+}
+
+TimedTextDescriptor::TimedTextDescriptor(const TimedTextDescriptor& rhs) : GenericDataEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_TimedTextDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
TimedTextDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
TimedTextDescriptor::Copy(const TimedTextDescriptor& rhs)
{
+ GenericDataEssenceDescriptor::Copy(rhs);
ResourceID = rhs.ResourceID;
UCSEncoding = rhs.UCSEncoding;
NamespaceURI = rhs.NamespaceURI;
ASDCP::Result_t
TimedTextDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_TimedTextDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
TimedTextDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_TimedTextDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// TimedTextResourceSubDescriptor
+//
+
+TimedTextResourceSubDescriptor::TimedTextResourceSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), EssenceStreamID(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_TimedTextResourceSubDescriptor);
+}
+
+TimedTextResourceSubDescriptor::TimedTextResourceSubDescriptor(const TimedTextResourceSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_TimedTextResourceSubDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
TimedTextResourceSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
TimedTextResourceSubDescriptor::Copy(const TimedTextResourceSubDescriptor& rhs)
{
+ InterchangeObject::Copy(rhs);
AncillaryResourceID = rhs.AncillaryResourceID;
MIMEMediaType = rhs.MIMEMediaType;
EssenceStreamID = rhs.EssenceStreamID;
ASDCP::Result_t
TimedTextResourceSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_TimedTextResourceSubDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
TimedTextResourceSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_TimedTextResourceSubDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// StereoscopicPictureSubDescriptor
+//
+
+StereoscopicPictureSubDescriptor::StereoscopicPictureSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_StereoscopicPictureSubDescriptor);
+}
+
+StereoscopicPictureSubDescriptor::StereoscopicPictureSubDescriptor(const StereoscopicPictureSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_StereoscopicPictureSubDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
StereoscopicPictureSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
StereoscopicPictureSubDescriptor::Copy(const StereoscopicPictureSubDescriptor& rhs)
{
+ InterchangeObject::Copy(rhs);
}
//
ASDCP::Result_t
StereoscopicPictureSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_StereoscopicPictureSubDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
StereoscopicPictureSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_StereoscopicPictureSubDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// NetworkLocator
+//
+
+NetworkLocator::NetworkLocator(const Dictionary*& d) : InterchangeObject(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_NetworkLocator);
+}
+
+NetworkLocator::NetworkLocator(const NetworkLocator& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_NetworkLocator);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
NetworkLocator::InitFromTLVSet(TLVReader& TLVSet)
void
NetworkLocator::Copy(const NetworkLocator& rhs)
{
+ InterchangeObject::Copy(rhs);
URLString = rhs.URLString;
}
ASDCP::Result_t
NetworkLocator::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_NetworkLocator));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
NetworkLocator::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_NetworkLocator));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// MCALabelSubDescriptor
+//
+
+MCALabelSubDescriptor::MCALabelSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), MCAChannelID(0)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_MCALabelSubDescriptor);
+}
+
+MCALabelSubDescriptor::MCALabelSubDescriptor(const MCALabelSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_MCALabelSubDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
MCALabelSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
MCALabelSubDescriptor::Copy(const MCALabelSubDescriptor& rhs)
{
+ InterchangeObject::Copy(rhs);
MCALabelDictionaryID = rhs.MCALabelDictionaryID;
MCALinkID = rhs.MCALinkID;
MCATagSymbol = rhs.MCATagSymbol;
ASDCP::Result_t
MCALabelSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_MCALabelSubDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
MCALabelSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_MCALabelSubDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// AudioChannelLabelSubDescriptor
+//
+
+AudioChannelLabelSubDescriptor::AudioChannelLabelSubDescriptor(const Dictionary*& d) : MCALabelSubDescriptor(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_AudioChannelLabelSubDescriptor);
+}
+
+AudioChannelLabelSubDescriptor::AudioChannelLabelSubDescriptor(const AudioChannelLabelSubDescriptor& rhs) : MCALabelSubDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_AudioChannelLabelSubDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
AudioChannelLabelSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
AudioChannelLabelSubDescriptor::Copy(const AudioChannelLabelSubDescriptor& rhs)
{
+ MCALabelSubDescriptor::Copy(rhs);
SoundfieldGroupLinkID = rhs.SoundfieldGroupLinkID;
}
ASDCP::Result_t
AudioChannelLabelSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_AudioChannelLabelSubDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
AudioChannelLabelSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_AudioChannelLabelSubDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// SoundfieldGroupLabelSubDescriptor
+//
+
+SoundfieldGroupLabelSubDescriptor::SoundfieldGroupLabelSubDescriptor(const Dictionary*& d) : MCALabelSubDescriptor(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_SoundfieldGroupLabelSubDescriptor);
+}
+
+SoundfieldGroupLabelSubDescriptor::SoundfieldGroupLabelSubDescriptor(const SoundfieldGroupLabelSubDescriptor& rhs) : MCALabelSubDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_SoundfieldGroupLabelSubDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
SoundfieldGroupLabelSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
SoundfieldGroupLabelSubDescriptor::Copy(const SoundfieldGroupLabelSubDescriptor& rhs)
{
+ MCALabelSubDescriptor::Copy(rhs);
GroupOfSoundfieldGroupsLinkID = rhs.GroupOfSoundfieldGroupsLinkID;
}
ASDCP::Result_t
SoundfieldGroupLabelSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_SoundfieldGroupLabelSubDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
SoundfieldGroupLabelSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_SoundfieldGroupLabelSubDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
//------------------------------------------------------------------------------------------
// GroupOfSoundfieldGroupsLabelSubDescriptor
+//
+
+GroupOfSoundfieldGroupsLabelSubDescriptor::GroupOfSoundfieldGroupsLabelSubDescriptor(const Dictionary*& d) : MCALabelSubDescriptor(d), m_Dict(d)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GroupOfSoundfieldGroupsLabelSubDescriptor);
+}
+
+GroupOfSoundfieldGroupsLabelSubDescriptor::GroupOfSoundfieldGroupsLabelSubDescriptor(const GroupOfSoundfieldGroupsLabelSubDescriptor& rhs) : MCALabelSubDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict)
+{
+ assert(m_Dict);
+ m_UL = m_Dict->ul(MDD_GroupOfSoundfieldGroupsLabelSubDescriptor);
+ Copy(rhs);
+}
+
+
//
ASDCP::Result_t
GroupOfSoundfieldGroupsLabelSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
void
GroupOfSoundfieldGroupsLabelSubDescriptor::Copy(const GroupOfSoundfieldGroupsLabelSubDescriptor& rhs)
{
+ MCALabelSubDescriptor::Copy(rhs);
}
//
ASDCP::Result_t
GroupOfSoundfieldGroupsLabelSubDescriptor::InitFromBuffer(const byte_t* p, ui32_t l)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GroupOfSoundfieldGroupsLabelSubDescriptor));
return InterchangeObject::InitFromBuffer(p, l);
}
ASDCP::Result_t
GroupOfSoundfieldGroupsLabelSubDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
{
- assert(m_Dict);
- m_Typeinfo = &(m_Dict->Type(MDD_GroupOfSoundfieldGroupsLabelSubDescriptor));
return InterchangeObject::WriteToBuffer(Buffer);
}
VersionType ToolkitVersion;
UTF16String Platform;
- Identification(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- Identification(const Identification& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
Batch<UUID> Packages;
Batch<UUID> EssenceContainerData;
- ContentStorage(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- ContentStorage(const ContentStorage& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui32_t IndexSID;
ui32_t BodySID;
- EssenceContainerData(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), IndexSID(0), BodySID(0) {}
- EssenceContainerData(const EssenceContainerData& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
Timestamp PackageModifiedDate;
Batch<UUID> Tracks;
- GenericPackage(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- GenericPackage(const GenericPackage& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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);
+ 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);
};
//
public:
const Dictionary*& m_Dict;
- MaterialPackage(const Dictionary*& d) : GenericPackage(d), m_Dict(d) {}
- MaterialPackage(const MaterialPackage& rhs) : GenericPackage(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
const Dictionary*& m_Dict;
UUID Descriptor;
- SourcePackage(const Dictionary*& d) : GenericPackage(d), m_Dict(d) {}
- SourcePackage(const SourcePackage& rhs) : GenericPackage(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
UTF16String TrackName;
UUID Sequence;
- GenericTrack(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), TrackID(0), TrackNumber(0) {}
- GenericTrack(const GenericTrack& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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);
+ 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);
};
//
public:
const Dictionary*& m_Dict;
- StaticTrack(const Dictionary*& d) : GenericTrack(d), m_Dict(d) {}
- StaticTrack(const StaticTrack& rhs) : GenericTrack(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
Rational EditRate;
ui64_t Origin;
- Track(const Dictionary*& d) : GenericTrack(d), m_Dict(d), Origin(0) {}
- Track(const Track& rhs) : GenericTrack(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
UL DataDefinition;
ui64_t Duration;
- StructuralComponent(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), Duration(0) {}
- StructuralComponent(const StructuralComponent& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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);
+ 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);
};
//
const Dictionary*& m_Dict;
Batch<UUID> StructuralComponents;
- Sequence(const Dictionary*& d) : StructuralComponent(d), m_Dict(d) {}
- Sequence(const Sequence& rhs) : StructuralComponent(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
UMID SourcePackageID;
ui32_t SourceTrackID;
- SourceClip(const Dictionary*& d) : StructuralComponent(d), m_Dict(d), StartPosition(0), SourceTrackID(0) {}
- SourceClip(const SourceClip& rhs) : StructuralComponent(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui64_t StartTimecode;
ui8_t DropFrame;
- TimecodeComponent(const Dictionary*& d) : StructuralComponent(d), m_Dict(d), RoundedTimecodeBase(0), StartTimecode(0), DropFrame(0) {}
- TimecodeComponent(const TimecodeComponent& rhs) : StructuralComponent(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
Batch<UUID> Locators;
Batch<UUID> SubDescriptors;
- GenericDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- GenericDescriptor(const GenericDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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);
+ 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);
};
//
UL EssenceContainer;
UL Codec;
- FileDescriptor(const Dictionary*& d) : GenericDescriptor(d), m_Dict(d), LinkedTrackID(0), ContainerDuration(0) {}
- FileDescriptor(const FileDescriptor& rhs) : GenericDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui32_t QuantizationBits;
ui8_t DialNorm;
- GenericSoundEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d), Locked(0), AudioRefLevel(0), ChannelCount(0), QuantizationBits(0), DialNorm(0) {}
- GenericSoundEssenceDescriptor(const GenericSoundEssenceDescriptor& rhs) : FileDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui32_t AvgBps;
UL ChannelAssignment;
- WaveAudioDescriptor(const Dictionary*& d) : GenericSoundEssenceDescriptor(d), m_Dict(d), BlockAlign(0), SequenceOffset(0), AvgBps(0) {}
- WaveAudioDescriptor(const WaveAudioDescriptor& rhs) : GenericSoundEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
Rational AspectRatio;
UL PictureEssenceCoding;
- GenericPictureEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d), FrameLayout(0), StoredWidth(0), StoredHeight(0) {}
- GenericPictureEssenceDescriptor(const GenericPictureEssenceDescriptor& rhs) : FileDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui32_t ComponentMaxRef;
ui32_t ComponentMinRef;
- RGBAEssenceDescriptor(const Dictionary*& d) : GenericPictureEssenceDescriptor(d), m_Dict(d), ComponentMaxRef(0), ComponentMinRef(0) {}
- RGBAEssenceDescriptor(const RGBAEssenceDescriptor& rhs) : GenericPictureEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
Raw CodingStyleDefault;
Raw QuantizationDefault;
- JPEG2000PictureSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), Rsize(0), Xsize(0), Ysize(0), XOsize(0), YOsize(0), XTsize(0), YTsize(0), XTOsize(0), YTOsize(0), Csize(0) {}
- JPEG2000PictureSubDescriptor(const JPEG2000PictureSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui32_t VerticalSubsampling;
ui8_t ColorSiting;
- CDCIEssenceDescriptor(const Dictionary*& d) : GenericPictureEssenceDescriptor(d), m_Dict(d), ComponentDepth(0), HorizontalSubsampling(0), VerticalSubsampling(0), ColorSiting(0) {}
- CDCIEssenceDescriptor(const CDCIEssenceDescriptor& rhs) : GenericPictureEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui32_t BitRate;
ui8_t ProfileAndLevel;
- MPEG2VideoDescriptor(const Dictionary*& d) : CDCIEssenceDescriptor(d), m_Dict(d), CodedContentType(0), LowDelay(0), BitRate(0), ProfileAndLevel(0) {}
- MPEG2VideoDescriptor(const MPEG2VideoDescriptor& rhs) : CDCIEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
UTF16String EventComment;
UUID DMFramework;
- DMSegment(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), EventStartPosition(0), Duration(0) {}
- DMSegment(const DMSegment& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
const Dictionary*& m_Dict;
UUID ContextSR;
- CryptographicFramework(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- CryptographicFramework(const CryptographicFramework& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
UL MICAlgorithm;
UUID CryptographicKeyID;
- CryptographicContext(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- CryptographicContext(const CryptographicContext& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
const Dictionary*& m_Dict;
UL DataEssenceCoding;
- GenericDataEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d) {}
- GenericDataEssenceDescriptor(const GenericDataEssenceDescriptor& rhs) : FileDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
UTF16String UCSEncoding;
UTF16String NamespaceURI;
- TimedTextDescriptor(const Dictionary*& d) : GenericDataEssenceDescriptor(d), m_Dict(d) {}
- TimedTextDescriptor(const TimedTextDescriptor& rhs) : GenericDataEssenceDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
UTF16String MIMEMediaType;
ui32_t EssenceStreamID;
- TimedTextResourceSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), EssenceStreamID(0) {}
- TimedTextResourceSubDescriptor(const TimedTextResourceSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
public:
const Dictionary*& m_Dict;
- StereoscopicPictureSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- StereoscopicPictureSubDescriptor(const StereoscopicPictureSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
const Dictionary*& m_Dict;
UTF16String URLString;
- NetworkLocator(const Dictionary*& d) : InterchangeObject(d), m_Dict(d) {}
- NetworkLocator(const NetworkLocator& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
ui32_t MCAChannelID;
ISO8String RFC5646SpokenLanguage;
- MCALabelSubDescriptor(const Dictionary*& d) : InterchangeObject(d), m_Dict(d), MCAChannelID(0) {}
- MCALabelSubDescriptor(const MCALabelSubDescriptor& rhs) : InterchangeObject(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
const Dictionary*& m_Dict;
UUID SoundfieldGroupLinkID;
- AudioChannelLabelSubDescriptor(const Dictionary*& d) : MCALabelSubDescriptor(d), m_Dict(d) {}
- AudioChannelLabelSubDescriptor(const AudioChannelLabelSubDescriptor& rhs) : MCALabelSubDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
const Dictionary*& m_Dict;
Array<UUID> GroupOfSoundfieldGroupsLinkID;
- SoundfieldGroupLabelSubDescriptor(const Dictionary*& d) : MCALabelSubDescriptor(d), m_Dict(d) {}
- SoundfieldGroupLabelSubDescriptor(const SoundfieldGroupLabelSubDescriptor& rhs) : MCALabelSubDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
//
public:
const Dictionary*& m_Dict;
- GroupOfSoundfieldGroupsLabelSubDescriptor(const Dictionary*& d) : MCALabelSubDescriptor(d), m_Dict(d) {}
- GroupOfSoundfieldGroupsLabelSubDescriptor(const GroupOfSoundfieldGroupsLabelSubDescriptor& rhs) : MCALabelSubDescriptor(rhs.m_Dict), m_Dict(rhs.m_Dict) { Copy(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&);
+ 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&);
};
} // namespace MXF
/*
-Copyright (c) 2004-2009, John Hurst
+Copyright (c) 2004-2012, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
// PCM::CalcSampleSize(ADesc);
Result_t
-ASDCP::ParserInstance::OpenRead(const char* filename, Rational& PictureRate)
+ASDCP::ParserInstance::OpenRead(const char* filename, const Rational& PictureRate)
{
ASDCP_TEST_NULL_STR(filename);
}
}
-
//
Result_t
-ASDCP::PCMParserList::OpenRead(ui32_t argc, const char** argv, Rational& PictureRate)
+ASDCP::PCMParserList::OpenRead(ui32_t argc, const char** argv, const Rational& PictureRate)
{
ASDCP_TEST_NULL_STR(argv);
+ PathList_t TmpFileList;
+
+ for ( ui32_t i = 0; i < argc; ++i )
+ TmpFileList.push_back(argv[i]);
+
+ return OpenRead(TmpFileList, PictureRate);
+}
+
+//
+Result_t
+ASDCP::PCMParserList::OpenRead(const Kumu::PathList_t& argv, const Rational& PictureRate)
+{
Result_t result = RESULT_OK;
PathList_t::iterator fi;
- PathList_t TmpFileList;
+ Kumu::PathList_t file_list;
- if ( argc == 1 && PathIsDirectory(argv[0]) )
+ if ( argv.size() == 1 && PathIsDirectory(argv.front()) )
{
DirScanner Dir;
char name_buf[MaxFilePath];
- result = Dir.Open(argv[0]);
+ result = Dir.Open(argv.front().c_str());
if ( KM_SUCCESS(result) )
result = Dir.GetNext(name_buf);
{
if ( name_buf[0] != '.' ) // no hidden files
{
- std::string tmp_path = std::string(argv[0]) + "/" + name_buf;
- TmpFileList.push_back(tmp_path);
+ std::string tmp_path = argv.front() + "/" + name_buf;
+ file_list.push_back(tmp_path);
}
result = Dir.GetNext(name_buf);
if ( result == RESULT_ENDOFFILE )
{
result = RESULT_OK;
- TmpFileList.sort();
+ file_list.sort();
}
}
else
{
- for ( ui32_t i = 0; i < argc; ++i )
- TmpFileList.push_back(argv[i]);
+ file_list = argv;
}
- for ( fi = TmpFileList.begin(); KM_SUCCESS(result) && fi != TmpFileList.end(); fi++ )
+ for ( fi = file_list.begin(); KM_SUCCESS(result) && fi != file_list.end(); ++fi )
{
mem_ptr<ParserInstance> I = new ParserInstance;
result = I->OpenRead(fi->c_str(), PictureRate);
if ( ASDCP_SUCCESS(result) )
{
- if ( fi == TmpFileList.begin() )
+ if ( fi == file_list.begin() )
{
m_ADesc = I->ADesc;
}
/*
-Copyright (c) 2004-2009, John Hurst
+Copyright (c) 2004-2012, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
#ifndef _PCMPARSERLIST_H_
#define _PCMPARSERLIST_H_
+#include <KM_fileio.h>
#include <AS_DCP.h>
#include <vector>
ParserInstance();
virtual ~ParserInstance();
- Result_t OpenRead(const char* filename, Rational& PictureRate);
+ Result_t OpenRead(const char* filename, const Rational& PictureRate);
Result_t PutSample(byte_t* p);
Result_t ReadFrame();
inline ui32_t SampleSize() { return m_SampleSize; }
PCMParserList();
virtual ~PCMParserList();
- Result_t OpenRead(ui32_t argc, const char** argv, Rational& PictureRate);
+ Result_t OpenRead(ui32_t argc, const char** argv, const Rational& PictureRate);
+ Result_t OpenRead(const Kumu::PathList_t& argv, const Rational& PictureRate);
Result_t FillAudioDescriptor(PCM::AudioDescriptor& ADesc) const;
Result_t Reset();
Result_t ReadFrame(PCM::FrameBuffer& OutFB);
--- /dev/null
+/*
+Copyright (c) 2003-2012, 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 asdcp-info.cpp
+ \version $Id$
+ \brief AS-DCP file metadata utility
+
+ This program provides metadata information about an AS-DCP file.
+
+ For more information about asdcplib, please refer to the header file AS_DCP.h
+*/
+
+#include <KM_fileio.h>
+#include <AS_DCP.h>
+#include <MXF.h>
+#include <Metadata.h>
+#include <openssl/sha.h>
+
+using namespace Kumu;
+using namespace ASDCP;
+
+const ui32_t FRAME_BUFFER_SIZE = 4 * Kumu::Megabyte;
+
+//------------------------------------------------------------------------------------------
+//
+// command line option parser class
+
+static const char* PROGRAM_NAME = "asdcp-info"; // program name for messages
+
+
+// Increment the iterator, test for an additional non-option command line argument.
+// Causes the caller to return if there are no remaining arguments or if the next
+// argument begins with '-'.
+#define TEST_EXTRA_ARG(i,c) \
+ if ( ++i >= argc || argv[(i)][0] == '-' ) { \
+ fprintf(stderr, "Argument not found for option -%c.\n", (c)); \
+ return; \
+ }
+
+//
+void
+banner(FILE* stream = stdout)
+{
+ fprintf(stream, "\n\
+%s (asdcplib %s)\n\n\
+Copyright (c) 2003-2012 John Hurst\n\n\
+asdcplib may be copied only under the terms of the license found at\n\
+the top of every file in the asdcplib distribution kit.\n\n\
+Specify the -h (help) option for further information about %s\n\n",
+ PROGRAM_NAME, ASDCP::Version(), PROGRAM_NAME);
+}
+
+//
+void
+usage(FILE* stream = stdout)
+{
+ fprintf(stream, "\
+USAGE:%s [-h|-help] [-V]\n\
+\n\
+ %s [-3] [-H] [-n] <input-file>+\n\
+\n\
+Options:\n\
+ -3 - Force stereoscopic interpretation of a JP2K file\n\
+ -h | -help - Show help\n\
+ -H - Show MXF header metadata\n\
+ -n - Show index\n\
+ -V - Show version information\n\
+\n\
+ NOTES: o There is no option grouping, all options must be distinct arguments.\n\
+ o All option arguments must be separated from the option by whitespace.\n\n",
+ PROGRAM_NAME, PROGRAM_NAME);
+
+}
+
+//
+class CommandOptions
+{
+ CommandOptions();
+
+public:
+ bool error_flag; // true if the given options are in error or not complete
+ bool version_flag; // true if the version display option was selected
+ bool help_flag; // true if the help display option was selected
+ PathList_t filenames; // list of filenames to be processed
+ bool showindex_flag; // true if index is to be displayed
+ bool showheader_flag; // true if MXF file header is to be displayed
+ bool stereo_image_flag; // if true, expect stereoscopic JP2K input (left eye first)
+
+ //
+ CommandOptions(int argc, const char** argv) :
+ error_flag(true), version_flag(false), help_flag(false),
+ showindex_flag(), showheader_flag(), stereo_image_flag(false)
+ {
+ for ( int i = 1; i < argc; ++i )
+ {
+
+ if ( (strcmp( argv[i], "-help") == 0) )
+ {
+ help_flag = true;
+ continue;
+ }
+
+ if ( argv[i][0] == '-'
+ && ( isalpha(argv[i][1]) || isdigit(argv[i][1]) )
+ && argv[i][2] == 0 )
+ {
+ switch ( argv[i][1] )
+ {
+ case '3': stereo_image_flag = true; break;
+ case 'H': showheader_flag = true; break;
+ case 'h': help_flag = true; break;
+ case 'n': showindex_flag = true; break;
+ case 'V': version_flag = true; break;
+
+ default:
+ fprintf(stderr, "Unrecognized option: %s\n", argv[i]);
+ return;
+ }
+ }
+ else
+ {
+ if ( argv[i][0] != '-' )
+ {
+ filenames.push_back(argv[i]);
+ }
+ else
+ {
+ fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);
+ return;
+ }
+ }
+ }
+
+ if ( help_flag || version_flag )
+ return;
+
+ if ( filenames.empty() )
+ {
+ fputs("Option requires at least one filename argument.\n", stderr);
+ return;
+ }
+
+ error_flag = false;
+ }
+};
+
+//------------------------------------------------------------------------------------------
+//
+
+//
+// These classes wrap the irregular names in the asdcplib API
+// so that I can use a template to simplify the implementation
+// of show_file_info()
+
+class MyVideoDescriptor : public MPEG2::VideoDescriptor
+{
+ public:
+ void FillDescriptor(MPEG2::MXFReader& Reader) {
+ Reader.FillVideoDescriptor(*this);
+ }
+
+ void Dump(FILE* stream) {
+ MPEG2::VideoDescriptorDump(*this, stream);
+ }
+};
+
+class MyPictureDescriptor : public JP2K::PictureDescriptor
+{
+ public:
+ void FillDescriptor(JP2K::MXFReader& Reader) {
+ Reader.FillPictureDescriptor(*this);
+ }
+
+ void Dump(FILE* stream) {
+ JP2K::PictureDescriptorDump(*this, stream);
+ }
+};
+
+class MyStereoPictureDescriptor : public JP2K::PictureDescriptor
+{
+ public:
+ void FillDescriptor(JP2K::MXFSReader& Reader) {
+ Reader.FillPictureDescriptor(*this);
+ }
+
+ void Dump(FILE* stream) {
+ JP2K::PictureDescriptorDump(*this, stream);
+ }
+};
+
+class MyAudioDescriptor : public PCM::AudioDescriptor
+{
+ public:
+ void FillDescriptor(PCM::MXFReader& Reader) {
+ Reader.FillAudioDescriptor(*this);
+ }
+
+ void Dump(FILE* stream) {
+ PCM::AudioDescriptorDump(*this, stream);
+ }
+};
+
+class MyTextDescriptor : public TimedText::TimedTextDescriptor
+{
+ public:
+ void FillDescriptor(TimedText::MXFReader& Reader) {
+ Reader.FillTimedTextDescriptor(*this);
+ }
+
+ void Dump(FILE* stream) {
+ TimedText::DescriptorDump(*this, stream);
+ }
+};
+
+// MSVC didn't like the function template, so now it's a static class method
+template<class ReaderT, class DescriptorT>
+class FileInfoWrapper
+{
+public:
+ static Result_t
+ file_info(CommandOptions& Options, const char* type_string, FILE* stream = 0)
+ {
+ assert(type_string);
+ if ( stream == 0 )
+ stream = stdout;
+
+ Result_t result = RESULT_OK;
+ ReaderT Reader;
+ result = Reader.OpenRead(Options.filenames.front().c_str());
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ fprintf(stdout, "File essence type is %s.\n", type_string);
+
+ if ( Options.showheader_flag )
+ Reader.DumpHeaderMetadata(stream);
+
+ WriterInfo WI;
+ Reader.FillWriterInfo(WI);
+ WriterInfoDump(WI, stream);
+
+ DescriptorT Desc;
+ Desc.FillDescriptor(Reader);
+ Desc.Dump(stream);
+
+ if ( Options.showindex_flag )
+ Reader.DumpIndex(stream);
+ }
+ else if ( result == RESULT_FORMAT && Options.showheader_flag )
+ {
+ Reader.DumpHeaderMetadata(stream);
+ }
+
+ return result;
+ }
+};
+
+// Read header metadata from an ASDCP file
+//
+Result_t
+show_file_info(CommandOptions& Options)
+{
+ EssenceType_t EssenceType;
+ Result_t result = ASDCP::EssenceType(Options.filenames.front().c_str(), EssenceType);
+
+ if ( ASDCP_FAILURE(result) )
+ return result;
+
+ if ( EssenceType == ESS_MPEG2_VES )
+ {
+ result = FileInfoWrapper<ASDCP::MPEG2::MXFReader, MyVideoDescriptor>::file_info(Options, "MPEG2 video");
+ }
+ else if ( EssenceType == ESS_PCM_24b_48k || EssenceType == ESS_PCM_24b_96k )
+ {
+ result = FileInfoWrapper<ASDCP::PCM::MXFReader, MyAudioDescriptor>::file_info(Options, "PCM audio");
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ const Dictionary* Dict = &DefaultCompositeDict();
+ PCM::MXFReader Reader;
+ MXF::OPAtomHeader OPAtomHeader(Dict);
+ MXF::WaveAudioDescriptor *descriptor = 0;
+
+ result = Reader.OpenRead(Options.filenames.front().c_str());
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Reader.OPAtomHeader().GetMDObjectByType(Dict->ul(MDD_WaveAudioDescriptor), reinterpret_cast<MXF::InterchangeObject**>(&descriptor));
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ char buf[64];
+ fprintf(stdout, " ChannelAssignment: %s\n", descriptor->ChannelAssignment.EncodeString(buf, 64));
+ }
+ }
+ }
+ else if ( EssenceType == ESS_JPEG_2000 )
+ {
+ if ( Options.stereo_image_flag )
+ {
+ result = FileInfoWrapper<ASDCP::JP2K::MXFSReader,
+ MyStereoPictureDescriptor>::file_info(Options, "JPEG 2000 stereoscopic pictures");
+ }
+ else
+ {
+ result = FileInfoWrapper<ASDCP::JP2K::MXFReader,
+ MyPictureDescriptor>::file_info(Options, "JPEG 2000 pictures");
+ }
+ }
+ else if ( EssenceType == ESS_JPEG_2000_S )
+ {
+ result = FileInfoWrapper<ASDCP::JP2K::MXFSReader,
+ MyStereoPictureDescriptor>::file_info(Options, "JPEG 2000 stereoscopic pictures");
+ }
+ else if ( EssenceType == ESS_TIMED_TEXT )
+ {
+ result = FileInfoWrapper<ASDCP::TimedText::MXFReader, MyTextDescriptor>::file_info(Options, "Timed Text");
+ }
+ else
+ {
+ fprintf(stderr, "File is not AS-DCP: %s\n", Options.filenames.front().c_str());
+ Kumu::FileReader Reader;
+ const Dictionary* Dict = &DefaultCompositeDict();
+ MXF::OPAtomHeader TestHeader(Dict);
+
+ result = Reader.OpenRead(Options.filenames.front().c_str());
+
+ if ( ASDCP_SUCCESS(result) )
+ result = TestHeader.InitFromFile(Reader); // test UL and OP
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ TestHeader.Partition::Dump(stdout);
+
+ if ( MXF::Identification* ID = TestHeader.GetIdentification() )
+ ID->Dump(stdout);
+ else
+ fputs("File contains no Identification object.\n", stdout);
+
+ if ( MXF::SourcePackage* SP = TestHeader.GetSourcePackage() )
+ SP->Dump(stdout);
+ else
+ fputs("File contains no SourcePackage object.\n", stdout);
+ }
+ else
+ {
+ fputs("File is not MXF.\n", stdout);
+ }
+ }
+
+ return result;
+}
+
+//
+int
+main(int argc, const char** argv)
+{
+ Result_t result = RESULT_OK;
+ char str_buf[64];
+ CommandOptions Options(argc, argv);
+
+ if ( Options.version_flag )
+ banner();
+
+ if ( Options.help_flag )
+ usage();
+
+ if ( Options.version_flag || Options.help_flag )
+ return 0;
+
+ if ( Options.error_flag )
+ {
+ fprintf(stderr, "There was a problem. Type %s -h for help.\n", PROGRAM_NAME);
+ return 3;
+ }
+
+ while ( ! Options.filenames.empty() && ASDCP_SUCCESS(result) )
+ {
+ result = show_file_info(Options);
+ Options.filenames.pop_front();
+ }
+
+ if ( ASDCP_FAILURE(result) )
+ {
+ fputs("Program stopped on error.\n", stderr);
+
+ if ( result == RESULT_SFORMAT )
+ {
+ fputs("Use option '-3' to force stereoscopic mode.\n", stderr);
+ }
+ else if ( result != RESULT_FAIL )
+ {
+ fputs(result, stderr);
+ fputc('\n', stderr);
+ }
+
+ return 1;
+ }
+
+ return 0;
+}
+
+
+//
+// end asdcp-info.cpp
+//
/*
-Copyright (c) 2003-2011, John Hurst
+Copyright (c) 2003-2012, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
{
fprintf(stream, "\n\
%s (asdcplib %s)\n\n\
-Copyright (c) 2003-2011 John Hurst\n\n\
+Copyright (c) 2003-2012 John Hurst\n\n\
asdcplib may be copied only under the terms of the license found at\n\
the top of every file in the asdcplib distribution kit.\n\n\
Specify the -h (help) option for further information about %s\n\n",
\n\
%s -x <file-prefix> [-3] [-b <buffer-size>] [-d <duration>]\n\
[-f <starting-frame>] [-m] [-p <frame-rate>] [-R] [-s <num>] [-S|-1]\n\
- [-v] [-W] [-w] <input-file>\n\
-\n", PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME);
+ [-v] [-W] [-w] <input-file>\n\n",
+ PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME,
+ PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME);
fprintf(stream, "\
Major modes:\n\
return result;
if ( EssenceType == ESS_MPEG2_VES )
- result = FileInfoWrapper<ASDCP::MPEG2::MXFReader, MyVideoDescriptor>::file_info(Options, "MPEG2 video");
-
+ {
+ result = FileInfoWrapper<ASDCP::MPEG2::MXFReader, MyVideoDescriptor>::file_info(Options, "MPEG2 video");
+ }
else if ( EssenceType == ESS_PCM_24b_48k || EssenceType == ESS_PCM_24b_96k )
- result = FileInfoWrapper<ASDCP::PCM::MXFReader, MyAudioDescriptor>::file_info(Options, "PCM audio");
+ {
+ result = FileInfoWrapper<ASDCP::PCM::MXFReader, MyAudioDescriptor>::file_info(Options, "PCM audio");
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ const Dictionary* Dict = &DefaultCompositeDict();
+ PCM::MXFReader Reader;
+ MXF::OPAtomHeader OPAtomHeader(Dict);
+ MXF::WaveAudioDescriptor *descriptor = 0;
+ result = Reader.OpenRead(Options.filenames[0]);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Reader.OPAtomHeader().GetMDObjectByType(Dict->ul(MDD_WaveAudioDescriptor), reinterpret_cast<MXF::InterchangeObject**>(&descriptor));
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ char buf[64];
+ fprintf(stdout, " ChannelAssignment: %s\n", descriptor->ChannelAssignment.EncodeString(buf, 64));
+ }
+ }
+ }
else if ( EssenceType == ESS_JPEG_2000 )
{
if ( Options.stereo_image_flag )
- result = FileInfoWrapper<ASDCP::JP2K::MXFSReader,
- MyStereoPictureDescriptor>::file_info(Options, "JPEG 2000 stereoscopic pictures");
-
+ {
+ result = FileInfoWrapper<ASDCP::JP2K::MXFSReader,
+ MyStereoPictureDescriptor>::file_info(Options, "JPEG 2000 stereoscopic pictures");
+ }
else
- result = FileInfoWrapper<ASDCP::JP2K::MXFReader,
- MyPictureDescriptor>::file_info(Options, "JPEG 2000 pictures");
+ {
+ result = FileInfoWrapper<ASDCP::JP2K::MXFReader,
+ MyPictureDescriptor>::file_info(Options, "JPEG 2000 pictures");
+ }
}
else if ( EssenceType == ESS_JPEG_2000_S )
- result = FileInfoWrapper<ASDCP::JP2K::MXFSReader,
- MyStereoPictureDescriptor>::file_info(Options, "JPEG 2000 stereoscopic pictures");
-
+ {
+ result = FileInfoWrapper<ASDCP::JP2K::MXFSReader,
+ MyStereoPictureDescriptor>::file_info(Options, "JPEG 2000 stereoscopic pictures");
+ }
else if ( EssenceType == ESS_TIMED_TEXT )
- result = FileInfoWrapper<ASDCP::TimedText::MXFReader, MyTextDescriptor>::file_info(Options, "Timed Text");
-
+ {
+ result = FileInfoWrapper<ASDCP::TimedText::MXFReader, MyTextDescriptor>::file_info(Options, "Timed Text");
+ }
else
{
fprintf(stderr, "File is not AS-DCP: %s\n", Options.filenames[0]);
--- /dev/null
+/*
+Copyright (c) 2003-2012, 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 asdcp-unwrap.cpp
+ \version $Id$
+ \brief AS-DCP file manipulation utility
+
+ This program extracts picture, sound and text essence from AS-DCP files.
+
+ For more information about asdcplib, please refer to the header file AS_DCP.h
+*/
+
+#include <KM_fileio.h>
+#include <WavFileWriter.h>
+
+using namespace ASDCP;
+
+const ui32_t FRAME_BUFFER_SIZE = 4 * Kumu::Megabyte;
+
+//------------------------------------------------------------------------------------------
+//
+// command line option parser class
+
+static const char* PROGRAM_NAME = "asdcp-unwrap"; // program name for messages
+
+// Increment the iterator, test for an additional non-option command line argument.
+// Causes the caller to return if there are no remaining arguments or if the next
+// argument begins with '-'.
+#define TEST_EXTRA_ARG(i,c) \
+ if ( ++i >= argc || argv[(i)][0] == '-' ) { \
+ fprintf(stderr, "Argument not found for option -%c.\n", (c)); \
+ return; \
+ }
+
+//
+void
+banner(FILE* stream = stdout)
+{
+ fprintf(stream, "\n\
+%s (asdcplib %s)\n\n\
+Copyright (c) 2003-2012 John Hurst\n\n\
+asdcplib may be copied only under the terms of the license found at\n\
+the top of every file in the asdcplib distribution kit.\n\n\
+Specify the -h (help) option for further information about %s\n\n",
+ PROGRAM_NAME, ASDCP::Version(), PROGRAM_NAME);
+}
+
+//
+void
+usage(FILE* stream = stdout)
+{
+ fprintf(stream, "\
+USAGE: %s [-h|-help] [-V]\n\
+\n\
+ %s -G [-v] <input-file>\n\
+\n\
+ %s [-1|-2] [-3] [-b <buffer-size>] [-d <duration>]\n\
+ [-f <starting-frame>] [-m] [-p <frame-rate>] [-R] [-s <size>] [-v] [-W]\n\
+ [-w] <input-file> [<file-prefix>]\n\n",
+ PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME);
+
+ fprintf(stream, "\
+Options:\n\
+ -1 - Split Wave essence to mono WAV files during extract.\n\
+ Default is multichannel WAV\n\
+ -2 - Split Wave essence to stereo WAV files during extract.\n\
+ Default is multichannel WAV\n\
+ -3 - Force stereoscopic interpretation of a JP2K file.\n\
+ -b <buffer-size> - Specify size in bytes of picture frame buffer.\n\
+ Defaults to 4,194,304 (4MB)\n\
+ -d <duration> - Number of frames to process, default all\n\
+ -f <start-frame> - Starting frame number, default 0\n\
+ -G - Perform GOP start lookup test on MXF+Interop MPEG file\n\
+ -h | -help - Show help\n\
+ -k <key-string> - Use key for ciphertext operations\n\
+ -m - verify HMAC values when reading\n\
+ -p <rate> - fps of picture when wrapping PCM or JP2K:\n\
+ Use one of [23|24|25|30|48|50|60], 24 is default\n\
+ -s <size> - Number of bytes to dump to output when -v is given\n\
+ -V - Show version information\n\
+ -v - Verbose, prints informative messages to stderr\n\
+ -W - Read input file only, do not write destination file\n\
+ -w <width> - Width of numeric element in a series of frame file names\n\
+ (default 6).\n\
+ -z - Fail if j2c inputs have unequal parameters (default)\n\
+ -Z - Ignore unequal parameters in j2c inputs\n\
+\n\
+ NOTES: o There is no option grouping, all options must be distinct arguments.\n\
+ o All option arguments must be separated from the option by whitespace.\n\
+ o An argument of \"23\" to the -p option will be interpreted\n\
+ as 24000/1001 fps.\n\n");
+}
+
+//
+enum MajorMode_t
+{
+ MMT_NONE,
+ MMT_EXTRACT,
+ MMT_GOP_START,
+};
+
+//
+class CommandOptions
+{
+ CommandOptions();
+
+public:
+ MajorMode_t mode;
+ bool error_flag; // true if the given options are in error or not complete
+ bool key_flag; // true if an encryption key was given
+ bool read_hmac; // true if HMAC values are to be validated
+ bool split_wav; // true if PCM is to be extracted to stereo WAV files
+ bool mono_wav; // true if PCM is to be extracted to mono WAV files
+ bool verbose_flag; // true if the verbose option was selected
+ ui32_t fb_dump_size; // number of bytes of frame buffer to dump
+ bool no_write_flag; // true if no output files are to be written
+ bool version_flag; // true if the version display option was selected
+ bool help_flag; // true if the help display option was selected
+ bool stereo_image_flag; // if true, expect stereoscopic JP2K input (left eye first)
+ ui32_t number_width; // number of digits in a serialized filename (for JPEG extract)
+ ui32_t start_frame; // frame number to begin processing
+ ui32_t duration; // number of frames to be processed
+ bool duration_flag; // true if duration argument given
+ bool j2c_pedantic; // passed to JP2K::SequenceParser::OpenRead
+ ui32_t picture_rate; // fps of picture when wrapping PCM
+ ui32_t fb_size; // size of picture frame buffer
+ const char* file_prefix; // filename pre for files written by the extract mode
+ byte_t key_value[KeyLen]; // value of given encryption key (when key_flag is true)
+ byte_t key_id_value[UUIDlen];// value of given key ID (when key_id_flag is true)
+ PCM::ChannelFormat_t channel_fmt; // audio channel arrangement
+ const char* input_filename;
+ std::string prefix_buffer;
+
+ //
+ Rational PictureRate()
+ {
+ if ( picture_rate == 23 ) return EditRate_23_98;
+ if ( picture_rate == 24 ) return EditRate_24;
+ if ( picture_rate == 25 ) return EditRate_25;
+ if ( picture_rate == 30 ) return EditRate_30;
+ if ( picture_rate == 48 ) return EditRate_48;
+ if ( picture_rate == 50 ) return EditRate_50;
+ if ( picture_rate == 60 ) return EditRate_60;
+ if ( picture_rate == 96 ) return EditRate_96;
+ if ( picture_rate == 100 ) return EditRate_100;
+ if ( picture_rate == 120 ) return EditRate_120;
+ return EditRate_24;
+ }
+
+ //
+ CommandOptions(int argc, const char** argv) :
+ mode(MMT_EXTRACT), error_flag(true), key_flag(false), read_hmac(false), split_wav(false),
+ mono_wav(false), verbose_flag(false), fb_dump_size(0), no_write_flag(false),
+ version_flag(false), help_flag(false), stereo_image_flag(false), number_width(6),
+ start_frame(0), duration(0xffffffff), duration_flag(false), j2c_pedantic(true),
+ picture_rate(24), fb_size(FRAME_BUFFER_SIZE), file_prefix(0),
+ channel_fmt(PCM::CF_NONE), input_filename(0)
+ {
+ memset(key_value, 0, KeyLen);
+ memset(key_id_value, 0, UUIDlen);
+
+ for ( int i = 1; i < argc; ++i )
+ {
+
+ if ( (strcmp( argv[i], "-help") == 0) )
+ {
+ help_flag = true;
+ continue;
+ }
+
+ if ( argv[i][0] == '-'
+ && ( isalpha(argv[i][1]) || isdigit(argv[i][1]) )
+ && argv[i][2] == 0 )
+ {
+ switch ( argv[i][1] )
+ {
+ case '1': mono_wav = true; break;
+ case '2': split_wav = true; break;
+ case '3': stereo_image_flag = true; break;
+
+ case 'b':
+ TEST_EXTRA_ARG(i, 'b');
+ fb_size = abs(atoi(argv[i]));
+
+ if ( verbose_flag )
+ fprintf(stderr, "Frame Buffer size: %u bytes.\n", fb_size);
+
+ break;
+
+ case 'd':
+ TEST_EXTRA_ARG(i, 'd');
+ duration_flag = true;
+ duration = abs(atoi(argv[i]));
+ break;
+
+ case 'f':
+ TEST_EXTRA_ARG(i, 'f');
+ start_frame = abs(atoi(argv[i]));
+ break;
+
+ case 'G': mode = MMT_GOP_START; break;
+ case 'h': help_flag = true; break;
+
+ case 'm': read_hmac = true; break;
+
+ case 'p':
+ TEST_EXTRA_ARG(i, 'p');
+ picture_rate = abs(atoi(argv[i]));
+ break;
+
+ case 's':
+ TEST_EXTRA_ARG(i, 's');
+ fb_dump_size = abs(atoi(argv[i]));
+ break;
+
+ case 'V': version_flag = true; break;
+ case 'v': verbose_flag = true; break;
+ case 'W': no_write_flag = true; break;
+
+ case 'w':
+ TEST_EXTRA_ARG(i, 'w');
+ number_width = abs(atoi(argv[i]));
+ break;
+
+ case 'Z': j2c_pedantic = false; break;
+ case 'z': j2c_pedantic = true; break;
+
+ default:
+ fprintf(stderr, "Unrecognized option: %s\n", argv[i]);
+ return;
+ }
+ }
+ else
+ {
+ if ( argv[i][0] != '-' )
+ {
+ if ( input_filename == 0 )
+ {
+ input_filename = argv[i];
+ }
+ else if ( file_prefix == 0 )
+ {
+ file_prefix = argv[i];
+ }
+ }
+ else
+ {
+ fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);
+ return;
+ }
+ }
+ }
+
+ if ( help_flag || version_flag )
+ return;
+
+ if ( ( mode == MMT_EXTRACT || mode == MMT_GOP_START ) && input_filename == 0 )
+ {
+ fputs("Option requires at least one filename argument.\n", stderr);
+ return;
+ }
+
+ if ( mode == MMT_EXTRACT && file_prefix == 0 )
+ {
+ prefix_buffer = Kumu::PathSetExtension(input_filename, "") + "_";
+ file_prefix = prefix_buffer.c_str();
+ }
+
+ error_flag = false;
+ }
+};
+
+//------------------------------------------------------------------------------------------
+// MPEG2 essence
+
+// Read a plaintext MPEG2 Video Elementary Stream from a plaintext ASDCP file
+// Read a plaintext MPEG2 Video Elementary Stream from a ciphertext ASDCP file
+// Read a ciphertext MPEG2 Video Elementary Stream from a ciphertext ASDCP file
+//
+Result_t
+read_MPEG2_file(CommandOptions& Options)
+{
+ AESDecContext* Context = 0;
+ HMACContext* HMAC = 0;
+ MPEG2::MXFReader Reader;
+ MPEG2::FrameBuffer FrameBuffer(Options.fb_size);
+ Kumu::FileWriter OutFile;
+ ui32_t frame_count = 0;
+
+ Result_t result = Reader.OpenRead(Options.input_filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ MPEG2::VideoDescriptor VDesc;
+ Reader.FillVideoDescriptor(VDesc);
+ frame_count = VDesc.ContainerDuration;
+
+ if ( Options.verbose_flag )
+ {
+ fprintf(stderr, "Frame Buffer size: %u\n", Options.fb_size);
+ MPEG2::VideoDescriptorDump(VDesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ char filename[256];
+ snprintf(filename, 256, "%s.ves", Options.file_prefix);
+ result = OutFile.OpenWrite(filename);
+ }
+
+ if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ {
+ Context = new AESDecContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) && Options.read_hmac )
+ {
+ WriterInfo Info;
+ Reader.FillWriterInfo(Info);
+
+ if ( Info.UsesHMAC )
+ {
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ else
+ {
+ fputs("File does not contain HMAC values, ignoring -m option.\n", stderr);
+ }
+ }
+ }
+
+ ui32_t last_frame = Options.start_frame + ( Options.duration ? Options.duration : frame_count);
+ if ( last_frame > frame_count )
+ last_frame = frame_count;
+
+ for ( ui32_t i = Options.start_frame; ASDCP_SUCCESS(result) && i < last_frame; i++ )
+ {
+ result = Reader.ReadFrame(i, FrameBuffer, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ ui32_t write_count = 0;
+ result = OutFile.Write(FrameBuffer.Data(), FrameBuffer.Size(), &write_count);
+ }
+ }
+
+ return result;
+}
+
+
+//
+Result_t
+gop_start_test(CommandOptions& Options)
+{
+ using namespace ASDCP::MPEG2;
+
+ MXFReader Reader;
+ MPEG2::FrameBuffer FrameBuffer(Options.fb_size);
+ ui32_t frame_count = 0;
+
+ Result_t result = Reader.OpenRead(Options.input_filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ MPEG2::VideoDescriptor VDesc;
+ Reader.FillVideoDescriptor(VDesc);
+ frame_count = VDesc.ContainerDuration;
+
+ if ( Options.verbose_flag )
+ {
+ fprintf(stderr, "Frame Buffer size: %u\n", Options.fb_size);
+ MPEG2::VideoDescriptorDump(VDesc);
+ }
+ }
+
+ ui32_t last_frame = Options.start_frame + ( Options.duration ? Options.duration : frame_count);
+ if ( last_frame > frame_count )
+ last_frame = frame_count;
+
+ for ( ui32_t i = Options.start_frame; ASDCP_SUCCESS(result) && i < last_frame; i++ )
+ {
+ result = Reader.ReadFrameGOPStart(i, FrameBuffer);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ if ( FrameBuffer.FrameType() != FRAME_I )
+ fprintf(stderr, "Expecting an I frame, got %c\n", FrameTypeChar(FrameBuffer.FrameType()));
+
+ fprintf(stderr, "Requested frame %u, got %u\n", i, FrameBuffer.FrameNumber());
+ }
+ }
+
+ return result;
+}
+
+//------------------------------------------------------------------------------------------
+// JPEG 2000 essence
+
+
+// Read one or more plaintext JPEG 2000 stereoscopic codestream pairs from a plaintext ASDCP file
+// Read one or more plaintext JPEG 2000 stereoscopic codestream pairs from a ciphertext ASDCP file
+// Read one or more ciphertext JPEG 2000 stereoscopic codestream pairs from a ciphertext ASDCP file
+Result_t
+read_JP2K_S_file(CommandOptions& Options)
+{
+ AESDecContext* Context = 0;
+ HMACContext* HMAC = 0;
+ JP2K::MXFSReader Reader;
+ JP2K::FrameBuffer FrameBuffer(Options.fb_size);
+ ui32_t frame_count = 0;
+
+ Result_t result = Reader.OpenRead(Options.input_filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ JP2K::PictureDescriptor PDesc;
+ Reader.FillPictureDescriptor(PDesc);
+
+ frame_count = PDesc.ContainerDuration;
+
+ if ( Options.verbose_flag )
+ {
+ fprintf(stderr, "Frame Buffer size: %u\n", Options.fb_size);
+ JP2K::PictureDescriptorDump(PDesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ {
+ Context = new AESDecContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) && Options.read_hmac )
+ {
+ WriterInfo Info;
+ Reader.FillWriterInfo(Info);
+
+ if ( Info.UsesHMAC )
+ {
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ else
+ {
+ fputs("File does not contain HMAC values, ignoring -m option.\n", stderr);
+ }
+ }
+ }
+
+ const int filename_max = 1024;
+ char filename[filename_max];
+ ui32_t last_frame = Options.start_frame + ( Options.duration ? Options.duration : frame_count);
+ if ( last_frame > frame_count )
+ last_frame = frame_count;
+
+ char left_format[64]; char right_format[64];
+ snprintf(left_format, 64, "%%s%%0%duL.j2c", Options.number_width);
+ snprintf(right_format, 64, "%%s%%0%duR.j2c", Options.number_width);
+
+ for ( ui32_t i = Options.start_frame; ASDCP_SUCCESS(result) && i < last_frame; i++ )
+ {
+ result = Reader.ReadFrame(i, JP2K::SP_LEFT, FrameBuffer, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Kumu::FileWriter OutFile;
+ ui32_t write_count;
+ snprintf(filename, filename_max, left_format, Options.file_prefix, i);
+ result = OutFile.OpenWrite(filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = OutFile.Write(FrameBuffer.Data(), FrameBuffer.Size(), &write_count);
+
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Reader.ReadFrame(i, JP2K::SP_RIGHT, FrameBuffer, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Kumu::FileWriter OutFile;
+ ui32_t write_count;
+ snprintf(filename, filename_max, right_format, Options.file_prefix, i);
+ result = OutFile.OpenWrite(filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = OutFile.Write(FrameBuffer.Data(), FrameBuffer.Size(), &write_count);
+ }
+ }
+
+ return result;
+}
+
+// Read one or more plaintext JPEG 2000 codestreams from a plaintext ASDCP file
+// Read one or more plaintext JPEG 2000 codestreams from a ciphertext ASDCP file
+// Read one or more ciphertext JPEG 2000 codestreams from a ciphertext ASDCP file
+//
+Result_t
+read_JP2K_file(CommandOptions& Options)
+{
+ AESDecContext* Context = 0;
+ HMACContext* HMAC = 0;
+ JP2K::MXFReader Reader;
+ JP2K::FrameBuffer FrameBuffer(Options.fb_size);
+ ui32_t frame_count = 0;
+
+ Result_t result = Reader.OpenRead(Options.input_filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ JP2K::PictureDescriptor PDesc;
+ Reader.FillPictureDescriptor(PDesc);
+
+ frame_count = PDesc.ContainerDuration;
+
+ if ( Options.verbose_flag )
+ {
+ fprintf(stderr, "Frame Buffer size: %u\n", Options.fb_size);
+ JP2K::PictureDescriptorDump(PDesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ {
+ Context = new AESDecContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) && Options.read_hmac )
+ {
+ WriterInfo Info;
+ Reader.FillWriterInfo(Info);
+
+ if ( Info.UsesHMAC )
+ {
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ else
+ {
+ fputs("File does not contain HMAC values, ignoring -m option.\n", stderr);
+ }
+ }
+ }
+
+ ui32_t last_frame = Options.start_frame + ( Options.duration ? Options.duration : frame_count);
+ if ( last_frame > frame_count )
+ last_frame = frame_count;
+
+ char name_format[64];
+ snprintf(name_format, 64, "%%s%%0%du.j2c", Options.number_width);
+
+ for ( ui32_t i = Options.start_frame; ASDCP_SUCCESS(result) && i < last_frame; i++ )
+ {
+ result = Reader.ReadFrame(i, FrameBuffer, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Kumu::FileWriter OutFile;
+ char filename[256];
+ ui32_t write_count;
+ snprintf(filename, 256, name_format, Options.file_prefix, i);
+ result = OutFile.OpenWrite(filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = OutFile.Write(FrameBuffer.Data(), FrameBuffer.Size(), &write_count);
+
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+ }
+ }
+
+ return result;
+}
+
+//------------------------------------------------------------------------------------------
+// PCM essence
+
+// Read one or more plaintext PCM audio streams from a plaintext ASDCP file
+// Read one or more plaintext PCM audio streams from a ciphertext ASDCP file
+// Read one or more ciphertext PCM audio streams from a ciphertext ASDCP file
+//
+Result_t
+read_PCM_file(CommandOptions& Options)
+{
+ AESDecContext* Context = 0;
+ HMACContext* HMAC = 0;
+ PCM::MXFReader Reader;
+ PCM::FrameBuffer FrameBuffer;
+ WavFileWriter OutWave;
+ PCM::AudioDescriptor ADesc;
+ ui32_t last_frame = 0;
+
+ Result_t result = Reader.OpenRead(Options.input_filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Reader.FillAudioDescriptor(ADesc);
+
+ if ( ADesc.EditRate != EditRate_23_98
+ && ADesc.EditRate != EditRate_24
+ && ADesc.EditRate != EditRate_25
+ && ADesc.EditRate != EditRate_30
+ && ADesc.EditRate != EditRate_48
+ && ADesc.EditRate != EditRate_50
+ && ADesc.EditRate != EditRate_60 )
+ ADesc.EditRate = Options.PictureRate();
+
+ FrameBuffer.Capacity(PCM::CalcFrameBufferSize(ADesc));
+
+ if ( Options.verbose_flag )
+ PCM::AudioDescriptorDump(ADesc);
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ last_frame = ADesc.ContainerDuration;
+
+ if ( Options.duration > 0 && Options.duration < last_frame )
+ last_frame = Options.duration;
+
+ if ( Options.start_frame > 0 )
+ {
+ if ( Options.start_frame > ADesc.ContainerDuration )
+ {
+ fprintf(stderr, "Start value greater than file duration.\n");
+ return RESULT_FAIL;
+ }
+
+ last_frame = Kumu::xmin(Options.start_frame + last_frame, ADesc.ContainerDuration);
+ }
+
+ ADesc.ContainerDuration = last_frame - Options.start_frame;
+ OutWave.OpenWrite(ADesc, Options.file_prefix,
+ ( Options.split_wav ? WavFileWriter::ST_STEREO :
+ ( Options.mono_wav ? WavFileWriter::ST_MONO : WavFileWriter::ST_NONE ) ));
+ }
+
+ if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ {
+ Context = new AESDecContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) && Options.read_hmac )
+ {
+ WriterInfo Info;
+ Reader.FillWriterInfo(Info);
+
+ if ( Info.UsesHMAC )
+ {
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ else
+ {
+ fputs("File does not contain HMAC values, ignoring -m option.\n", stderr);
+ }
+ }
+ }
+
+ for ( ui32_t i = Options.start_frame; ASDCP_SUCCESS(result) && i < last_frame; i++ )
+ {
+ result = Reader.ReadFrame(i, FrameBuffer, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ result = OutWave.WriteFrame(FrameBuffer);
+ }
+ }
+
+ return result;
+}
+
+
+//------------------------------------------------------------------------------------------
+// TimedText essence
+
+// Read one or more timed text streams from a plaintext ASDCP file
+// Read one or more timed text streams from a ciphertext ASDCP file
+// Read one or more timed text streams from a ciphertext ASDCP file
+//
+Result_t
+read_timed_text_file(CommandOptions& Options)
+{
+ AESDecContext* Context = 0;
+ HMACContext* HMAC = 0;
+ TimedText::MXFReader Reader;
+ TimedText::FrameBuffer FrameBuffer;
+ TimedText::TimedTextDescriptor TDesc;
+
+ Result_t result = Reader.OpenRead(Options.input_filename);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Reader.FillTimedTextDescriptor(TDesc);
+ FrameBuffer.Capacity(Options.fb_size);
+
+ if ( Options.verbose_flag )
+ TimedText::DescriptorDump(TDesc);
+ }
+
+ if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ {
+ Context = new AESDecContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) && Options.read_hmac )
+ {
+ WriterInfo Info;
+ Reader.FillWriterInfo(Info);
+
+ if ( Info.UsesHMAC )
+ {
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ else
+ {
+ fputs("File does not contain HMAC values, ignoring -m option.\n", stderr);
+ }
+ }
+ }
+
+ if ( ASDCP_FAILURE(result) )
+ return result;
+
+ std::string XMLDoc;
+ std::string out_path = Kumu::PathDirname(Options.file_prefix);
+ ui32_t write_count;
+ char buf[64];
+ TimedText::ResourceList_t::const_iterator ri;
+
+ result = Reader.ReadTimedTextResource(XMLDoc, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Kumu::FileWriter Writer;
+ result = Writer.OpenWrite(Options.file_prefix);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.Write(reinterpret_cast<const byte_t*>(XMLDoc.c_str()), XMLDoc.size(), &write_count);
+ }
+
+ for ( ri = TDesc.ResourceList.begin() ; ri != TDesc.ResourceList.end() && ASDCP_SUCCESS(result); ri++ )
+ {
+ result = Reader.ReadAncillaryResource(ri->ResourceID, FrameBuffer, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Kumu::FileWriter Writer;
+ result = Writer.OpenWrite(Kumu::PathJoin(out_path, Kumu::UUID(ri->ResourceID).EncodeHex(buf, 64)).c_str());
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ result = Writer.Write(FrameBuffer.RoData(), FrameBuffer.Size(), &write_count);
+ }
+ }
+ }
+
+ return result;
+}
+
+//
+int
+main(int argc, const char** argv)
+{
+ Result_t result = RESULT_OK;
+ char str_buf[64];
+ CommandOptions Options(argc, argv);
+
+ if ( Options.version_flag )
+ banner();
+
+ if ( Options.help_flag )
+ usage();
+
+ if ( Options.version_flag || Options.help_flag )
+ return 0;
+
+ if ( Options.error_flag )
+ {
+ fprintf(stderr, "There was a problem. Type %s -h for help.\n", PROGRAM_NAME);
+ return 3;
+ }
+
+ if ( Options.mode == MMT_GOP_START )
+ {
+ result = gop_start_test(Options);
+ }
+ else if ( Options.mode == MMT_EXTRACT )
+ {
+ EssenceType_t EssenceType;
+ result = ASDCP::EssenceType(Options.input_filename, EssenceType);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ switch ( EssenceType )
+ {
+ case ESS_MPEG2_VES:
+ result = read_MPEG2_file(Options);
+ break;
+
+ case ESS_JPEG_2000:
+ if ( Options.stereo_image_flag )
+ result = read_JP2K_S_file(Options);
+ else
+ result = read_JP2K_file(Options);
+ break;
+
+ case ESS_JPEG_2000_S:
+ result = read_JP2K_S_file(Options);
+ break;
+
+ case ESS_PCM_24b_48k:
+ case ESS_PCM_24b_96k:
+ result = read_PCM_file(Options);
+ break;
+
+ case ESS_TIMED_TEXT:
+ result = read_timed_text_file(Options);
+ break;
+
+ default:
+ fprintf(stderr, "%s: Unknown file type, not ASDCP essence.\n", Options.input_filename);
+ return 5;
+ }
+ }
+ }
+ else
+ {
+ fprintf(stderr, "Unhandled mode: %d.\n", Options.mode);
+ return 6;
+ }
+
+ if ( ASDCP_FAILURE(result) )
+ {
+ fputs("Program stopped on error.\n", stderr);
+
+ if ( result == RESULT_SFORMAT )
+ {
+ fputs("Use option '-3' to force stereoscopic mode.\n", stderr);
+ }
+ else if ( result != RESULT_FAIL )
+ {
+ fputs(result, stderr);
+ fputc('\n', stderr);
+ }
+
+ return 1;
+ }
+
+ return 0;
+}
+
+
+//
+// end asdcp-unwrap.cpp
+//
--- /dev/null
+/*
+Copyright (c) 2003-2012, 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 asdcp-util.cpp
+ \version $Id$
+ \brief Utility functions for working with AS-DCP files
+
+ This program provides utility features commonly useful in DCP workflows.
+
+ For more information about asdcplib, please refer to the header file AS_DCP.h
+*/
+
+#include <KM_fileio.h>
+#include <KM_prng.h>
+#include <AS_DCP.h>
+#include <openssl/sha.h>
+
+using namespace Kumu;
+
+
+//------------------------------------------------------------------------------------------
+//
+// command line option parser class
+
+static const char* PROGRAM_NAME = "asdcp-util"; // program name for messages
+
+// Increment the iterator, test for an additional non-option command line argument.
+// Causes the caller to return if there are no remaining arguments or if the next
+// argument begins with '-'.
+#define TEST_EXTRA_ARG(i,c) \
+ if ( ++i >= argc || argv[(i)][0] == '-' ) { \
+ fprintf(stderr, "Argument not found for option -%c.\n", (c)); \
+ return; \
+ }
+
+//
+void
+banner(FILE* stream = stdout)
+{
+ fprintf(stream, "\n\
+%s (asdcplib %s)\n\n\
+Copyright (c) 2003-2012 John Hurst\n\n\
+asdcplib may be copied only under the terms of the license found at\n\
+the top of every file in the asdcplib distribution kit.\n\n\
+Specify the -h (help) option for further information about %s\n\n",
+ PROGRAM_NAME, ASDCP::Version(), PROGRAM_NAME);
+}
+
+//
+void
+usage(FILE* stream = stdout)
+{
+ fprintf(stream, "\
+USAGE: %s [-h|-help] [-V]\n\
+\n\
+ %s -d <input-file>\n\
+\n\
+ %s -g | -u\n\
+\n\
+ %s -u\n\n",
+ PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME, PROGRAM_NAME);
+
+ fprintf(stream, "\
+Major modes:\n\
+ -d - Calculate message digest of input file\n\
+ -g - Generate a random 16 byte value to stdout\n\
+ -h | -help - Show help\n\
+ -u - Generate a random UUID value to stdout\n\
+ -V - Show version information\n\
+\n\
+ NOTES: o There is no option grouping, all options must be distinct arguments.\n\
+ o All option arguments must be separated from the option by whitespace.\n\n");
+}
+
+//
+enum MajorMode_t
+{
+ MMT_NONE,
+ MMT_GEN_ID,
+ MMT_GEN_KEY,
+ MMT_DIGEST,
+};
+
+//
+class CommandOptions
+{
+ CommandOptions();
+
+public:
+ MajorMode_t mode;
+ bool error_flag; // true if the given options are in error or not complete
+ bool version_flag; // true if the version display option was selected
+ bool help_flag; // true if the help display option was selected
+ PathList_t filenames; // list of filenames to be processed
+
+ //
+ CommandOptions(int argc, const char** argv) :
+ mode(MMT_NONE), error_flag(true), version_flag(false), help_flag(false)
+ {
+ for ( int i = 1; i < argc; ++i )
+ {
+
+ if ( (strcmp( argv[i], "-help") == 0) )
+ {
+ help_flag = true;
+ continue;
+ }
+
+ if ( argv[i][0] == '-'
+ && ( isalpha(argv[i][1]) || isdigit(argv[i][1]) )
+ && argv[i][2] == 0 )
+ {
+ switch ( argv[i][1] )
+ {
+ case 'd': mode = MMT_DIGEST; break;
+ case 'g': mode = MMT_GEN_KEY; break;
+ case 'h': help_flag = true; break;
+ case 'u': mode = MMT_GEN_ID; break;
+ case 'V': version_flag = true; break;
+
+ default:
+ fprintf(stderr, "Unrecognized option: %s\n", argv[i]);
+ return;
+ }
+ }
+ else
+ {
+ if ( argv[i][0] != '-' )
+ {
+ filenames.push_back(argv[i]);
+ }
+ else
+ {
+ fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);
+ return;
+ }
+ }
+ }
+
+ if ( help_flag || version_flag )
+ return;
+
+ if ( ( mode == MMT_DIGEST ) && filenames.empty() )
+ {
+ fputs("Option requires at least one filename argument.\n", stderr);
+ return;
+ }
+
+ if ( mode == MMT_NONE && ! help_flag && ! version_flag )
+ {
+ fputs("No operation selected (use one of -[dgu] or -h for help).\n", stderr);
+ return;
+ }
+
+ error_flag = false;
+ }
+};
+
+//
+Result_t
+digest_file(const std::string& filename)
+{
+ FileReader Reader;
+ SHA_CTX Ctx;
+ SHA1_Init(&Ctx);
+ ByteString Buf(8192);
+
+ Result_t result = Reader.OpenRead(filename.c_str());
+
+ while ( ASDCP_SUCCESS(result) )
+ {
+ ui32_t read_count = 0;
+ result = Reader.Read(Buf.Data(), Buf.Capacity(), &read_count);
+
+ if ( result == RESULT_ENDOFFILE )
+ {
+ result = RESULT_OK;
+ break;
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ SHA1_Update(&Ctx, Buf.Data(), read_count);
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ const ui32_t sha_len = 20;
+ byte_t bin_buf[sha_len];
+ char sha_buf[64];
+ SHA1_Final(bin_buf, &Ctx);
+
+ fprintf(stdout, "%s %s\n",
+ base64encode(bin_buf, sha_len, sha_buf, 64),
+ filename.c_str());
+ }
+
+ return result;
+}
+
+//
+int
+main(int argc, const char** argv)
+{
+ Result_t result = RESULT_OK;
+ char str_buf[64];
+ CommandOptions Options(argc, argv);
+
+ if ( Options.version_flag )
+ banner();
+
+ if ( Options.help_flag )
+ usage();
+
+ if ( Options.version_flag || Options.help_flag )
+ return 0;
+
+ if ( Options.error_flag )
+ {
+ fprintf(stderr, "There was a problem. Type %s -h for help.\n",
+ PROGRAM_NAME);
+ return 3;
+ }
+
+ if ( Options.mode == MMT_GEN_KEY )
+ {
+ Kumu::FortunaRNG RNG;
+ byte_t bin_buf[ASDCP::KeyLen];
+
+ RNG.FillRandom(bin_buf, ASDCP::KeyLen);
+ printf("%s\n", Kumu::bin2hex(bin_buf, ASDCP::KeyLen, str_buf, 64));
+ }
+ else if ( Options.mode == MMT_GEN_ID )
+ {
+ UUID TmpID;
+ Kumu::GenRandomValue(TmpID);
+ printf("%s\n", TmpID.EncodeHex(str_buf, 64));
+ }
+ else if ( Options.mode == MMT_DIGEST )
+ {
+ PathList_t::iterator i;
+
+ for ( i = Options.filenames.begin();
+ i != Options.filenames.end() && ASDCP_SUCCESS(result); ++i )
+ result = digest_file(*i);
+ }
+ else
+ {
+ fprintf(stderr, "Unhandled mode: %d.\n", Options.mode);
+ return 6;
+ }
+
+ if ( ASDCP_FAILURE(result) )
+ {
+ fputs("Program stopped on error.\n", stderr);
+
+ if ( result != RESULT_FAIL )
+ {
+ fputs(result, stderr);
+ fputc('\n', stderr);
+ }
+
+ return 1;
+ }
+
+ return 0;
+}
+
+
+//
+// end asdcp-util.cpp
+//
--- /dev/null
+/*
+Copyright (c) 2003-2012, 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 asdcp-wrap.cpp
+ \version $Id$
+ \brief AS-DCP file manipulation utility
+
+ This program wraps d-cinema essence (picture, sound or text) in t an AS-DCP
+ MXF file.
+
+ For more information about asdcplib, please refer to the header file AS_DCP.h
+
+ WARNING: While the asdcplib library attempts to provide a complete and secure
+ implementation of the cryptographic features of the AS-DCP file formats, this
+ unit test program is NOT secure and is therefore NOT SUITABLE FOR USE in a
+ production environment without some modification.
+
+ In particular, this program uses weak IV generation and externally generated
+ plaintext keys. These shortcomings exist because cryptographic-quality
+ random number generation and key management are outside the scope of the
+ asdcplib library. Developers using asdcplib for commercial implementations
+ claiming SMPTE conformance are expected to provide proper implementations of
+ these features.
+*/
+
+#include <KM_fileio.h>
+#include <KM_prng.h>
+#include <AS_DCP.h>
+#include <PCMParserList.h>
+#include <Metadata.h>
+
+using namespace ASDCP;
+
+const ui32_t FRAME_BUFFER_SIZE = 4 * Kumu::Megabyte;
+
+//------------------------------------------------------------------------------------------
+//
+// command line option parser class
+
+static const char* PROGRAM_NAME = "asdcp-wrap"; // program name for messages
+
+// local program identification info written to file headers
+class MyInfo : public WriterInfo
+{
+public:
+ MyInfo()
+ {
+ static byte_t default_ProductUUID_Data[UUIDlen] =
+ { 0x7d, 0x83, 0x6e, 0x16, 0x37, 0xc7, 0x4c, 0x22,
+ 0xb2, 0xe0, 0x46, 0xa7, 0x17, 0xe8, 0x4f, 0x42 };
+
+ memcpy(ProductUUID, default_ProductUUID_Data, UUIDlen);
+ CompanyName = "WidgetCo";
+ ProductName = "asdcp-wrap";
+ ProductVersion = ASDCP::Version();
+ }
+} s_MyInfo;
+
+
+
+// Increment the iterator, test for an additional non-option command line argument.
+// Causes the caller to return if there are no remaining arguments or if the next
+// argument begins with '-'.
+#define TEST_EXTRA_ARG(i,c) \
+ if ( ++i >= argc || argv[(i)][0] == '-' ) { \
+ fprintf(stderr, "Argument not found for option -%c.\n", (c)); \
+ return; \
+ }
+
+//
+void
+banner(FILE* stream = stdout)
+{
+ fprintf(stream, "\n\
+%s (asdcplib %s)\n\n\
+Copyright (c) 2003-2012 John Hurst\n\n\
+asdcplib may be copied only under the terms of the license found at\n\
+the top of every file in the asdcplib distribution kit.\n\n\
+Specify the -h (help) option for further information about %s\n\n",
+ PROGRAM_NAME, ASDCP::Version(), PROGRAM_NAME);
+}
+
+//
+void
+usage(FILE* stream = stdout)
+{
+ fprintf(stream, "\
+USAGE: %s [-h|-help] [-V]\n\
+\n\
+ %s [-3] [-a <uuid>] [-b <buffer-size>] [-C <UL>] [-d <duration>] [-e|-E] [-f <start-frame>] [-j <key-id-string>] [-k <key-string>] [-l <label>] [-L] [-M] [-p <frame-rate>] [-s <num>] [-v] [-W] [-z|-Z] <input-file>+ <output-file>\n\n",
+ PROGRAM_NAME, PROGRAM_NAME);
+
+ fprintf(stream, "\
+Options:\n\
+ -3 - With -c, create a stereoscopic image file. Expects two\n\
+ directories of JP2K codestreams (directories must have\n\
+ an equal number of frames; left eye is first).\n\
+ - With -x, force stereoscopic interpretation of a JP2K\n\
+ track file.\n\
+ -C <UL> - Set ChannelAssignment UL value\n\
+ -h | -help - Show help\n\
+ -V - Show version information\n\
+ -e - Encrypt MPEG or JP2K headers (default)\n\
+ -E - Do not encrypt MPEG or JP2K headers\n\
+ -j <key-id-str> - Write key ID instead of creating a random value\n\
+ -k <key-string> - Use key for ciphertext operations\n\
+ -M - Do not create HMAC values when writing\n\
+ -a <UUID> - Specify the Asset ID of a file (with -c)\n\
+ -b <buffer-size> - Specify size in bytes of picture frame buffer.\n\
+ Defaults to 4,194,304 (4MB)\n\
+ -d <duration> - Number of frames to process, default all\n\
+ -f <start-frame> - Starting frame number, default 0\n\
+ -l <label> - Use given channel format label when writing MXF sound\n\
+ files. SMPTE 429-2 labels: '5.1', '6.1', '7.1', '7.1DS', 'WTF'.\n\
+ Default is no label (valid for Interop only).\n\
+ -L - Write SMPTE UL values instead of MXF Interop\n\
+ -p <rate> - fps of picture when wrapping PCM or JP2K:\n\
+ Use one of [23|24|25|30|48|50|60], 24 is default\n\
+ -v - Verbose, prints informative messages to stderr\n\
+ -W - Read input file only, do not write source file\n\
+ -z - Fail if j2c inputs have unequal parameters (default)\n\
+ -Z - Ignore unequal parameters in j2c inputs\n\
+\n\
+ NOTES: o There is no option grouping, all options must be distinct arguments.\n\
+ o All option arguments must be separated from the option by whitespace.\n\
+ o An argument of \"23\" to the -p option will be interpreted\n\
+ as 24000/1001 fps.\n\
+\n");
+}
+
+//
+PCM::ChannelFormat_t
+decode_channel_fmt(const std::string& label_name)
+{
+ if ( label_name == "5.1" )
+ return PCM::CF_CFG_1;
+
+ else if ( label_name == "6.1" )
+ return PCM::CF_CFG_2;
+
+ else if ( label_name == "7.1" )
+ return PCM::CF_CFG_3;
+
+ else if ( label_name == "WTF" )
+ return PCM::CF_CFG_4;
+
+ else if ( label_name == "7.1DS" )
+ return PCM::CF_CFG_5;
+
+ fprintf(stderr, "Error decoding channel format string: %s\n", label_name.c_str());
+ fprintf(stderr, "Expecting '5.1', '6.1', '7.1', '7.1DS' or 'WTF'\n");
+ return PCM::CF_NONE;
+}
+
+//
+//
+class CommandOptions
+{
+ CommandOptions();
+
+public:
+ bool error_flag; // true if the given options are in error or not complete
+ bool key_flag; // true if an encryption key was given
+ bool asset_id_flag; // true if an asset ID was given
+ bool encrypt_header_flag; // true if mpeg headers are to be encrypted
+ bool write_hmac; // true if HMAC values are to be generated and written
+ /// bool read_hmac; // true if HMAC values are to be validated
+ /// bool split_wav; // true if PCM is to be extracted to stereo WAV files
+ /// bool mono_wav; // true if PCM is to be extracted to mono WAV files
+ bool verbose_flag; // true if the verbose option was selected
+ ui32_t fb_dump_size; // number of bytes of frame buffer to dump
+ /// bool showindex_flag; // true if index is to be displayed
+ /// bool showheader_flag; // true if MXF file header is to be displayed
+ bool no_write_flag; // true if no output files are to be written
+ bool version_flag; // true if the version display option was selected
+ bool help_flag; // true if the help display option was selected
+ bool stereo_image_flag; // if true, expect stereoscopic JP2K input (left eye first)
+ /// ui32_t number_width; // number of digits in a serialized filename (for JPEG extract)
+ ui32_t start_frame; // frame number to begin processing
+ ui32_t duration; // number of frames to be processed
+ bool use_smpte_labels; // if true, SMPTE UL values will be written instead of MXF Interop values
+ bool j2c_pedantic; // passed to JP2K::SequenceParser::OpenRead
+ ui32_t picture_rate; // fps of picture when wrapping PCM
+ ui32_t fb_size; // size of picture frame buffer
+ byte_t key_value[KeyLen]; // value of given encryption key (when key_flag is true)
+ bool key_id_flag; // true if a key ID was given
+ byte_t key_id_value[UUIDlen];// value of given key ID (when key_id_flag is true)
+ byte_t asset_id_value[UUIDlen];// value of asset ID (when asset_id_flag is true)
+ PCM::ChannelFormat_t channel_fmt; // audio channel arrangement
+ std::string out_file; //
+ bool show_ul_values; /// if true, dump the UL table before going tp work.
+ Kumu::PathList_t filenames; // list of filenames to be processed
+ UL channel_assignment;
+
+ //
+ Rational PictureRate()
+ {
+ if ( picture_rate == 23 ) return EditRate_23_98;
+ if ( picture_rate == 24 ) return EditRate_24;
+ if ( picture_rate == 25 ) return EditRate_25;
+ if ( picture_rate == 30 ) return EditRate_30;
+ if ( picture_rate == 48 ) return EditRate_48;
+ if ( picture_rate == 50 ) return EditRate_50;
+ if ( picture_rate == 60 ) return EditRate_60;
+ if ( picture_rate == 96 ) return EditRate_96;
+ if ( picture_rate == 100 ) return EditRate_100;
+ if ( picture_rate == 120 ) return EditRate_120;
+ return EditRate_24;
+ }
+
+ //
+ const char* szPictureRate()
+ {
+ if ( picture_rate == 23 ) return "23.976";
+ if ( picture_rate == 24 ) return "24";
+ if ( picture_rate == 25 ) return "25";
+ if ( picture_rate == 30 ) return "30";
+ if ( picture_rate == 48 ) return "48";
+ if ( picture_rate == 50 ) return "50";
+ if ( picture_rate == 60 ) return "60";
+ if ( picture_rate == 96 ) return "96";
+ if ( picture_rate == 100 ) return "100";
+ if ( picture_rate == 120 ) return "120";
+ return "24";
+ }
+
+ //
+ CommandOptions(int argc, const char** argv) :
+ error_flag(true), key_flag(false), key_id_flag(false), asset_id_flag(false),
+ encrypt_header_flag(true), write_hmac(true),
+ verbose_flag(false), fb_dump_size(0),
+ no_write_flag(false), version_flag(false), help_flag(false), stereo_image_flag(false),
+ start_frame(0),
+ duration(0xffffffff), use_smpte_labels(false), j2c_pedantic(true),
+ fb_size(FRAME_BUFFER_SIZE),
+ channel_fmt(PCM::CF_NONE),
+ show_ul_values(false)
+ {
+ memset(key_value, 0, KeyLen);
+ memset(key_id_value, 0, UUIDlen);
+
+ for ( int i = 1; i < argc; i++ )
+ {
+
+ if ( (strcmp( argv[i], "-help") == 0) )
+ {
+ help_flag = true;
+ continue;
+ }
+
+ if ( argv[i][0] == '-'
+ && ( isalpha(argv[i][1]) || isdigit(argv[i][1]) )
+ && argv[i][2] == 0 )
+ {
+ switch ( argv[i][1] )
+ {
+ case '3': stereo_image_flag = true; break;
+
+ case 'a':
+ asset_id_flag = true;
+ TEST_EXTRA_ARG(i, 'a');
+ {
+ ui32_t length;
+ Kumu::hex2bin(argv[i], asset_id_value, UUIDlen, &length);
+
+ if ( length != UUIDlen )
+ {
+ fprintf(stderr, "Unexpected asset ID length: %u, expecting %u characters.\n", length, UUIDlen);
+ return;
+ }
+ }
+ break;
+
+ case 'b':
+ TEST_EXTRA_ARG(i, 'b');
+ fb_size = abs(atoi(argv[i]));
+
+ if ( verbose_flag )
+ fprintf(stderr, "Frame Buffer size: %u bytes.\n", fb_size);
+
+ break;
+
+ case 'd':
+ TEST_EXTRA_ARG(i, 'd');
+ duration = abs(atoi(argv[i]));
+ break;
+
+ case 'E': encrypt_header_flag = false; break;
+ case 'e': encrypt_header_flag = true; break;
+
+ case 'f':
+ TEST_EXTRA_ARG(i, 'f');
+ start_frame = abs(atoi(argv[i]));
+ break;
+
+ case 'h': help_flag = true; break;
+
+ case 'j': key_id_flag = true;
+ TEST_EXTRA_ARG(i, 'j');
+ {
+ ui32_t length;
+ Kumu::hex2bin(argv[i], key_id_value, UUIDlen, &length);
+
+ if ( length != UUIDlen )
+ {
+ fprintf(stderr, "Unexpected key ID length: %u, expecting %u characters.\n", length, UUIDlen);
+ return;
+ }
+ }
+ break;
+
+ case 'k': key_flag = true;
+ TEST_EXTRA_ARG(i, 'k');
+ {
+ ui32_t length;
+ Kumu::hex2bin(argv[i], key_value, KeyLen, &length);
+
+ if ( length != KeyLen )
+ {
+ fprintf(stderr, "Unexpected key length: %u, expecting %u characters.\n", length, KeyLen);
+ return;
+ }
+ }
+ break;
+
+ case 'l':
+ TEST_EXTRA_ARG(i, 'l');
+ channel_fmt = decode_channel_fmt(argv[i]);
+ break;
+
+ case 'L': use_smpte_labels = true; break;
+ case 'M': write_hmac = false; break;
+
+ case 'p':
+ TEST_EXTRA_ARG(i, 'p');
+ picture_rate = abs(atoi(argv[i]));
+ break;
+
+ case 'U':
+ TEST_EXTRA_ARG(i, 'U');
+ if ( ! channel_assignment.DecodeHex(argv[i]) )
+ {
+ fprintf(stderr, "Error decoding UL value: %s\n", argv[i]);
+ return;
+ }
+ break;
+
+ case 'V': version_flag = true; break;
+ case 'v': verbose_flag = true; break;
+ case 'W': no_write_flag = true; break;
+ case 'Z': j2c_pedantic = false; break;
+ case 'z': j2c_pedantic = true; break;
+
+ default:
+ fprintf(stderr, "Unrecognized option: %s\n", argv[i]);
+ return;
+ }
+ }
+ else
+ {
+
+ if ( argv[i][0] != '-' )
+ {
+ filenames.push_back(argv[i]);
+ }
+ else
+ {
+ fprintf(stderr, "Unrecognized argument: %s\n", argv[i]);
+ return;
+ }
+ }
+ }
+
+ if ( help_flag || version_flag )
+ return;
+
+ if ( filenames.size() < 2 )
+ {
+ fputs("Option requires at least two filename arguments: <input-file> <output-file>\n", stderr);
+ return;
+ }
+
+ out_file = filenames.back();
+ filenames.pop_back();
+ error_flag = false;
+ }
+};
+
+//------------------------------------------------------------------------------------------
+// MPEG2 essence
+
+// Write a plaintext MPEG2 Video Elementary Stream to a plaintext ASDCP file
+// Write a plaintext MPEG2 Video Elementary Stream to a ciphertext ASDCP file
+//
+Result_t
+write_MPEG2_file(CommandOptions& Options)
+{
+ AESEncContext* Context = 0;
+ HMACContext* HMAC = 0;
+ MPEG2::FrameBuffer FrameBuffer(Options.fb_size);
+ MPEG2::Parser Parser;
+ MPEG2::MXFWriter Writer;
+ MPEG2::VideoDescriptor VDesc;
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
+
+ // set up essence parser
+ Result_t result = Parser.OpenRead(Options.filenames.front().c_str());
+
+ // set up MXF writer
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Parser.FillVideoDescriptor(VDesc);
+
+ if ( Options.verbose_flag )
+ {
+ fputs("MPEG-2 Pictures\n", stderr);
+ fputs("VideoDescriptor:\n", stderr);
+ fprintf(stderr, "Frame Buffer size: %u\n", Options.fb_size);
+ MPEG2::VideoDescriptorDump(VDesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ {
+ WriterInfo Info = s_MyInfo; // fill in your favorite identifiers here
+ if ( Options.asset_id_flag )
+ memcpy(Info.AssetUUID, Options.asset_id_value, UUIDlen);
+ else
+ Kumu::GenRandomUUID(Info.AssetUUID);
+
+ if ( Options.use_smpte_labels )
+ {
+ Info.LabelSetType = LS_MXF_SMPTE;
+ fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n");
+ }
+
+ // configure encryption
+ if( Options.key_flag )
+ {
+ Kumu::GenRandomUUID(Info.ContextID);
+ Info.EncryptedEssence = true;
+
+ if ( Options.key_id_flag )
+ memcpy(Info.CryptographicKeyID, Options.key_id_value, UUIDlen);
+ else
+ RNG.FillRandom(Info.CryptographicKeyID, UUIDlen);
+
+ Context = new AESEncContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+
+ if ( ASDCP_SUCCESS(result) && Options.write_hmac )
+ {
+ Info.UsesHMAC = true;
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.OpenWrite(Options.out_file.c_str(), Info, VDesc);
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ // loop through the frames
+ {
+ result = Parser.Reset();
+ ui32_t duration = 0;
+
+ while ( ASDCP_SUCCESS(result) && duration++ < Options.duration )
+ {
+ if ( duration == 1 )
+ {
+ result = Parser.ReadFrame(FrameBuffer);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ if ( Options.encrypt_header_flag )
+ FrameBuffer.PlaintextOffset(0);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ {
+ result = Writer.WriteFrame(FrameBuffer, Context, HMAC);
+
+ // The Writer class will forward the last block of ciphertext
+ // to the encryption context for use as the IV for the next
+ // frame. If you want to use non-sequitur IV values, un-comment
+ // the following line of code.
+ // if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ // Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+ }
+ }
+
+ if ( result == RESULT_ENDOFFILE )
+ result = RESULT_OK;
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ result = Writer.Finalize();
+
+ return result;
+}
+
+
+//------------------------------------------------------------------------------------------
+// JPEG 2000 essence
+
+// Write one or more plaintext JPEG 2000 stereoscopic codestream pairs to a plaintext ASDCP file
+// Write one or more plaintext JPEG 2000 stereoscopic codestream pairs to a ciphertext ASDCP file
+//
+Result_t
+write_JP2K_S_file(CommandOptions& Options)
+{
+ AESEncContext* Context = 0;
+ HMACContext* HMAC = 0;
+ JP2K::MXFSWriter Writer;
+ JP2K::FrameBuffer FrameBuffer(Options.fb_size);
+ JP2K::PictureDescriptor PDesc;
+ JP2K::SequenceParser ParserLeft, ParserRight;
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
+
+ if ( Options.filenames.size() != 2 )
+ {
+ fprintf(stderr, "Two inputs are required for stereoscopic option.\n");
+ return RESULT_FAIL;
+ }
+
+ // set up essence parser
+ Result_t result = ParserLeft.OpenRead(Options.filenames.front().c_str(), Options.j2c_pedantic);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Options.filenames.pop_front();
+ result = ParserRight.OpenRead(Options.filenames.front().c_str(), Options.j2c_pedantic);
+ }
+
+ // set up MXF writer
+ if ( ASDCP_SUCCESS(result) )
+ {
+ ParserLeft.FillPictureDescriptor(PDesc);
+ PDesc.EditRate = Options.PictureRate();
+
+ if ( Options.verbose_flag )
+ {
+ fputs("JPEG 2000 stereoscopic pictures\nPictureDescriptor:\n", stderr);
+ fprintf(stderr, "Frame Buffer size: %u\n", Options.fb_size);
+ JP2K::PictureDescriptorDump(PDesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ {
+ WriterInfo Info = s_MyInfo; // fill in your favorite identifiers here
+ if ( Options.asset_id_flag )
+ memcpy(Info.AssetUUID, Options.asset_id_value, UUIDlen);
+ else
+ Kumu::GenRandomUUID(Info.AssetUUID);
+
+ if ( Options.use_smpte_labels )
+ {
+ Info.LabelSetType = LS_MXF_SMPTE;
+ fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n");
+ }
+
+ // configure encryption
+ if( Options.key_flag )
+ {
+ Kumu::GenRandomUUID(Info.ContextID);
+ Info.EncryptedEssence = true;
+
+ if ( Options.key_id_flag )
+ memcpy(Info.CryptographicKeyID, Options.key_id_value, UUIDlen);
+ else
+ RNG.FillRandom(Info.CryptographicKeyID, UUIDlen);
+
+ Context = new AESEncContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+
+ if ( ASDCP_SUCCESS(result) && Options.write_hmac )
+ {
+ Info.UsesHMAC = true;
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.OpenWrite(Options.out_file.c_str(), Info, PDesc);
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ ui32_t duration = 0;
+ result = ParserLeft.Reset();
+ if ( ASDCP_SUCCESS(result) ) result = ParserRight.Reset();
+
+ while ( ASDCP_SUCCESS(result) && duration++ < Options.duration )
+ {
+ result = ParserLeft.ReadFrame(FrameBuffer);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ if ( Options.encrypt_header_flag )
+ FrameBuffer.PlaintextOffset(0);
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ result = Writer.WriteFrame(FrameBuffer, JP2K::SP_LEFT, Context, HMAC);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = ParserRight.ReadFrame(FrameBuffer);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ if ( Options.encrypt_header_flag )
+ FrameBuffer.PlaintextOffset(0);
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ result = Writer.WriteFrame(FrameBuffer, JP2K::SP_RIGHT, Context, HMAC);
+ }
+
+ if ( result == RESULT_ENDOFFILE )
+ result = RESULT_OK;
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ result = Writer.Finalize();
+
+ return result;
+}
+
+// Write one or more plaintext JPEG 2000 codestreams to a plaintext ASDCP file
+// Write one or more plaintext JPEG 2000 codestreams to a ciphertext ASDCP file
+//
+Result_t
+write_JP2K_file(CommandOptions& Options)
+{
+ AESEncContext* Context = 0;
+ HMACContext* HMAC = 0;
+ JP2K::MXFWriter Writer;
+ JP2K::FrameBuffer FrameBuffer(Options.fb_size);
+ JP2K::PictureDescriptor PDesc;
+ JP2K::SequenceParser Parser;
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
+
+ // set up essence parser
+ Result_t result = Parser.OpenRead(Options.filenames.front().c_str(), Options.j2c_pedantic);
+
+ // set up MXF writer
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Parser.FillPictureDescriptor(PDesc);
+ PDesc.EditRate = Options.PictureRate();
+
+ if ( Options.verbose_flag )
+ {
+ fprintf(stderr, "JPEG 2000 pictures\n");
+ fputs("PictureDescriptor:\n", stderr);
+ fprintf(stderr, "Frame Buffer size: %u\n", Options.fb_size);
+ JP2K::PictureDescriptorDump(PDesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ {
+ WriterInfo Info = s_MyInfo; // fill in your favorite identifiers here
+ if ( Options.asset_id_flag )
+ memcpy(Info.AssetUUID, Options.asset_id_value, UUIDlen);
+ else
+ Kumu::GenRandomUUID(Info.AssetUUID);
+
+ if ( Options.use_smpte_labels )
+ {
+ Info.LabelSetType = LS_MXF_SMPTE;
+ fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n");
+ }
+
+ // configure encryption
+ if( Options.key_flag )
+ {
+ Kumu::GenRandomUUID(Info.ContextID);
+ Info.EncryptedEssence = true;
+
+ if ( Options.key_id_flag )
+ memcpy(Info.CryptographicKeyID, Options.key_id_value, UUIDlen);
+ else
+ RNG.FillRandom(Info.CryptographicKeyID, UUIDlen);
+
+ Context = new AESEncContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+
+ if ( ASDCP_SUCCESS(result) && Options.write_hmac )
+ {
+ Info.UsesHMAC = true;
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.OpenWrite(Options.out_file.c_str(), Info, PDesc);
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ ui32_t duration = 0;
+ result = Parser.Reset();
+
+ while ( ASDCP_SUCCESS(result) && duration++ < Options.duration )
+ {
+ if ( duration == 1 )
+ {
+ result = Parser.ReadFrame(FrameBuffer);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ if ( Options.encrypt_header_flag )
+ FrameBuffer.PlaintextOffset(0);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ {
+ result = Writer.WriteFrame(FrameBuffer, Context, HMAC);
+
+ // The Writer class will forward the last block of ciphertext
+ // to the encryption context for use as the IV for the next
+ // frame. If you want to use non-sequitur IV values, un-comment
+ // the following line of code.
+ // if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ // Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+ }
+ }
+
+ if ( result == RESULT_ENDOFFILE )
+ result = RESULT_OK;
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ result = Writer.Finalize();
+
+ return result;
+}
+
+//------------------------------------------------------------------------------------------
+// PCM essence
+
+
+// Write one or more plaintext PCM audio streams to a plaintext ASDCP file
+// Write one or more plaintext PCM audio streams to a ciphertext ASDCP file
+//
+Result_t
+write_PCM_file(CommandOptions& Options)
+{
+ AESEncContext* Context = 0;
+ HMACContext* HMAC = 0;
+ PCMParserList Parser;
+ PCM::MXFWriter Writer;
+ PCM::FrameBuffer FrameBuffer;
+ PCM::AudioDescriptor ADesc;
+ Rational PictureRate = Options.PictureRate();
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
+
+ // set up essence parser
+ Result_t result = Parser.OpenRead(Options.filenames, PictureRate);
+
+ // set up MXF writer
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Parser.FillAudioDescriptor(ADesc);
+
+ ADesc.EditRate = PictureRate;
+ FrameBuffer.Capacity(PCM::CalcFrameBufferSize(ADesc));
+ ADesc.ChannelFormat = Options.channel_fmt;
+
+ if ( Options.use_smpte_labels && ADesc.ChannelFormat == PCM::CF_NONE)
+ {
+ fprintf(stderr, "ATTENTION! Writing SMPTE audio without ChannelAssignment property (see option -l)\n");
+ }
+
+ if ( Options.verbose_flag )
+ {
+ fprintf(stderr, "%.1fkHz PCM Audio, %s fps (%u spf)\n",
+ ADesc.AudioSamplingRate.Quotient() / 1000.0,
+ Options.szPictureRate(),
+ PCM::CalcSamplesPerFrame(ADesc));
+ fputs("AudioDescriptor:\n", stderr);
+ PCM::AudioDescriptorDump(ADesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ {
+ WriterInfo Info = s_MyInfo; // fill in your favorite identifiers here
+ if ( Options.asset_id_flag )
+ memcpy(Info.AssetUUID, Options.asset_id_value, UUIDlen);
+ else
+ Kumu::GenRandomUUID(Info.AssetUUID);
+
+ if ( Options.use_smpte_labels )
+ {
+ Info.LabelSetType = LS_MXF_SMPTE;
+ fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n");
+ }
+
+ // configure encryption
+ if( Options.key_flag )
+ {
+ Kumu::GenRandomUUID(Info.ContextID);
+ Info.EncryptedEssence = true;
+
+ if ( Options.key_id_flag )
+ memcpy(Info.CryptographicKeyID, Options.key_id_value, UUIDlen);
+ else
+ RNG.FillRandom(Info.CryptographicKeyID, UUIDlen);
+
+ Context = new AESEncContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+
+ if ( ASDCP_SUCCESS(result) && Options.write_hmac )
+ {
+ Info.UsesHMAC = true;
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.OpenWrite(Options.out_file.c_str(), Info, ADesc);
+
+ if ( ASDCP_SUCCESS(result) && Options.channel_assignment.HasValue() )
+ {
+ MXF::WaveAudioDescriptor *descriptor = 0;
+ Writer.OPAtomHeader().GetMDObjectByType(DefaultSMPTEDict().ul(MDD_WaveAudioDescriptor),
+ reinterpret_cast<MXF::InterchangeObject**>(&descriptor));
+ descriptor->ChannelAssignment = Options.channel_assignment;
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ result = Parser.Reset();
+ ui32_t duration = 0;
+
+ while ( ASDCP_SUCCESS(result) && duration++ < Options.duration )
+ {
+ result = Parser.ReadFrame(FrameBuffer);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( FrameBuffer.Size() != FrameBuffer.Capacity() )
+ {
+ fprintf(stderr, "WARNING: Last frame read was short, PCM input is possibly not frame aligned.\n");
+ fprintf(stderr, "Expecting %u bytes, got %u.\n", FrameBuffer.Capacity(), FrameBuffer.Size());
+ result = RESULT_ENDOFFILE;
+ continue;
+ }
+
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ if ( ! Options.no_write_flag )
+ {
+ result = Writer.WriteFrame(FrameBuffer, Context, HMAC);
+
+ // The Writer class will forward the last block of ciphertext
+ // to the encryption context for use as the IV for the next
+ // frame. If you want to use non-sequitur IV values, un-comment
+ // the following line of code.
+ // if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ // Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+ }
+ }
+ }
+
+ if ( result == RESULT_ENDOFFILE )
+ result = RESULT_OK;
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ result = Writer.Finalize();
+
+ return result;
+}
+
+
+//------------------------------------------------------------------------------------------
+// TimedText essence
+
+
+// Write one or more plaintext timed text streams to a plaintext ASDCP file
+// Write one or more plaintext timed text streams to a ciphertext ASDCP file
+//
+Result_t
+write_timed_text_file(CommandOptions& Options)
+{
+ AESEncContext* Context = 0;
+ HMACContext* HMAC = 0;
+ TimedText::DCSubtitleParser Parser;
+ TimedText::MXFWriter Writer;
+ TimedText::FrameBuffer FrameBuffer;
+ TimedText::TimedTextDescriptor TDesc;
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
+
+ // set up essence parser
+ Result_t result = Parser.OpenRead(Options.filenames.front().c_str());
+
+ // set up MXF writer
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Parser.FillTimedTextDescriptor(TDesc);
+ FrameBuffer.Capacity(Options.fb_size);
+
+ if ( Options.verbose_flag )
+ {
+ fputs("D-Cinema Timed-Text Descriptor:\n", stderr);
+ TimedText::DescriptorDump(TDesc);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ {
+ WriterInfo Info = s_MyInfo; // fill in your favorite identifiers here
+ if ( Options.asset_id_flag )
+ memcpy(Info.AssetUUID, Options.asset_id_value, UUIDlen);
+ else
+ Kumu::GenRandomUUID(Info.AssetUUID);
+
+ if ( Options.use_smpte_labels )
+ {
+ Info.LabelSetType = LS_MXF_SMPTE;
+ fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n");
+ }
+
+ // configure encryption
+ if( Options.key_flag )
+ {
+ Kumu::GenRandomUUID(Info.ContextID);
+ Info.EncryptedEssence = true;
+
+ if ( Options.key_id_flag )
+ memcpy(Info.CryptographicKeyID, Options.key_id_value, UUIDlen);
+ else
+ RNG.FillRandom(Info.CryptographicKeyID, UUIDlen);
+
+ Context = new AESEncContext;
+ result = Context->InitKey(Options.key_value);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+
+ if ( ASDCP_SUCCESS(result) && Options.write_hmac )
+ {
+ Info.UsesHMAC = true;
+ HMAC = new HMACContext;
+ result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.OpenWrite(Options.out_file.c_str(), Info, TDesc);
+ }
+
+ if ( ASDCP_FAILURE(result) )
+ return result;
+
+ std::string XMLDoc;
+ TimedText::ResourceList_t::const_iterator ri;
+
+ result = Parser.ReadTimedTextResource(XMLDoc);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.WriteTimedTextResource(XMLDoc, Context, HMAC);
+
+ for ( ri = TDesc.ResourceList.begin() ; ri != TDesc.ResourceList.end() && ASDCP_SUCCESS(result); ri++ )
+ {
+ result = Parser.ReadAncillaryResource((*ri).ResourceID, FrameBuffer);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ if ( ! Options.no_write_flag )
+ {
+ result = Writer.WriteAncillaryResource(FrameBuffer, Context, HMAC);
+
+ // The Writer class will forward the last block of ciphertext
+ // to the encryption context for use as the IV for the next
+ // frame. If you want to use non-sequitur IV values, un-comment
+ // the following line of code.
+ // if ( ASDCP_SUCCESS(result) && Options.key_flag )
+ // Context->SetIVec(RNG.FillRandom(IV_buf, CBC_BLOCK_SIZE));
+ }
+ }
+
+ if ( result == RESULT_ENDOFFILE )
+ result = RESULT_OK;
+ }
+
+ if ( ASDCP_SUCCESS(result) && ! Options.no_write_flag )
+ result = Writer.Finalize();
+
+ return result;
+}
+
+//
+int
+main(int argc, const char** argv)
+{
+ Result_t result = RESULT_OK;
+ char str_buf[64];
+ CommandOptions Options(argc, argv);
+
+ if ( Options.version_flag )
+ banner();
+
+ if ( Options.help_flag )
+ usage();
+
+ if ( Options.version_flag || Options.help_flag )
+ return 0;
+
+ if ( Options.error_flag )
+ {
+ fprintf(stderr, "There was a problem. Type %s -h for help.\n", PROGRAM_NAME);
+ return 3;
+ }
+
+ if ( Options.show_ul_values )
+ {
+ if ( Options.use_smpte_labels )
+ DefaultSMPTEDict().Dump(stdout);
+ else
+ DefaultInteropDict().Dump(stdout);
+ }
+
+ EssenceType_t EssenceType;
+ result = ASDCP::RawEssenceType(Options.filenames.front().c_str(), EssenceType);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ switch ( EssenceType )
+ {
+ case ESS_MPEG2_VES:
+ result = write_MPEG2_file(Options);
+ break;
+
+ case ESS_JPEG_2000:
+ if ( Options.stereo_image_flag )
+ {
+ result = write_JP2K_S_file(Options);
+ }
+ else
+ {
+ result = write_JP2K_file(Options);
+ }
+ break;
+
+ case ESS_PCM_24b_48k:
+ case ESS_PCM_24b_96k:
+ result = write_PCM_file(Options);
+ break;
+
+ case ESS_TIMED_TEXT:
+ result = write_timed_text_file(Options);
+ break;
+
+ default:
+ fprintf(stderr, "%s: Unknown file type, not ASDCP-compatible essence.\n",
+ Options.filenames.front().c_str());
+ return 5;
+ }
+ }
+
+ if ( ASDCP_FAILURE(result) )
+ {
+ fputs("Program stopped on error.\n", stderr);
+
+ if ( result != RESULT_FAIL )
+ {
+ fputs(result, stderr);
+ fputc('\n', stderr);
+ }
+
+ return 1;
+ }
+
+ return 0;
+}
+
+
+//
+// end asdcp-wrap.cpp
+//