release
authorjhurst <jhurst@cinecert.com>
Tue, 10 Nov 2015 19:40:55 +0000 (19:40 +0000)
committerjhurst <>
Tue, 10 Nov 2015 19:40:55 +0000 (19:40 +0000)
20 files changed:
README
configure.ac
src/KLV.cpp
src/KM_error.h
src/KM_util.cpp
src/KM_util.h
src/MXF.cpp
src/MXF.h
src/MXFTypes.cpp
src/MXFTypes.h
src/Metadata.cpp
src/Metadata.h
src/TimedText_Parser.cpp
src/as-02-wrap.cpp
src/asdcp-wrap.cpp
src/blackwave.cpp
src/h__02_Reader.cpp
src/kmfilegen.cpp
src/phdr-wrap.cpp
win32/Makefile.mak

diff --git a/README b/README
index c1a44f04036272db905937596f920e96dcb1837d..7b717a151a590cf829f005733cdb928bd63c6916 100755 (executable)
--- a/README
+++ b/README
@@ -151,6 +151,35 @@ command-line utilities all respond to -h.
 
 Change History
 
+2015-11-10 - bug fixes, IMF text, pink noise
+ o I moved personal dev environment from older gcc to newer clang.  Many
+   small changes were made to satisfy the new compiler:
+   - Altered many printf format codes to use the correct format for the
+     given integer type.
+   - Parenthesized some expressions to clarify previously ambiguous
+     expectation about precedence.
+   - Created macro KM_MACOSX for use in OS-specific code selection.
+   - Removed last uses of the old C-language abs(), now using Kumu::xabs().
+   - Removed last uses of the old C-language atoi(), not using strtol().
+ o Added platform-independent call Kumu::GetExecutablePath() (to be tested
+   on win32).
+ o Added new capabilities to Result_t.
+ o Added imlementation of SMPTE ST 2092-1 pink noise generator.
+ o Added pinkwave CLI utility.
+ o Added font support to the IMF timed-text wrapper.
+ o Fixed a bug that was causing Array properties to be written without
+   the (count, length) header (from PAL).
+ o General review of Batch/Array distinction throughout the project.
+ o Cleaned up definitions of optional properties in all MXF metadata packs.
+ o Fixed Win32 build (from Crowe).
+ o Fixed a bug that caused incorrect failure when parsing JPEG 2000
+   codestreams having fewer than five decomposition levels. (from Korneder).
+ o Fixed missing UUID generation in some instances of the MCALinkID property.
+ o Added -w option to asdcp-wrap to support use of WTF label with MCA.
+ o Altered asdcp-wrap to recognize "-C <UL>" when MCA is being used.
+ o Fixed broken -A <w>/<h> option in as-02-wrap and phdr-wrap.
+ o asdcp-wrap and as-02-wrap now allow split channel groups in MCA labels.
+
 
 2015-02-23 - bug fixes
   o Fixed a new bug introduced by the fix to large numbers of subtitle ancillary
index e7411e982be51b1b23f24dea6e6224f614ac2102..b5b02ff217cb98680f2db32ecfdf7321de5f6e6f 100644 (file)
@@ -37,7 +37,7 @@ AC_PREREQ([2.59])
 # 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], [2.4.10], [asdcplib@cinecert.com])
+AC_INIT([asdcplib], [2.5.11rc1], [asdcplib@cinecert.com])
 
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/KM_error.h])
index f78f3ead018a90b743fe5111620eb6c6a72693d3..24a90a597d25d4b72ee0ffcd41f8f68e403567f3 100755 (executable)
@@ -94,19 +94,20 @@ ASDCP::KLVPacket::InitFromBuffer(const byte_t* buf, ui32_t buf_len)
 
   if ( ber_len > ( buf_len - SMPTE_UL_LENGTH ) )
     {
-      DefaultLogSink().Error("BER encoding length exceeds buffer size\n");
+      DefaultLogSink().Error("BER encoding length exceeds buffer size.\n");
       return RESULT_FAIL;
     }
 
   if ( ber_len == 0 )
     {
-      DefaultLogSink().Error("KLV format error, zero BER length not allowed\n");
+      DefaultLogSink().Error("KLV format error, zero BER length not allowed.\n");
       return RESULT_FAIL;
     }
 
   ui64_t tmp_size;
   if ( ! Kumu::read_BER(buf + SMPTE_UL_LENGTH, &tmp_size) )
     {
+      DefaultLogSink().Error("KLV format error, BER decode failure.\n");
       return RESULT_FAIL;
     }
 
index 77a0846af9dccd41d47777c76e1e0c694316a864..8270cc0a5c7581399b9f421265dbdbfb9df264c7 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2004-2014, John Hurst
+Copyright (c) 2004-2015, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef _KM_ERROR_H_
 #define _KM_ERROR_H_
 
+#include <string>
+
 #define KM_DECLARE_RESULT(sym, i, l) const Result_t RESULT_##sym = Result_t(i, #sym, l);
 
 namespace Kumu
@@ -46,8 +48,7 @@ namespace Kumu
   class Result_t
     {
       int value;
-      const char* label;
-      const char* symbol;
+      std::string label, symbol, message;
       Result_t();
 
     public:
@@ -65,21 +66,26 @@ namespace Kumu
       static unsigned int End();
       static const Result_t& Get(unsigned int);
 
-      Result_t(int v, const char* s, const char* l);
+      Result_t(int v, const std::string& s, const std::string& l);
+      Result_t(const Result_t& rhs);
+      const Result_t& operator=(const Result_t& rhs);
       ~Result_t();
 
+      const Result_t operator()(const std::string& message) const;
+      const Result_t operator()(const int& line, const char* filename) const;
+      const Result_t operator()(const std::string& message, const int& line, const char* filename) const;
+
       inline bool        operator==(const Result_t& rhs) const { return value == rhs.value; }
       inline bool        operator!=(const Result_t& rhs) const { return value != rhs.value; }
-      inline bool        Success() const { return ( value >= 0 ); }
+      inline bool        Success() const { return ! ( value < 0 ); }
       inline bool        Failure() const { return ( value < 0 ); }
 
       inline int         Value() const { return value; }
       inline operator    int() const { return value; }
-
-      inline const char* Label() const { return label; }
-      inline operator    const char*() const { return label; }
-
-      inline const char* Symbol() const { return symbol; }
+      inline const char* Label() const { return label.c_str(); }
+      inline operator    const char*() const { return label.c_str(); }
+      inline const char* Symbol() const { return symbol.c_str(); }
+      inline const char* Message() const { return message.c_str(); }
     };
 
   KM_DECLARE_RESULT(FALSE,       1,   "Successful but not true.");
@@ -122,7 +128,7 @@ namespace Kumu
 // See Result_t above for an explanation of RESULT_* symbols.
 # define KM_TEST_NULL(p) \
   if ( (p) == 0  ) { \
-    return Kumu::RESULT_PTR; \
+    return Kumu::RESULT_PTR(__LINE__, __FILE__); \
   }
 
 // Returns RESULT_PTR if the given argument is NULL. See Result_t
@@ -133,7 +139,7 @@ namespace Kumu
 # define KM_TEST_NULL_STR(p) \
   KM_TEST_NULL(p); \
   if ( (p)[0] == '\0' ) { \
-    return Kumu::RESULT_NULL_STR; \
+    return Kumu::RESULT_NULL_STR(__LINE__, __FILE__); \
   }
 
 // RESULT_STATE is ambiguous.  Use these everywhere it is assigned to provide some context
index 2ccf9e9a34ca2c79ac256312fec758273d7a3832..d263d6e47bcfd416b30ddf71a164a594a78890cf 100755 (executable)
@@ -129,10 +129,10 @@ Kumu::Result_t::Get(unsigned int i)
 }
 
 //
-Kumu::Result_t::Result_t(int v, const char* s, const char* l) : value(v), symbol(s), label(l)
+Kumu::Result_t::Result_t(int v, const std::string& s, const std::string& l) : value(v), symbol(s), label(l)
 {
-  assert(l);
-  assert(s);
+  assert(!l.empty());
+  assert(!s.empty());
 
   if ( v == 0 )
     return;
@@ -162,8 +162,65 @@ Kumu::Result_t::Result_t(int v, const char* s, const char* l) : value(v), symbol
   return;
 }
 
+
+Kumu::Result_t::Result_t(const Result_t& rhs)
+{
+  value = rhs.value;
+  symbol = rhs.symbol;
+  label = rhs.label;
+  message = rhs.message;
+}
+
 Kumu::Result_t::~Result_t() {}
 
+//
+const Kumu::Result_t&
+Kumu::Result_t::operator=(const Result_t& rhs)
+{
+  value = rhs.value;
+  symbol = rhs.symbol;
+  label = rhs.label;
+  message = rhs.message;
+  return *this;
+}
+
+//
+const Kumu::Result_t
+Kumu::Result_t::operator()(const std::string& message) const
+{
+  Result_t result = *this;
+  result.message = message;
+  return result;
+}
+
+static int const MESSAGE_BUF_MAX = 2048;
+
+//
+const Kumu::Result_t
+Kumu::Result_t::operator()(const int& line, const char* filename) const
+{
+  assert(filename);
+  char buf[MESSAGE_BUF_MAX];
+  snprintf(buf, MESSAGE_BUF_MAX-1, "%s, line %d", filename, line);
+
+  Result_t result = *this;
+  result.message = buf;
+  return result;
+}
+
+//
+const Kumu::Result_t
+Kumu::Result_t::operator()(const std::string& message, const int& line, const char* filename) const
+{
+  assert(filename);
+  char buf[MESSAGE_BUF_MAX];
+  snprintf(buf, MESSAGE_BUF_MAX-1, "%s, line %d", filename, line);
+
+  Result_t result = *this;
+  result.message = message + buf;
+  return result;
+}
+
 
 //------------------------------------------------------------------------------------------
 // DTrace internals
index 51334dead292f2d9addbdc0a2e7e21910270d52f..4834891a3499e17a248e2d43726b2104f475a3ec 100755 (executable)
@@ -36,7 +36,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <KM_error.h>
 #include <KM_tai.h>
 #include <string.h>
-#include <string>
 #include <list>
 
 namespace Kumu
index 30530478e3d77c1184526a01dde390c67900300c..258bdbf75a9b029999c3e375eef7d2624ae46fed 100755 (executable)
@@ -126,11 +126,11 @@ ASDCP::MXF::RIP::InitFromFile(const Kumu::FileReader& Reader)
   if ( ASDCP_SUCCESS(result) )
     {
       Kumu::MemIOReader MemRDR(m_ValueStart, m_ValueLength - 4);
-      result = PairArray.Unarchive(&MemRDR) ? RESULT_OK : RESULT_KLV_CODING;
+      result = PairArray.Unarchive(&MemRDR) ? RESULT_OK : RESULT_KLV_CODING(__LINE__, __FILE__);
     }
 
   if ( ASDCP_FAILURE(result) )
-    DefaultLogSink().Error("Failed to initialize RIP\n");
+    DefaultLogSink().Error("Failed to initialize RIP.\n");
 
   return result;
 }
@@ -149,7 +149,7 @@ ASDCP::MXF::RIP::WriteToFile(Kumu::FileWriter& Writer)
 
   if ( ASDCP_SUCCESS(result) )
     {
-      result = RESULT_KLV_CODING;
+      result = RESULT_KLV_CODING(__LINE__, __FILE__);
 
       Kumu::MemIOWriter MemWRT(Buffer.Data(), Buffer.Capacity());
       if ( PairArray.Archive(&MemWRT) )
@@ -301,7 +301,7 @@ ASDCP::Result_t
 ASDCP::MXF::Partition::InitFromBuffer(const byte_t* p, ui32_t l)
 {
   Kumu::MemIOReader MemRDR(p, l);
-  Result_t result = RESULT_KLV_CODING;
+  Result_t result = RESULT_KLV_CODING(__LINE__, __FILE__);
 
   if ( MemRDR.ReadUi16BE(&MajorVersion) )
     if ( MemRDR.ReadUi16BE(&MinorVersion) )
@@ -319,7 +319,7 @@ ASDCP::MXF::Partition::InitFromBuffer(const byte_t* p, ui32_t l)
                            result = RESULT_OK;
 
   if ( ASDCP_FAILURE(result) )
-    DefaultLogSink().Error("Failed to initialize Partition\n");
+    DefaultLogSink().Error("Failed to initialize Partition.\n");
 
   return result;
 }
@@ -334,7 +334,7 @@ ASDCP::MXF::Partition::WriteToFile(Kumu::FileWriter& Writer, UL& PartitionLabel)
   if ( ASDCP_SUCCESS(result) )
     {
       Kumu::MemIOWriter MemWRT(Buffer.Data(), Buffer.Capacity());
-      result = RESULT_KLV_CODING;
+      result = RESULT_KLV_CODING(__LINE__, __FILE__);
       if ( MemWRT.WriteUi16BE(MajorVersion) )
        if ( MemWRT.WriteUi16BE(MinorVersion) )
          if ( MemWRT.WriteUi32BE(KAGSize) )
@@ -449,7 +449,7 @@ ASDCP::MXF::Primer::InitFromBuffer(const byte_t* p, ui32_t l)
   if ( ASDCP_SUCCESS(result) )
     {
       Kumu::MemIOReader MemRDR(m_ValueStart, m_ValueLength);
-      result = LocalTagEntryBatch.Unarchive(&MemRDR) ? RESULT_OK : RESULT_KLV_CODING;
+      result = LocalTagEntryBatch.Unarchive(&MemRDR) ? RESULT_OK : RESULT_KLV_CODING(__LINE__, __FILE__);
     }
 
   if ( ASDCP_SUCCESS(result) )
@@ -459,7 +459,7 @@ ASDCP::MXF::Primer::InitFromBuffer(const byte_t* p, ui32_t l)
     }
 
   if ( ASDCP_FAILURE(result) )
-    DefaultLogSink().Error("Failed to initialize Primer\n");
+    DefaultLogSink().Error("Failed to initialize Primer.\n");
 
   return result;
 }
@@ -487,7 +487,7 @@ ASDCP::MXF::Primer::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
   assert(m_Dict);
   ASDCP::FrameBuffer LocalTagBuffer;
   Kumu::MemIOWriter MemWRT(Buffer.Data() + kl_length, Buffer.Capacity() - kl_length);
-  Result_t result = LocalTagEntryBatch.Archive(&MemWRT) ? RESULT_OK : RESULT_KLV_CODING;
+  Result_t result = LocalTagEntryBatch.Archive(&MemWRT) ? RESULT_OK : RESULT_KLV_CODING(__LINE__, __FILE__);
 
   if ( ASDCP_SUCCESS(result) )
     {
@@ -737,9 +737,9 @@ ASDCP::MXF::OP1aHeader::InitFromFile(const Kumu::FileReader& Reader)
 
       if ( read_count != m_HeaderData.Capacity() )
        {
-         DefaultLogSink().Error("Short read of OP-Atom header metadata; wanted %u, got %u\n",
+         DefaultLogSink().Error("Short read of OP-Atom header metadata; wanted %u, got %u.\n",
                                 m_HeaderData.Capacity(), read_count);
-         return RESULT_KLV_CODING;
+         return RESULT_KLV_CODING(__LINE__, __FILE__);
        }
     }
 
@@ -783,9 +783,9 @@ ASDCP::MXF::OP1aHeader::InitFromBuffer(const byte_t* p, ui32_t l)
 
       object->m_Lookup = &m_Primer;
       result = object->InitFromBuffer(p, end_p - p);
+
       const byte_t* redo_p = p;
       p += object->PacketLength();
-      //      hexdump(p, object->PacketLength());
 
       if ( ASDCP_SUCCESS(result) )
        {
@@ -813,7 +813,8 @@ ASDCP::MXF::OP1aHeader::InitFromBuffer(const byte_t* p, ui32_t l)
        }
       else
        {
-         DefaultLogSink().Error("Error initializing packet\n");
+         DefaultLogSink().Error("Error initializing OP1a header packet.\n");
+         //      Kumu::hexdump(p-object->PacketLength(), object->PacketLength());
          delete object;
        }
     }
@@ -1074,13 +1075,15 @@ ASDCP::MXF::OPAtomIndexFooter::InitFromBuffer(const byte_t* p, ui32_t l)
        }
       else
        {
-         DefaultLogSink().Error("Error initializing packet\n");
+         DefaultLogSink().Error("Error initializing OPAtom footer packet.\n");
          delete object;
        }
     }
 
   if ( ASDCP_FAILURE(result) )
-    DefaultLogSink().Error("Failed to initialize OPAtomIndexFooter\n");
+    {
+      DefaultLogSink().Error("Failed to initialize OPAtomIndexFooter.\n");
+    }
 
   return result;
 }
index 046a7b2d31dbeebf697152c18bcb29031ea11790..b90ebb7cc4ac3e9ca30548e1e5bfe6c85088df1c 100755 (executable)
--- a/src/MXF.h
+++ b/src/MXF.h
@@ -235,8 +235,12 @@ namespace ASDCP
 
        public:
        optional_property() : m_has_value(false) {}
-       optional_property(const PropertyType& value) : m_property(value), m_has_value(false) {}
-         const optional_property<PropertyType>& operator=(const PropertyType& rhs) { this->m_property = rhs; this->m_has_value = true; return *this; }
+       optional_property(const PropertyType& value) : m_property(value), m_has_value(true) {}
+         const optional_property<PropertyType>& operator=(const PropertyType& rhs) {
+           this->m_property = rhs;
+           this->m_has_value = true;
+           return *this;
+         }
          bool operator==(const PropertyType& rhs) const { return this->m_property == rhs; }
          bool operator==(const optional_property<PropertyType>& rhs) const { return this->m_property == rhs.m_property; }
          operator PropertyType&() { return this->m_property; }
@@ -248,6 +252,30 @@ namespace ASDCP
          const PropertyType& const_get() const { return m_property; }
        };
 
+      // wrapper object manages optional properties
+      template <class PropertyType>
+       class optional_container_property
+       {
+         PropertyType m_property;
+
+       public:
+         optional_container_property() {}
+       optional_container_property(const PropertyType& value) : m_property(value) {}
+         const optional_container_property<PropertyType>& operator=(const PropertyType& rhs) {
+           this->Copy(rhs.m_property);
+           return *this;
+         }
+
+         bool operator==(const PropertyType& rhs) const { return this->m_property == rhs; }
+         bool operator==(const optional_property<PropertyType>& rhs) const { return this->m_property == rhs.m_property; }
+         operator PropertyType&() { return this->m_property; }
+         void set(const PropertyType& rhs) { this->m_property = rhs; }
+         void reset(const PropertyType& rhs) { this->clear(); }
+         bool empty() const { return ! this->m_property.HasValue(); }
+         PropertyType& get() { return m_property; }
+         const PropertyType& const_get() const { return m_property; }
+       };
+
       // base class of all metadata objects
       //
       class InterchangeObject : public ASDCP::KLVPacket
index 6f0358fded243c94d8b0f75f324ca8a03612ff18..d4bbf44f233ab2841044eed964125a575bca2aac 100755 (executable)
@@ -439,7 +439,7 @@ ASDCP::MXF::TLVReader::TLVReader(const byte_t* p, ui32_t c, IPrimerLookup* Prime
 
       DefaultLogSink().Error("Malformed Set\n");
       m_ElementMap.clear();
-      result = RESULT_KLV_CODING;
+      result = RESULT_KLV_CODING(__LINE__, __FILE__);
     }
 }
 
@@ -489,7 +489,10 @@ ASDCP::MXF::TLVReader::ReadObject(const MDDEntry& Entry, Kumu::IArchive* Object)
   if ( FindTL(Entry) )
     {
       if ( m_size < m_capacity ) // don't try to unarchive an empty item
-       return Object->Unarchive(this) ? RESULT_OK : RESULT_KLV_CODING;
+       {
+         // TODO: carry on if uachive fails
+         return Object->Unarchive(this) ? RESULT_OK : RESULT_FALSE(__LINE__, __FILE__);
+       }
     }
 
   return RESULT_FALSE;
@@ -502,7 +505,7 @@ ASDCP::MXF::TLVReader::ReadUi8(const MDDEntry& Entry, ui8_t* value)
   ASDCP_TEST_NULL(value);
 
   if ( FindTL(Entry) )
-    return MemIOReader::ReadUi8(value) ? RESULT_OK : RESULT_KLV_CODING;
+    return MemIOReader::ReadUi8(value) ? RESULT_OK : RESULT_FALSE(__LINE__, __FILE__);
 
   return RESULT_FALSE;
 }
@@ -514,7 +517,7 @@ ASDCP::MXF::TLVReader::ReadUi16(const MDDEntry& Entry, ui16_t* value)
   ASDCP_TEST_NULL(value);
 
   if ( FindTL(Entry) )
-    return MemIOReader::ReadUi16BE(value) ? RESULT_OK : RESULT_KLV_CODING;
+    return MemIOReader::ReadUi16BE(value) ? RESULT_OK : RESULT_FALSE(__LINE__, __FILE__);
 
   return RESULT_FALSE;
 }
@@ -526,7 +529,7 @@ ASDCP::MXF::TLVReader::ReadUi32(const MDDEntry& Entry, ui32_t* value)
   ASDCP_TEST_NULL(value);
 
   if ( FindTL(Entry) )
-    return MemIOReader::ReadUi32BE(value) ? RESULT_OK : RESULT_KLV_CODING;
+    return MemIOReader::ReadUi32BE(value) ? RESULT_OK : RESULT_FALSE(__LINE__, __FILE__);
 
   return RESULT_FALSE;
 }
@@ -538,7 +541,7 @@ ASDCP::MXF::TLVReader::ReadUi64(const MDDEntry& Entry, ui64_t* value)
   ASDCP_TEST_NULL(value);
 
   if ( FindTL(Entry) )
-    return MemIOReader::ReadUi64BE(value) ? RESULT_OK : RESULT_KLV_CODING;
+    return MemIOReader::ReadUi64BE(value) ? RESULT_OK : RESULT_FALSE(__LINE__, __FILE__);
 
   return RESULT_FALSE;
 }
@@ -570,8 +573,8 @@ ASDCP::MXF::TLVWriter::WriteTag(const MDDEntry& Entry)
       return RESULT_FAIL;
     }
 
-  if ( ! MemIOWriter::WriteUi8(TmpTag.a) ) return RESULT_KLV_CODING;
-  if ( ! MemIOWriter::WriteUi8(TmpTag.b) ) return RESULT_KLV_CODING;
+  if ( ! MemIOWriter::WriteUi8(TmpTag.a) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
+  if ( ! MemIOWriter::WriteUi8(TmpTag.b) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
   return RESULT_OK;
 }
 
@@ -591,11 +594,11 @@ ASDCP::MXF::TLVWriter::WriteObject(const MDDEntry& Entry, Kumu::IArchive* Object
       // write a temp length
       byte_t* l_p = CurrentData();
 
-      if ( ! MemIOWriter::WriteUi16BE(0) ) return RESULT_KLV_CODING;
+      if ( ! MemIOWriter::WriteUi16BE(0) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
 
       ui32_t before = Length();
-      if ( ! Object->Archive(this) ) return RESULT_KLV_CODING;
-      if ( (Length() - before) > 0xffffL ) return RESULT_KLV_CODING;
+      if ( ! Object->Archive(this) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
+      if ( (Length() - before) > 0xffffL ) return RESULT_KLV_CODING(__LINE__, __FILE__);
       Kumu::i2p<ui16_t>(KM_i16_BE(Length() - before), l_p);
     }
 
@@ -611,8 +614,8 @@ ASDCP::MXF::TLVWriter::WriteUi8(const MDDEntry& Entry, ui8_t* value)
 
   if ( ASDCP_SUCCESS(result) )
     {
-      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui8_t)) ) return RESULT_KLV_CODING;
-      if ( ! MemIOWriter::WriteUi8(*value) ) return RESULT_KLV_CODING;
+      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui8_t)) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
+      if ( ! MemIOWriter::WriteUi8(*value) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
     }
   
   return result;
@@ -627,8 +630,8 @@ ASDCP::MXF::TLVWriter::WriteUi16(const MDDEntry& Entry, ui16_t* value)
 
   if ( KM_SUCCESS(result) )
     {
-      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui16_t)) ) return RESULT_KLV_CODING;
-      if ( ! MemIOWriter::WriteUi16BE(*value) ) return RESULT_KLV_CODING;
+      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui16_t)) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
+      if ( ! MemIOWriter::WriteUi16BE(*value) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
     }
 
   return result;
@@ -643,8 +646,8 @@ ASDCP::MXF::TLVWriter::WriteUi32(const MDDEntry& Entry, ui32_t* value)
 
   if ( KM_SUCCESS(result) )
     {
-      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui32_t)) ) return RESULT_KLV_CODING;
-      if ( ! MemIOWriter::WriteUi32BE(*value) ) return RESULT_KLV_CODING;
+      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui32_t)) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
+      if ( ! MemIOWriter::WriteUi32BE(*value) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
     }
 
   return result;
@@ -659,8 +662,8 @@ ASDCP::MXF::TLVWriter::WriteUi64(const MDDEntry& Entry, ui64_t* value)
 
   if ( KM_SUCCESS(result) )
     {
-      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui64_t)) ) return RESULT_KLV_CODING;
-      if ( ! MemIOWriter::WriteUi64BE(*value) ) return RESULT_KLV_CODING;
+      if ( ! MemIOWriter::WriteUi16BE(sizeof(ui64_t)) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
+      if ( ! MemIOWriter::WriteUi64BE(*value) ) return RESULT_KLV_CODING(__LINE__, __FILE__);
     }
 
   return result;
index 701dfa1152879d5f96fce2b4c7ec1db5d4135337..f74f4f54e84f2e49dc03d5b777be6ce20626ddff 100755 (executable)
@@ -135,7 +135,11 @@ namespace ASDCP
            ui32_t item_count, item_size;
            if ( ! Reader->ReadUi32BE(&item_count) ) return false;
            if ( ! Reader->ReadUi32BE(&item_size) ) return false;
-           if ( this->ItemSize() != item_size ) return false;
+
+           if ( item_count > 0 )
+             {
+               if ( this->ItemSize() != item_size ) return false;
+             }
 
            bool result = true;
            for ( ui32_t i = 0; i < item_count && result; ++i )
@@ -203,7 +207,7 @@ namespace ASDCP
          virtual ~SimpleArray() {}
 
          //
-         virtual bool Unarchive(Kumu::MemIOReader* Reader)
+         bool Unarchive(Kumu::MemIOReader* Reader)
            {
              bool result = true;
 
@@ -211,15 +215,19 @@ namespace ASDCP
                {
                  T Tmp;
                  result = Tmp.Unarchive(Reader);
-                 this->push_back(Tmp);
+
+                 if ( result )
+                   {
+                     this->push_back(Tmp);
+                   }
                }
 
              return result;
            }
 
-         inline virtual bool HasValue() const { return ! this->empty(); }
+         inline bool HasValue() const { return ! this->empty(); }
 
-         virtual ui32_t ArchiveLength() const {
+         ui32_t ArchiveLength() const {
            ui32_t arch_size = 0;
 
            typename std::list<T>::const_iterator l_i = this->begin();
@@ -231,7 +239,7 @@ namespace ASDCP
          }
 
          //
-         virtual bool Archive(Kumu::MemIOWriter* Writer) const {
+         bool Archive(Kumu::MemIOWriter* Writer) const {
            bool result = true;
            typename std::list<T>::const_iterator l_i = this->begin();
 
index bec2530049e24a03729ce5e81e74598b87a86823..af32e5b43735d2780a8add01fa618fed409aa761 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2012, John Hurst
+Copyright (c) 2005-2015, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -1578,7 +1578,7 @@ WaveAudioDescriptor::WriteToBuffer(ASDCP::FrameBuffer& Buffer)
 
 //
 
-GenericPictureEssenceDescriptor::GenericPictureEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d), SignalStandard(0), SampledWidth(0), SampledXOffset(0), DisplayHeight(0), DisplayXOffset(0), DisplayF2Offset(0), AlphaTransparency(0), ImageAlignmentOffset(0), ImageEndOffset(0), ActiveWidth(0), ActiveXOffset(0)
+GenericPictureEssenceDescriptor::GenericPictureEssenceDescriptor(const Dictionary*& d) : FileDescriptor(d), m_Dict(d), SignalStandard(0), SampledWidth(0), SampledXOffset(0), DisplayHeight(0), DisplayXOffset(0), DisplayF2Offset(0), AlphaTransparency(0), ImageAlignmentOffset(0), ImageEndOffset(0), ActiveHeight(0), ActiveYOffset(0)
 {
   assert(m_Dict);
   m_UL = m_Dict->ul(MDD_GenericPictureEssenceDescriptor);
@@ -1683,7 +1683,9 @@ GenericPictureEssenceDescriptor::InitFromTLVSet(TLVReader& TLVSet)
     result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(GenericPictureEssenceDescriptor, ColorPrimaries));
     ColorPrimaries.set_has_value( result == RESULT_OK );
   }
-  if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(GenericPictureEssenceDescriptor, AlternativeCenterCuts));
+  if ( ASDCP_SUCCESS(result) ) {
+    result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(GenericPictureEssenceDescriptor, AlternativeCenterCuts));
+  }
   if ( ASDCP_SUCCESS(result) ) { 
     result = TLVSet.ReadUi32(OBJ_READ_ARGS_OPT(GenericPictureEssenceDescriptor, ActiveWidth));
     ActiveWidth.set_has_value( result == RESULT_OK );
@@ -1734,7 +1736,7 @@ GenericPictureEssenceDescriptor::WriteToTLVSet(TLVWriter& TLVSet)
   if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS(GenericPictureEssenceDescriptor, PictureEssenceCoding));
   if ( ASDCP_SUCCESS(result)  && ! CodingEquations.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(GenericPictureEssenceDescriptor, CodingEquations));
   if ( ASDCP_SUCCESS(result)  && ! ColorPrimaries.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(GenericPictureEssenceDescriptor, ColorPrimaries));
-  if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS(GenericPictureEssenceDescriptor, AlternativeCenterCuts));
+  if ( ASDCP_SUCCESS(result)  && ! AlternativeCenterCuts.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(GenericPictureEssenceDescriptor, AlternativeCenterCuts));
   if ( ASDCP_SUCCESS(result)  && ! ActiveWidth.empty() ) result = TLVSet.WriteUi32(OBJ_WRITE_ARGS_OPT(GenericPictureEssenceDescriptor, ActiveWidth));
   if ( ASDCP_SUCCESS(result)  && ! ActiveHeight.empty() ) result = TLVSet.WriteUi32(OBJ_WRITE_ARGS_OPT(GenericPictureEssenceDescriptor, ActiveHeight));
   if ( ASDCP_SUCCESS(result)  && ! ActiveXOffset.empty() ) result = TLVSet.WriteUi32(OBJ_WRITE_ARGS_OPT(GenericPictureEssenceDescriptor, ActiveXOffset));
@@ -1855,8 +1857,10 @@ GenericPictureEssenceDescriptor::Dump(FILE* stream)
   if ( ! ColorPrimaries.empty() ) {
     fprintf(stream, "  %22s = %s\n",  "ColorPrimaries", ColorPrimaries.get().EncodeString(identbuf, IdentBufferLen));
   }
-  fprintf(stream, "  %22s:\n",  "AlternativeCenterCuts");
-  AlternativeCenterCuts.Dump(stream);
+  if ( ! AlternativeCenterCuts.empty() ) {
+    fprintf(stream, "  %22s:\n",  "AlternativeCenterCuts");
+  AlternativeCenterCuts.get().Dump(stream);
+  }
   if ( ! ActiveWidth.empty() ) {
     fprintf(stream, "  %22s = %d\n",  "ActiveWidth", ActiveWidth.get());
   }
@@ -3319,7 +3323,10 @@ AudioChannelLabelSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
 {
   assert(m_Dict);
   Result_t result = MCALabelSubDescriptor::InitFromTLVSet(TLVSet);
-  if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(AudioChannelLabelSubDescriptor, SoundfieldGroupLinkID));
+  if ( ASDCP_SUCCESS(result) ) {
+    result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(AudioChannelLabelSubDescriptor, SoundfieldGroupLinkID));
+    SoundfieldGroupLinkID.set_has_value( result == RESULT_OK );
+  }
   return result;
 }
 
@@ -3329,7 +3336,7 @@ AudioChannelLabelSubDescriptor::WriteToTLVSet(TLVWriter& TLVSet)
 {
   assert(m_Dict);
   Result_t result = MCALabelSubDescriptor::WriteToTLVSet(TLVSet);
-  if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS(AudioChannelLabelSubDescriptor, SoundfieldGroupLinkID));
+  if ( ASDCP_SUCCESS(result)  && ! SoundfieldGroupLinkID.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(AudioChannelLabelSubDescriptor, SoundfieldGroupLinkID));
   return result;
 }
 
@@ -3352,7 +3359,9 @@ AudioChannelLabelSubDescriptor::Dump(FILE* stream)
     stream = stderr;
 
   MCALabelSubDescriptor::Dump(stream);
-  fprintf(stream, "  %22s = %s\n",  "SoundfieldGroupLinkID", SoundfieldGroupLinkID.EncodeString(identbuf, IdentBufferLen));
+  if ( ! SoundfieldGroupLinkID.empty() ) {
+    fprintf(stream, "  %22s = %s\n",  "SoundfieldGroupLinkID", SoundfieldGroupLinkID.get().EncodeString(identbuf, IdentBufferLen));
+  }
 }
 
 //
@@ -3394,7 +3403,9 @@ SoundfieldGroupLabelSubDescriptor::InitFromTLVSet(TLVReader& TLVSet)
 {
   assert(m_Dict);
   Result_t result = MCALabelSubDescriptor::InitFromTLVSet(TLVSet);
-  if ( ASDCP_SUCCESS(result) ) result = TLVSet.ReadObject(OBJ_READ_ARGS(SoundfieldGroupLabelSubDescriptor, GroupOfSoundfieldGroupsLinkID));
+  if ( ASDCP_SUCCESS(result) ) {
+    result = TLVSet.ReadObject(OBJ_READ_ARGS_OPT(SoundfieldGroupLabelSubDescriptor, GroupOfSoundfieldGroupsLinkID));
+  }
   return result;
 }
 
@@ -3404,7 +3415,7 @@ SoundfieldGroupLabelSubDescriptor::WriteToTLVSet(TLVWriter& TLVSet)
 {
   assert(m_Dict);
   Result_t result = MCALabelSubDescriptor::WriteToTLVSet(TLVSet);
-  if ( ASDCP_SUCCESS(result) ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS(SoundfieldGroupLabelSubDescriptor, GroupOfSoundfieldGroupsLinkID));
+  if ( ASDCP_SUCCESS(result)  && ! GroupOfSoundfieldGroupsLinkID.empty() ) result = TLVSet.WriteObject(OBJ_WRITE_ARGS_OPT(SoundfieldGroupLabelSubDescriptor, GroupOfSoundfieldGroupsLinkID));
   return result;
 }
 
@@ -3427,8 +3438,10 @@ SoundfieldGroupLabelSubDescriptor::Dump(FILE* stream)
     stream = stderr;
 
   MCALabelSubDescriptor::Dump(stream);
-  fprintf(stream, "  %22s:\n",  "GroupOfSoundfieldGroupsLinkID");
-  GroupOfSoundfieldGroupsLinkID.Dump(stream);
+  if ( ! GroupOfSoundfieldGroupsLinkID.empty() ) {
+    fprintf(stream, "  %22s:\n",  "GroupOfSoundfieldGroupsLinkID");
+  GroupOfSoundfieldGroupsLinkID.get().Dump(stream);
+  }
 }
 
 //
index bc62665ccfebbfd7d0ec47a48db06bc6c97b11ca..55f06d4c24ae459c0b25252a4f42903438f29986 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2012, John Hurst
+Copyright (c) 2005-2015, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -57,7 +57,7 @@ namespace ASDCP
           UUID ProductUID;
           Kumu::Timestamp ModificationDate;
           VersionType ToolkitVersion;
-          optional_property<UTF16String> Platform;
+          optional_property<UTF16String > Platform;
 
       Identification(const Dictionary*& d);
       Identification(const Identification& rhs);
@@ -105,7 +105,7 @@ namespace ASDCP
        public:
          const Dictionary*& m_Dict;
           UMID LinkedPackageUID;
-          optional_property<ui32_t> IndexSID;
+          optional_property<ui32_t > IndexSID;
           ui32_t BodySID;
 
       EssenceContainerData(const Dictionary*& d);
@@ -130,7 +130,7 @@ namespace ASDCP
        public:
          const Dictionary*& m_Dict;
           UMID PackageUID;
-          optional_property<UTF16String> Name;
+          optional_property<UTF16String > Name;
           Kumu::Timestamp PackageCreationDate;
           Kumu::Timestamp PackageModifiedDate;
           Array<UUID> Tracks;
@@ -154,7 +154,7 @@ namespace ASDCP
 
        public:
          const Dictionary*& m_Dict;
-          optional_property<UUID> PackageMarker;
+          optional_property<UUID > PackageMarker;
 
       MaterialPackage(const Dictionary*& d);
       MaterialPackage(const MaterialPackage& rhs);
@@ -202,8 +202,8 @@ namespace ASDCP
          const Dictionary*& m_Dict;
           ui32_t TrackID;
           ui32_t TrackNumber;
-          optional_property<UTF16String> TrackName;
-          optional_property<UUID> Sequence;
+          optional_property<UTF16String > TrackName;
+          optional_property<UUID > Sequence;
 
       GenericTrack(const Dictionary*& d);
       GenericTrack(const GenericTrack& rhs);
@@ -271,7 +271,7 @@ namespace ASDCP
        public:
          const Dictionary*& m_Dict;
           UL DataDefinition;
-          optional_property<ui64_t> Duration;
+          optional_property<ui64_t > Duration;
 
       StructuralComponent(const Dictionary*& d);
       StructuralComponent(const StructuralComponent& rhs);
@@ -387,11 +387,11 @@ namespace ASDCP
 
        public:
          const Dictionary*& m_Dict;
-          optional_property<ui32_t> LinkedTrackID;
+          optional_property<ui32_t > LinkedTrackID;
           Rational SampleRate;
-          optional_property<ui64_t> ContainerDuration;
+          optional_property<ui64_t > ContainerDuration;
           UL EssenceContainer;
-          optional_property<UL> Codec;
+          optional_property<UL > Codec;
 
       FileDescriptor(const Dictionary*& d);
       FileDescriptor(const FileDescriptor& rhs);
@@ -416,11 +416,11 @@ namespace ASDCP
          const Dictionary*& m_Dict;
           Rational AudioSamplingRate;
           ui8_t Locked;
-          optional_property<ui8_t> AudioRefLevel;
-          optional_property<ui8_t> ElectroSpatialFormulation;
+          optional_property<ui8_t > AudioRefLevel;
+          optional_property<ui8_t > ElectroSpatialFormulation;
           ui32_t ChannelCount;
           ui32_t QuantizationBits;
-          optional_property<ui8_t> DialNorm;
+          optional_property<ui8_t > DialNorm;
           UL SoundEssenceCoding;
 
       GenericSoundEssenceDescriptor(const Dictionary*& d);
@@ -445,11 +445,11 @@ namespace ASDCP
        public:
          const Dictionary*& m_Dict;
           ui16_t BlockAlign;
-          optional_property<ui8_t> SequenceOffset;
+          optional_property<ui8_t > SequenceOffset;
           ui32_t AvgBps;
-          optional_property<UL> ChannelAssignment;
-          optional_property<Rational> ReferenceImageEditRate;
-          optional_property<ui8_t> ReferenceAudioAlignmentLevel;
+          optional_property<UL > ChannelAssignment;
+          optional_property<Rational > ReferenceImageEditRate;
+          optional_property<ui8_t > ReferenceAudioAlignmentLevel;
 
       WaveAudioDescriptor(const Dictionary*& d);
       WaveAudioDescriptor(const WaveAudioDescriptor& rhs);
@@ -472,36 +472,36 @@ namespace ASDCP
 
        public:
          const Dictionary*& m_Dict;
-          optional_property<ui8_t> SignalStandard;
+          optional_property<ui8_t > SignalStandard;
           ui8_t FrameLayout;
           ui32_t StoredWidth;
           ui32_t StoredHeight;
-          optional_property<ui32_t> StoredF2Offset;
-          optional_property<ui32_t> SampledWidth;
-          optional_property<ui32_t> SampledHeight;
-          optional_property<ui32_t> SampledXOffset;
-          optional_property<ui32_t> SampledYOffset;
-          optional_property<ui32_t> DisplayHeight;
-          optional_property<ui32_t> DisplayWidth;
-          optional_property<ui32_t> DisplayXOffset;
-          optional_property<ui32_t> DisplayYOffset;
-          optional_property<ui32_t> DisplayF2Offset;
+          optional_property<ui32_t > StoredF2Offset;
+          optional_property<ui32_t > SampledWidth;
+          optional_property<ui32_t > SampledHeight;
+          optional_property<ui32_t > SampledXOffset;
+          optional_property<ui32_t > SampledYOffset;
+          optional_property<ui32_t > DisplayHeight;
+          optional_property<ui32_t > DisplayWidth;
+          optional_property<ui32_t > DisplayXOffset;
+          optional_property<ui32_t > DisplayYOffset;
+          optional_property<ui32_t > DisplayF2Offset;
           Rational AspectRatio;
-          optional_property<ui8_t> ActiveFormatDescriptor;
-          optional_property<ui8_t> AlphaTransparency;
-          optional_property<UL> TransferCharacteristic;
-          optional_property<ui32_t> ImageAlignmentOffset;
-          optional_property<ui32_t> ImageStartOffset;
-          optional_property<ui32_t> ImageEndOffset;
-          optional_property<ui8_t> FieldDominance;
+          optional_property<ui8_t > ActiveFormatDescriptor;
+          optional_property<ui8_t > AlphaTransparency;
+          optional_property<UL > TransferCharacteristic;
+          optional_property<ui32_t > ImageAlignmentOffset;
+          optional_property<ui32_t > ImageStartOffset;
+          optional_property<ui32_t > ImageEndOffset;
+          optional_property<ui8_t > FieldDominance;
           UL PictureEssenceCoding;
-          optional_property<UL> CodingEquations;
-          optional_property<UL> ColorPrimaries;
-          Batch<UL> AlternativeCenterCuts;
-          optional_property<ui32_t> ActiveWidth;
-          optional_property<ui32_t> ActiveHeight;
-          optional_property<ui32_t> ActiveXOffset;
-          optional_property<ui32_t> ActiveYOffset;
+          optional_property<UL > CodingEquations;
+          optional_property<UL > ColorPrimaries;
+          optional_property<Batch<UL> > AlternativeCenterCuts;
+          optional_property<ui32_t > ActiveWidth;
+          optional_property<ui32_t > ActiveHeight;
+          optional_property<ui32_t > ActiveXOffset;
+          optional_property<ui32_t > ActiveYOffset;
 
       GenericPictureEssenceDescriptor(const Dictionary*& d);
       GenericPictureEssenceDescriptor(const GenericPictureEssenceDescriptor& rhs);
@@ -524,11 +524,11 @@ namespace ASDCP
 
        public:
          const Dictionary*& m_Dict;
-          optional_property<ui32_t> ComponentMaxRef;
-          optional_property<ui32_t> ComponentMinRef;
-          optional_property<ui32_t> AlphaMinRef;
-          optional_property<ui32_t> AlphaMaxRef;
-          optional_property<ui8_t> ScanningDirection;
+          optional_property<ui32_t > ComponentMaxRef;
+          optional_property<ui32_t > ComponentMinRef;
+          optional_property<ui32_t > AlphaMinRef;
+          optional_property<ui32_t > AlphaMaxRef;
+          optional_property<ui8_t > ScanningDirection;
 
       RGBAEssenceDescriptor(const Dictionary*& d);
       RGBAEssenceDescriptor(const RGBAEssenceDescriptor& rhs);
@@ -561,10 +561,10 @@ namespace ASDCP
           ui32_t XTOsize;
           ui32_t YTOsize;
           ui16_t Csize;
-          optional_property<Raw> PictureComponentSizing;
-          optional_property<Raw> CodingStyleDefault;
-          optional_property<Raw> QuantizationDefault;
-          optional_property<RGBALayout> J2CLayout;
+          optional_property<Raw > PictureComponentSizing;
+          optional_property<Raw > CodingStyleDefault;
+          optional_property<Raw > QuantizationDefault;
+          optional_property<RGBALayout > J2CLayout;
 
       JPEG2000PictureSubDescriptor(const Dictionary*& d);
       JPEG2000PictureSubDescriptor(const JPEG2000PictureSubDescriptor& rhs);
@@ -589,14 +589,14 @@ namespace ASDCP
          const Dictionary*& m_Dict;
           ui32_t ComponentDepth;
           ui32_t HorizontalSubsampling;
-          optional_property<ui32_t> VerticalSubsampling;
-          optional_property<ui8_t> ColorSiting;
-          optional_property<ui8_t> ReversedByteOrder;
-          optional_property<ui16_t> PaddingBits;
-          optional_property<ui32_t> AlphaSampleDepth;
-          optional_property<ui32_t> BlackRefLevel;
-          optional_property<ui32_t> WhiteReflevel;
-          optional_property<ui32_t> ColorRange;
+          optional_property<ui32_t > VerticalSubsampling;
+          optional_property<ui8_t > ColorSiting;
+          optional_property<ui8_t > ReversedByteOrder;
+          optional_property<ui16_t > PaddingBits;
+          optional_property<ui32_t > AlphaSampleDepth;
+          optional_property<ui32_t > BlackRefLevel;
+          optional_property<ui32_t > WhiteReflevel;
+          optional_property<ui32_t > ColorRange;
 
       CDCIEssenceDescriptor(const Dictionary*& d);
       CDCIEssenceDescriptor(const CDCIEssenceDescriptor& rhs);
@@ -619,16 +619,16 @@ namespace ASDCP
 
        public:
          const Dictionary*& m_Dict;
-          optional_property<ui8_t> SingleSequence;
-          optional_property<ui8_t> ConstantBFrames;
-          optional_property<ui8_t> CodedContentType;
-          optional_property<ui8_t> LowDelay;
-          optional_property<ui8_t> ClosedGOP;
-          optional_property<ui8_t> IdenticalGOP;
-          optional_property<ui8_t> MaxGOP;
-          optional_property<ui8_t> BPictureCount;
-          optional_property<ui32_t> BitRate;
-          optional_property<ui8_t> ProfileAndLevel;
+          optional_property<ui8_t > SingleSequence;
+          optional_property<ui8_t > ConstantBFrames;
+          optional_property<ui8_t > CodedContentType;
+          optional_property<ui8_t > LowDelay;
+          optional_property<ui8_t > ClosedGOP;
+          optional_property<ui8_t > IdenticalGOP;
+          optional_property<ui8_t > MaxGOP;
+          optional_property<ui8_t > BPictureCount;
+          optional_property<ui32_t > BitRate;
+          optional_property<ui8_t > ProfileAndLevel;
 
       MPEG2VideoDescriptor(const Dictionary*& d);
       MPEG2VideoDescriptor(const MPEG2VideoDescriptor& rhs);
@@ -754,7 +754,7 @@ namespace ASDCP
           UUID ResourceID;
           UTF16String UCSEncoding;
           UTF16String NamespaceURI;
-          optional_property<UTF16String> RFC5646LanguageTagList;
+          optional_property<UTF16String > RFC5646LanguageTagList;
 
       TimedTextDescriptor(const Dictionary*& d);
       TimedTextDescriptor(const TimedTextDescriptor& rhs);
@@ -872,9 +872,9 @@ namespace ASDCP
           UL MCALabelDictionaryID;
           UUID MCALinkID;
           UTF16String MCATagSymbol;
-          optional_property<UTF16String> MCATagName;
-          optional_property<ui32_t> MCAChannelID;
-          optional_property<ISO8String> RFC5646SpokenLanguage;
+          optional_property<UTF16String > MCATagName;
+          optional_property<ui32_t > MCAChannelID;
+          optional_property<ISO8String > RFC5646SpokenLanguage;
 
       MCALabelSubDescriptor(const Dictionary*& d);
       MCALabelSubDescriptor(const MCALabelSubDescriptor& rhs);
@@ -897,7 +897,7 @@ namespace ASDCP
 
        public:
          const Dictionary*& m_Dict;
-          UUID SoundfieldGroupLinkID;
+          optional_property<UUID > SoundfieldGroupLinkID;
 
       AudioChannelLabelSubDescriptor(const Dictionary*& d);
       AudioChannelLabelSubDescriptor(const AudioChannelLabelSubDescriptor& rhs);
@@ -920,7 +920,7 @@ namespace ASDCP
 
        public:
          const Dictionary*& m_Dict;
-          Array<UUID> GroupOfSoundfieldGroupsLinkID;
+          optional_property<Array<UUID> > GroupOfSoundfieldGroupsLinkID;
 
       SoundfieldGroupLabelSubDescriptor(const Dictionary*& d);
       SoundfieldGroupLabelSubDescriptor(const SoundfieldGroupLabelSubDescriptor& rhs);
index 7ecd0938498c892bacb0cf36309da18a88e14d0c..b6b2cc7c52897322b2a52760cbd91ef505ac99ae 100644 (file)
@@ -165,21 +165,6 @@ get_UUID_from_child_element(const char* name, XMLElement* Parent, UUID& outID)
   return get_UUID_from_element(Child, outID);
 }
 
-//
-static ASDCP::Rational
-decode_rational(const char* str_rat)
-{
-  assert(str_rat);
-  ui32_t Num = atoi(str_rat);
-  ui32_t Den = 0;
-
-  const char* den_str = strrchr(str_rat, ' ');
-  if ( den_str != 0 )
-    Den = atoi(den_str+1);
-
-  return ASDCP::Rational(Num, Den);
-}
-
 //
 Result_t
 ASDCP::TimedText::DCSubtitleParser::h__SubtitleParser::OpenRead(const std::string& filename)
@@ -225,7 +210,7 @@ ASDCP::TimedText::DCSubtitleParser::h__SubtitleParser::OpenRead()
 
   if ( ns == 0 )
     {
-      DefaultLogSink(). Warn("Document has no namespace name, assuming %s\n", c_dcst_namespace_name);
+      DefaultLogSink(). Warn("Document has no namespace name, assuming \"%s\".\n", c_dcst_namespace_name);
       m_TDesc.NamespaceName = c_dcst_namespace_name;
     }
   else
@@ -236,7 +221,7 @@ ASDCP::TimedText::DCSubtitleParser::h__SubtitleParser::OpenRead()
   UUID DocID;
   if ( ! get_UUID_from_child_element("Id", &m_Root, DocID) )
     {
-      DefaultLogSink(). Error("Id element missing from input document\n");
+      DefaultLogSink(). Error("Id element missing from input document.\n");
       return RESULT_FORMAT;
     }
 
@@ -245,11 +230,15 @@ ASDCP::TimedText::DCSubtitleParser::h__SubtitleParser::OpenRead()
 
   if ( EditRate == 0 )
     {
-      DefaultLogSink(). Error("EditRate element missing from input document\n");
+      DefaultLogSink().Error("EditRate element missing from input document.\n");
       return RESULT_FORMAT;
     }
 
-  m_TDesc.EditRate = decode_rational(EditRate->GetBody().c_str());
+  if ( ! DecodeRational(EditRate->GetBody().c_str(), m_TDesc.EditRate) )
+    {
+      DefaultLogSink().Error("Error decoding edit rate value: \"%s\"\n", EditRate->GetBody().c_str());
+      return RESULT_FORMAT;
+    }
 
   if ( m_TDesc.EditRate != EditRate_23_98
        && m_TDesc.EditRate != EditRate_24
index 09abd984828291419c32f38f3093ab422f452072..1da05093083aa25be0d64a31b86090337f6d4bc4 100755 (executable)
@@ -167,20 +167,6 @@ Options:\n\
          o All option arguments must be separated from the option by whitespace.\n\n");
 }
 
-//
-static ASDCP::Rational
-decode_rational(const char* str_rat)
-{
-  assert(str_rat);
-  ui32_t Num = atoi(str_rat);
-  ui32_t Den = 1;
-
-  const char* den_str = strrchr(str_rat, '/');
-  if ( den_str != 0 )
-    Den = atoi(den_str+1);
-
-  return ASDCP::Rational(Num, Den);
-}
 
 //
 //
@@ -263,7 +249,11 @@ public:
              {
              case 'A':
                TEST_EXTRA_ARG(i, 'A');
-               edit_rate = decode_rational(argv[i]);
+               if ( ! DecodeRational(argv[i], aspect_ratio) )
+                 {
+                   fprintf(stderr, "Error decoding aspect ratio value: %s\n", argv[i]);
+                   return;
+                 }
                break;
 
              case 'a':
@@ -379,7 +369,12 @@ public:
 
              case 'r':
                TEST_EXTRA_ARG(i, 'r');
-               edit_rate = decode_rational(argv[i]);
+               if ( ! DecodeRational(argv[i], edit_rate) )
+                 {
+                   fprintf(stderr, "Error decoding edit rate value: %s\n", argv[i]);
+                   return;
+                 }
+               
                break;
 
              case 'R':
index 97da552616a124181707a46ce4adfa8b23444b78..7d730d47ba7549e2fecdfa75d6215ec80453af1a 100755 (executable)
@@ -1040,7 +1040,11 @@ write_PCM_file(CommandOptions& Options)
                  return RESULT_FAIL;
                }
 
-             if ( Options.use_interop_sound_wtf )
+             if ( Options.channel_assignment.HasValue() )
+               {
+                 essence_descriptor->ChannelAssignment = Options.channel_assignment;
+               }
+             else if ( Options.use_interop_sound_wtf )
                {
                  essence_descriptor->ChannelAssignment = g_dict->ul(MDD_DCAudioChannelCfg_4_WTF);
                }
index 501f96a2792bc0d89dfb87c939ddce90460e407b..1a89a0e2f6ba5ec350a0670c88da4124e5ec2076 100644 (file)
@@ -115,7 +115,7 @@ public:
 
              case 'd':
                TEST_EXTRA_ARG(i, 'd');
-               duration = atoi(argv[i]); // TODO: test for negative value, should use strtol()
+               duration = Kumu::xabs(strtol(argv[i], 0, 10));
                break;
 
              case '9':
index cf2b00f340c27e89884f5a6b91cfe8d45d633456..a81d1aecf58cc1a0f47c8a259e4f99451f4f954b 100644 (file)
@@ -281,13 +281,15 @@ AS_02::MXF::AS02IndexReader::InitFromBuffer(const byte_t* p, ui32_t l, const ui6
        }
       else
        {
-         DefaultLogSink().Error("Error initializing packet\n");
+         DefaultLogSink().Error("Error initializing index segment packet.\n");
          delete object;
        }
     }
 
   if ( KM_FAILURE(result) )
-    DefaultLogSink().Error("Failed to initialize AS02IndexReader\n");
+    {
+      DefaultLogSink().Error("Failed to initialize AS02IndexReader.\n");
+    }
 
   return result;
 }
index 9ba816ed3429a2bdad2b493e4fad1bae56f860b4..2ce033251fa84b23086ba788030fe13a642ea857 100755 (executable)
@@ -152,7 +152,7 @@ public:
              case 'c':
                mode = MMT_CREATE;
                TEST_EXTRA_ARG(i, 'c');
-               chunk_count = atoi(argv[i]);
+               chunk_count = Kumu::xabs(strtol(argv[i], 0, 10));
                break;
                
              case 'V': version_flag = true; break;
index 9cdc346a525b2e584e05fd224cee9b3c78e14b93..32f9b23aa6286b92dbd15f1c583ea339a90b486f 100755 (executable)
@@ -151,21 +151,6 @@ Options:\n\
          o All option arguments must be separated from the option by whitespace.\n\n");
 }
 
-//
-static ASDCP::Rational
-decode_rational(const char* str_rat)
-{
-  assert(str_rat);
-  ui32_t Num = atoi(str_rat);
-  ui32_t Den = 0;
-
-  const char* den_str = strrchr(str_rat, '/');
-  if ( den_str != 0 )
-    Den = atoi(den_str+1);
-
-  return ASDCP::Rational(Num, Den);
-}
-
 //
 //
 class CommandOptions
@@ -246,7 +231,11 @@ public:
              {
              case 'A':
                TEST_EXTRA_ARG(i, 'A');
-               edit_rate = decode_rational(argv[i]);
+               if ( ! DecodeRational(argv[i], aspect_ratio) )
+                 {
+                   fprintf(stderr, "Error decoding aspect ratio value: %s\n", argv[i]);
+                   return;
+                 }
                break;
 
              case 'a':
@@ -354,7 +343,12 @@ public:
 
              case 'r':
                TEST_EXTRA_ARG(i, 'r');
-               edit_rate = decode_rational(argv[i]);
+               if ( ! DecodeRational(argv[i], edit_rate) )
+                 {
+                   fprintf(stderr, "Error decoding edit rate value: %s\n", argv[i]);
+                   return;
+                 }
+
                break;
 
              case 'R':
index ac7be7268307067b20dbf627f0e2bcd439ab61c9..c47b8be7c630275c5a426c9263d7e6f782b9445f 100755 (executable)
@@ -33,11 +33,11 @@ OBJDIR = .
 \r
 !ifdef ENABLE_RANDOM_UUID\r
 CXXFLAGS1 = /nologo /W3 /GR /EHsc /DWIN32 /DKM_WIN32 /D_CONSOLE /I. /I$(SRCDIR) /DASDCP_PLATFORM=\"win32\" \\r
-       /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DPACKAGE_VERSION=\"2.4.9\" \\r
+       /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DPACKAGE_VERSION=\"2.5.11rc1\" \\r
        /I"$(WITH_OPENSSL)"\inc32 /DCONFIG_RANDOM_UUID=1\r
 !else\r
 CXXFLAGS1 = /nologo /W3 /GR /EHsc /DWIN32 /DKM_WIN32 /D_CONSOLE /I. /I$(SRCDIR) /DASDCP_PLATFORM=\"win32\" \\r
-       /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DPACKAGE_VERSION=\"2.4.9\" \\r
+       /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DPACKAGE_VERSION=\"2.5.11rc1\" \\r
        /I"$(WITH_OPENSSL)"\inc32\r
 !endif\r
 LIB_EXE = lib.exe\r
@@ -87,9 +87,10 @@ ASDCP_OBJS = MPEG2_Parser.obj MPEG.obj JP2K_Codestream_Parser.obj \
        DCData_ByteStream_Parser.obj DCData_Sequence_Parser.obj \\r
        AtmosSyncChannel_Generator.obj AtmosSyncChannel_Mixer.obj \\r
        PCMDataProviders.obj SyncEncoder.obj CRC16.obj \\r
-       UUIDInformation.obj\r
+       UUIDInformation.obj ST2095_PinkNoise.obj\r
 AS02_OBJS = h__02_Reader.obj h__02_Writer.obj AS_02_JP2K.obj \\r
-       AS_02_PCM.obj\r
+       AS_02_PCM.obj AS_02_TimedText.obj ST2052_TextParser.obj\r
+PHDR_OBJS = AS_02_PHDR.obj\r
 \r
 {$(SRCDIR)\}.cpp{}.obj:\r
        $(CXX) $(CXXFLAGS) -Fd$(OBJDIR)\ /c $<\r
@@ -97,15 +98,31 @@ AS02_OBJS = h__02_Reader.obj h__02_Writer.obj AS_02_JP2K.obj \
 {$(SRCDIR)\}.c{}.obj:\r
        $(CXX) $(CXXFLAGS) -Fd$(OBJDIR)\ /c $<\r
 \r
-all: kmfilegen.exe kmrandgen.exe kmuuidgen.exe asdcp-test.exe \\r
-     asdcp-wrap.exe asdcp-unwrap.exe asdcp-info.exe \\r
-     blackwave.exe klvwalk.exe j2c-test.exe wavesplit.exe \r
+all: \\r
+       kmfilegen.exe \\r
+       kmrandgen.exe \\r
+       kmuuidgen.exe \\r
+       asdcp-test.exe \\r
+       asdcp-wrap.exe \\r
+       asdcp-unwrap.exe \\r
+       asdcp-info.exe \\r
+       blackwave.exe \\r
+       pinkwave.exe \\r
+       wavesplit.exe\r
+       j2c-test.exe \\r
+       klvwalk.exe \\r
+       klvsplit.exe\r
 !IFDEF USE_AS_02\r
-       as-02-wrap.exe as-02-unwrap.exe \\r
+all += as-02-wrap.exe \\r
+       as-02-unwrap.exe\r
+!ENDIF\r
+!IFDEF USE_PHDR\r
+all += phdr-wrap.exe \\r
+       phdr-unwrap.exe\r
 !ENDIF\r
 \r
 clean:\r
-       erase *.exe *.lib *.obj *.ilk *.pdb *.idb\r
+       erase *.exe *.lib *.obj *.ilk *.pdb *.idb *.manifest\r
 \r
 libkumu.lib : $(KUMU_OBJS)\r
 !IFDEF WITH_XERCES\r
@@ -128,48 +145,64 @@ libas02.lib: libasdcp.lib libkumu.lib $(AS02_OBJS)
        $(LIB_EXE) $(LIBFLAGS) /OUT:libas02.lib $**\r
 !ENDIF\r
 \r
+!IFDEF USE_PHDR\r
+libas02-phdr.lib: libas02.lib libasdcp.lib libkumu.lib $(PHDR_OBJS)\r
+       $(LIB_EXE) $(LIBFLAGS) /OUT:libas02-phdr.lib $**\r
+!ENDIF\r
+\r
 blackwave.exe: libasdcp.lib blackwave.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:blackwave.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:blackwave.exe $** Advapi32.lib user32.lib\r
+\r
+pinkwave.exe: libasdcp.lib pinkwave.obj\r
+       $(LINK) $(LINKFLAGS) /OUT:pinkwave.exe $** Advapi32.lib user32.lib\r
 \r
 wavesplit.exe: libasdcp.lib wavesplit.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:wavesplit.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:wavesplit.exe $** Advapi32.lib user32.lib\r
 \r
 kmuuidgen.exe: libkumu.lib kmuuidgen.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:kmuuidgen.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:kmuuidgen.exe $** Advapi32.lib user32.lib\r
 \r
 kmrandgen.exe: libkumu.lib kmrandgen.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:kmrandgen.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:kmrandgen.exe $** Advapi32.lib user32.lib\r
 \r
 kmfilegen.exe: libkumu.lib kmfilegen.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:kmfilegen.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:kmfilegen.exe $** Advapi32.lib user32.lib\r
 \r
 klvwalk.exe: libasdcp.lib klvwalk.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:klvwalk.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:klvwalk.exe $** Advapi32.lib user32.lib\r
 \r
 asdcp-test.exe: libasdcp.lib asdcp-test.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:asdcp-test.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:asdcp-test.exe $** Advapi32.lib user32.lib\r
 \r
 asdcp-wrap.exe: libasdcp.lib asdcp-wrap.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:asdcp-wrap.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:asdcp-wrap.exe $** Advapi32.lib user32.lib\r
 \r
 asdcp-unwrap.exe: libasdcp.lib asdcp-unwrap.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:asdcp-unwrap.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:asdcp-unwrap.exe $** Advapi32.lib user32.lib\r
 \r
 asdcp-info.exe: libasdcp.lib asdcp-info.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:asdcp-info.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:asdcp-info.exe $** Advapi32.lib user32.lib\r
 \r
 asdcp-util.exe: libasdcp.lib asdcp-util.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:asdcp-util.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:asdcp-util.exe $** Advapi32.lib user32.lib\r
 \r
 j2c-test.exe: libasdcp.lib j2c-test.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:j2c-test.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:j2c-test.exe $** Advapi32.lib user32.lib\r
 \r
 !IFDEF USE_AS_02\r
 as-02-wrap.exe: libas02.lib as-02-wrap.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:as-02-wrap.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:as-02-wrap.exe $** Advapi32.lib user32.lib\r
 \r
 as-02-unwrap.exe: libas02.lib as-02-unwrap.obj\r
-       $(LINK) $(LINKFLAGS) /OUT:as-02-unwrap.exe $** Advapi32.lib\r
+       $(LINK) $(LINKFLAGS) /OUT:as-02-unwrap.exe $** Advapi32.lib user32.lib\r
+!ENDIF\r
+\r
+!IFDEF USE_PHDR\r
+phdr-wrap.exe: libas02-phdr.lib phdr-wrap.obj\r
+       $(LINK) $(LINKFLAGS) /OUT:phdr-wrap.exe $** Advapi32.lib user32.lib\r
+\r
+phdr-unwrap.exe: libas02-phdr.lib phdr-unwrap.obj\r
+       $(LINK) $(LINKFLAGS) /OUT:phdr-unwrap.exe $** Advapi32.lib user32.lib\r
 !ENDIF\r
 \r
 \r