version roll
authormschroffel <mschroffel@cinecert.com>
Thu, 19 May 2016 21:38:17 +0000 (21:38 +0000)
committermschroffel <>
Thu, 19 May 2016 21:38:17 +0000 (21:38 +0000)
15 files changed:
configure.ac
src/AS_02_PCM.cpp
src/AS_DCP_ATMOS.cpp
src/AS_DCP_DCData.cpp
src/DCData_ByteStream_Parser.cpp
src/DCData_Sequence_Parser.cpp
src/Dict.cpp
src/KLV.cpp
src/KLV.h
src/MXF.cpp
src/MXFTypes.cpp
src/WavFileWriter.h
src/asdcp-wrap.cpp
src/h__02_Reader.cpp
src/h__Reader.cpp

index 201348ea351aa3d8cddd109afc2c59ea7642a58a..8ba2bdca08af0dedda22fe8f357f3b8f05086e8a 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.5.14b], [asdcplib@cinecert.com])
+AC_INIT([asdcplib], [2.5.14], [asdcplib@cinecert.com])
 
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/KM_error.h])
index e58690aaafb97b63f2ef8d051b193c458bc352be..8532887e5cc0209f198d81daa223af05af95c275 100644 (file)
@@ -106,7 +106,7 @@ AS_02::PCM::MXFReader::h__Reader::OpenRead(const std::string& filename, const AS
        {
          if ( ! UL(reader.Key()).MatchIgnoreStream(m_Dict->ul(MDD_WAVEssenceClip)) )
            {
-             const MDDEntry *entry = m_Dict->FindUL(reader.Key());
+             const MDDEntry *entry = m_Dict->FindULAnyVersion(reader.Key());
 
              if ( entry == 0 )
                {
index 518df745500c32807629585e4e31edfc18205cb1..f53ae714a2b4ccdce03fcffb05a095f096b45df8 100644 (file)
@@ -107,7 +107,7 @@ typedef std::list<MXF::InterchangeObject*> SubDescriptorList_t;
 
 class ASDCP::ATMOS::MXFReader::h__Reader : public ASDCP::h__ASDCPReader
 {
-  MXF::DCDataDescriptor* m_EssenceDescriptor;
+  MXF::PrivateDCDataDescriptor* m_EssenceDescriptor;
   MXF::DolbyAtmosSubDescriptor* m_EssenceSubDescriptor;
 
   KM_NO_COPY_CONSTRUCT(h__Reader);
@@ -130,7 +130,7 @@ ASDCP::Result_t
 ASDCP::ATMOS::MXFReader::h__Reader::MD_to_DCData_DDesc(ASDCP::DCData::DCDataDescriptor& DDesc)
 {
   ASDCP_TEST_NULL(m_EssenceDescriptor);
-  MXF::DCDataDescriptor* DDescObj = m_EssenceDescriptor;
+  MXF::PrivateDCDataDescriptor* DDescObj = m_EssenceDescriptor;
   DDesc.EditRate = DDescObj->SampleRate;
   assert(DDescObj->ContainerDuration <= 0xFFFFFFFFL);
   DDesc.ContainerDuration = static_cast<ui32_t>(DDescObj->ContainerDuration);
@@ -170,13 +170,13 @@ ASDCP::ATMOS::MXFReader::h__Reader::OpenRead(const std::string& filename)
 
       if ( KM_SUCCESS(result) )
        {
-         m_EssenceDescriptor = static_cast<MXF::DCDataDescriptor*>(iObj);
+         m_EssenceDescriptor = static_cast<MXF::PrivateDCDataDescriptor*>(iObj);
        }
     }
 
   if ( m_EssenceDescriptor == 0 )
     {
-      DefaultLogSink().Error("DCDataDescriptor object not found.\n");
+      DefaultLogSink().Error("DCDataDescriptor object not found in Atmos file.\n");
       result = RESULT_FORMAT;
     }
 
@@ -420,7 +420,7 @@ ASDCP::Result_t
 ASDCP::ATMOS::MXFWriter::h__Writer::DCData_DDesc_to_MD(ASDCP::DCData::DCDataDescriptor& DDesc)
 {
   ASDCP_TEST_NULL(m_EssenceDescriptor);
-  MXF::DCDataDescriptor* DDescObj = static_cast<MXF::DCDataDescriptor *>(m_EssenceDescriptor);
+  MXF::PrivateDCDataDescriptor* DDescObj = static_cast<MXF::PrivateDCDataDescriptor *>(m_EssenceDescriptor);
 
   DDescObj->SampleRate = DDesc.EditRate;
   DDescObj->ContainerDuration = DDesc.ContainerDuration;
@@ -456,7 +456,7 @@ ASDCP::ATMOS::MXFWriter::h__Writer::OpenWrite(const std::string& filename, ui32_
   if ( ASDCP_SUCCESS(result) )
     {
       m_HeaderSize = HeaderSize;
-      m_EssenceDescriptor = new MXF::DCDataDescriptor(m_Dict);
+      m_EssenceDescriptor = new MXF::PrivateDCDataDescriptor(m_Dict);
       m_EssenceSubDescriptor = new DolbyAtmosSubDescriptor(m_Dict);
       SubDescriptorList_t subDescriptors;
       subDescriptors.push_back(m_EssenceSubDescriptor);
index ef4d6d4c86590786bc87ed282edce42a79a66f09..208e8520a12ce6c397d8abbb607e381e94aa0294 100644 (file)
@@ -150,7 +150,7 @@ ASDCP::DCData::MXFReader::h__Reader::OpenRead(const std::string& filename)
 
       if ( KM_FAILURE(result) )
        {
-         DefaultLogSink().Error("DCDataDescriptor object not found.\n");
+         DefaultLogSink().Error("DCDataDescriptor object not found in ST 429-14 file.\n");
          result = RESULT_FORMAT;
        }
     }
index 28e18694486ebde72e73b4b083c323f65652fc1f..6025e3be9a0714dba7c6fe2d6ba3c81c0bf2fa9e 100644 (file)
@@ -24,7 +24,7 @@ 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    AtmosSyncChannel_Mixer.h
+/*! \file    DCData_ByteStream_Parser.cpp
     \version $Id$
     \brief   AS-DCP library, Digital Cinema Data bytestream essence reader
 */
index de9f39a4dcd6513360db4d230b03b78123a5b064..28006daa0276fd03cc1d1169004e93cfc7fb154b 100644 (file)
@@ -24,7 +24,7 @@ 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    AtmosSyncChannel_Mixer.h
+/*! \file    DCData_Sequence_Parser.cpp
     \version $Id$
     \brief   AS-DCP library, DCinema data seqence reader implementation
 */
index 639e40fa9624c2784b99270c933b46c1efa6f558..a50a05eb3c9efa92b8db249cf9d50061aa2410be 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2006-2009, John Hurst
+Copyright (c) 2006-2016, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -195,6 +195,7 @@ ASDCP::Dictionary::AddEntry(const MDDEntry& Entry, ui32_t index)
 
   UL TmpUL(Entry.ul);
 
+#define MDD_AUTHORING_MODE
 #ifdef MDD_AUTHORING_MODE
   char buf[64];
   std::map<ASDCP::UL, ui32_t>::iterator ii = m_md_lookup.find(TmpUL);
@@ -253,26 +254,57 @@ ASDCP::Dictionary::Type(MDD_t type_id) const
 
 //
 const ASDCP::MDDEntry*
-ASDCP::Dictionary::FindUL(const byte_t* ul_buf) const
+ASDCP::Dictionary::FindULAnyVersion(const byte_t* ul_buf) const
 {
   assert(m_MDD_Table[0].name[0]);
-  std::map<UL, ui32_t>::const_iterator i = m_md_lookup.find(UL(ul_buf));
-  
-  if ( i == m_md_lookup.end() )
-    {
-      byte_t tmp_ul[SMPTE_UL_LENGTH];
-      memcpy(tmp_ul, ul_buf, SMPTE_UL_LENGTH);
-      tmp_ul[SMPTE_UL_LENGTH-1] = 0;
+  byte_t search_ul[SMPTE_UL_LENGTH];
+  memcpy(search_ul, ul_buf, SMPTE_UL_LENGTH);
+  memset(search_ul+7, 0, SMPTE_UL_LENGTH-7);
 
-      i = m_md_lookup.find(UL(tmp_ul));
+  UL target(ul_buf);
+  const ASDCP::MDDEntry *found_entry = 0;
 
-      if ( i == m_md_lookup.end() )
+  std::map<UL, ui32_t>::const_iterator lower = m_md_lookup.lower_bound(UL(search_ul));
+
+  for ( ; lower != m_md_lookup.end(); ++lower )
+    {
+      if ( lower->first.MatchExact(target) )
        {
-         char buf[64];
-         UL TmpUL(ul_buf);
-         Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL: %s\n", TmpUL.EncodeString(buf, 64));
-         return 0;
+         found_entry = &m_MDD_Table[lower->second];
+         break;
        }
+      else if ( found_entry == 0 && lower->first.MatchIgnoreStream(target) )
+       {
+         found_entry = &m_MDD_Table[lower->second];
+       }
+      else if ( found_entry != 0 && ! lower->first.MatchIgnoreStream(target) )
+       {
+         break;
+       }
+    }
+
+  if ( found_entry == 0 )
+    {
+      char buf[64];
+      Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL: %s\n", target.EncodeString(buf, 64));
+    }
+
+  return found_entry;
+}
+
+//
+const ASDCP::MDDEntry*
+ASDCP::Dictionary::FindULExact(const byte_t* ul_buf) const
+{
+  assert(m_MDD_Table[0].name[0]);
+  std::map<UL, ui32_t>::const_iterator i = m_md_lookup.find(UL(ul_buf));
+  
+  if ( i == m_md_lookup.end() )
+    {
+      char buf[64];
+      UL tmp_ul(ul_buf);
+      Kumu::DefaultLogSink().Warn("UL Dictionary: unknown UL: %s\n", tmp_ul.EncodeString(buf, 64));
+      return 0;
     }
 
   return &m_MDD_Table[i->second];
index 24a90a597d25d4b72ee0ffcd41f8f68e403567f3..b9a5d63433263289a875815ae7313c7cc9d81a48 100755 (executable)
@@ -171,7 +171,7 @@ ASDCP::KLVPacket::Dump(FILE* stream, const Dictionary& Dict, bool show_value)
       UL TmpUL(m_KeyStart);
       fprintf(stream, "%s", TmpUL.EncodeString(buf, 64));
 
-      const MDDEntry* Entry = Dict.FindUL(m_KeyStart);
+      const MDDEntry* Entry = Dict.FindULAnyVersion(m_KeyStart);
       fprintf(stream, "  len: %7qu (%s)\n", m_ValueLength, (Entry ? Entry->name : "Unknown"));
 
       if ( show_value && m_ValueLength < 1000 )
index 9bb1cb3fb7e2be0cdd5f9d79f56c1c3f1f8dfaba..ae2dee8dd3a3cefd14647715791b59c56241d8e0 100755 (executable)
--- a/src/KLV.h
+++ b/src/KLV.h
@@ -107,9 +107,8 @@ inline const char* ui64sz(ui64_t i, char* buf)
 
       const char* EncodeString(char* str_buf, ui32_t buf_len) const;
       bool operator==(const UL& rhs) const;
-      bool operator<(const UL& rhs) const;
       bool MatchIgnoreStream(const UL& rhs) const;
-      bool ExactMatch(const UL& rhs) const;
+      bool MatchExact(const UL& rhs) const;
     };
 
   // UMID
@@ -160,7 +159,8 @@ inline const char* ui64sz(ui64_t i, char* buf)
       bool AddEntry(const MDDEntry& Entry, ui32_t index);
       bool DeleteEntry(ui32_t index);
 
-      const MDDEntry* FindUL(const byte_t*) const;
+      const MDDEntry* FindULAnyVersion(const byte_t*) const;
+      const MDDEntry* FindULExact(const byte_t*) const;
       const MDDEntry* FindSymbol(const std::string&) const;
       const MDDEntry& Type(MDD_t type_id) const;
 
index 258bdbf75a9b029999c3e375eef7d2624ae46fed..92ae5bbd0902e7080fff838e446dee3961bd23c0 100755 (executable)
@@ -575,7 +575,7 @@ ASDCP::MXF::Primer::Dump(FILE* stream)
   Batch<LocalTagEntry>::iterator i = LocalTagEntryBatch.begin();
   for ( ; i != LocalTagEntryBatch.end(); i++ )
     {
-      const MDDEntry* Entry = m_Dict->FindUL((*i).UL.Value());
+      const MDDEntry* Entry = m_Dict->FindULAnyVersion((*i).UL.Value());
       fprintf(stream, "  %s %s\n", (*i).EncodeString(identbuf, IdentBufferLen), (Entry ? Entry->name : "Unknown"));
     }
 }
@@ -702,11 +702,11 @@ ASDCP::MXF::OP1aHeader::InitFromFile(const Kumu::FileReader& Reader)
   if ( m_Dict == &DefaultCompositeDict() )
     {
       // select more explicit dictionary if one is available
-      if ( OperationalPattern.ExactMatch(MXFInterop_OPAtom_Entry().ul) )
+      if ( OperationalPattern.MatchExact(MXFInterop_OPAtom_Entry().ul) )
        {
          m_Dict = &DefaultInteropDict();
        }
-      else if ( OperationalPattern.ExactMatch(SMPTE_390_OPAtom_Entry().ul) )
+      else if ( OperationalPattern.MatchExact(SMPTE_390_OPAtom_Entry().ul) )
        {
          m_Dict = &DefaultSMPTEDict();
        }
index 9e481e2e35f5c6e63aad8038af26cefc54775cc7..b2557f760061f25d7e5d567222878e13a6812b7a 100755 (executable)
@@ -65,72 +65,6 @@ ASDCP::UL::operator==(const UL& rhs) const
   return false;
 }
 
-
-//
-bool
-ASDCP::UL::operator<(const UL& rhs) const
-{
-  if ( m_Value[0] < rhs.m_Value[0] ) return true;
-  if ( m_Value[0] == rhs.m_Value[0] )
-    {
-      if ( m_Value[1] < rhs.m_Value[1] ) return true;
-      if ( m_Value[1] == rhs.m_Value[1] )
-       {
-         if ( m_Value[2] < rhs.m_Value[2] ) return true;
-         if ( m_Value[2] == rhs.m_Value[2] )
-           {
-             if ( m_Value[3] < rhs.m_Value[3] ) return true;
-             if ( m_Value[3] == rhs.m_Value[3] )
-               {
-                 if ( m_Value[4] < rhs.m_Value[4] ) return true;
-                 if ( m_Value[4] == rhs.m_Value[4] )
-                   {
-                     if ( m_Value[5] < rhs.m_Value[5] ) return true;
-                     if ( m_Value[5] == rhs.m_Value[5] )
-                       {
-                         if ( m_Value[6] < rhs.m_Value[6] ) return true;
-                         if ( m_Value[6] == rhs.m_Value[6] )
-                           {
-                             if ( m_Value[8] < rhs.m_Value[8] ) return true;
-                             if ( m_Value[8] == rhs.m_Value[8] )
-                               {
-                                 if ( m_Value[9] < rhs.m_Value[9] ) return true;
-                                 if ( m_Value[9] == rhs.m_Value[9] )
-                                   {
-                                     if ( m_Value[10] < rhs.m_Value[10] ) return true;
-                                     if ( m_Value[10] == rhs.m_Value[10] )
-                                       {
-                                         if ( m_Value[11] < rhs.m_Value[11] ) return true;
-                                         if ( m_Value[11] == rhs.m_Value[11] )
-                                           {
-                                             if ( m_Value[12] < rhs.m_Value[12] ) return true;
-                                             if ( m_Value[12] == rhs.m_Value[12] )
-                                               {
-                                                 if ( m_Value[13] < rhs.m_Value[13] ) return true;
-                                                 if ( m_Value[13] == rhs.m_Value[13] )
-                                                   {
-                                                     if ( m_Value[14] < rhs.m_Value[14] ) return true;
-                                                     if ( m_Value[14] == rhs.m_Value[14] )
-                                                       {
-                                                         if ( m_Value[15] < rhs.m_Value[15] ) return true;
-                                                       }
-                                                   }
-                                               }
-                                           }
-                                       }
-                                   }
-                               }
-                           }
-                       }
-                   }
-               }
-           }
-       }
-    }
-
-  return false;
-}
-
 //
 bool
 ASDCP::UL::MatchIgnoreStream(const UL& rhs) const
@@ -159,7 +93,7 @@ ASDCP::UL::MatchIgnoreStream(const UL& rhs) const
 
 //
 bool
-ASDCP::UL::ExactMatch(const UL& rhs) const
+ASDCP::UL::MatchExact(const UL& rhs) const
 {
   if ( m_Value[0] == rhs.m_Value[0] &&
        m_Value[1] == rhs.m_Value[1] &&
index 6f507c8e9b6b715606ac2d8a56bd783131313696..f5a5495bd5838745a31170dd1e47f6f2a86dad21 100755 (executable)
@@ -154,7 +154,7 @@ class WavFileWriter
       {
           for ( ui32_t i = 0; i < file_count && ASDCP_SUCCESS(result); i++ )
           {
-              snprintf(filename, Kumu::MaxFilePath, "%s_%u.wav", file_root, (i + 1));
+              snprintf(filename, Kumu::MaxFilePath, "%s_%02u.wav", file_root, (i + 1));
               m_OutFile.push_back(new WavFileElement(element_size));
               result = m_OutFile.back()->OpenWrite(filename);
 
index 7d730d47ba7549e2fecdfa75d6215ec80453af1a..e8bf2f1960db5b5e888099c1f532e7e3ab5c889e 100755 (executable)
@@ -1151,6 +1151,11 @@ write_PCM_with_ATMOS_sync_file(CommandOptions& Options)
   // set up MXF writer
   if ( ASDCP_SUCCESS(result) )
   {
+    if ( Mixer.ChannelCount() % 2 != 0 )
+      {
+        result = Mixer.AppendSilenceChannels(1);
+      }
+
     Mixer.FillAudioDescriptor(ADesc);
 
     ADesc.EditRate = PictureRate;
index 45825f07755403a7ed67d1b17af9327b771a10b8..d85259244cd42eb82b4d333f0aae9f7b593e7b6d 100644 (file)
@@ -409,7 +409,7 @@ AS_02::h__AS02Reader::OpenMXFRead(const char* filename)
       if ( m_HeaderPart.OperationalPattern != OP1a_ul )
        {
          char strbuf[IdentBufferLen];
-         const MDDEntry* Entry = m_Dict->FindUL(m_HeaderPart.OperationalPattern.Value());
+         const MDDEntry* Entry = m_Dict->FindULAnyVersion(m_HeaderPart.OperationalPattern.Value());
 
          if ( Entry == 0 )
            {
index d0c5168929f0889aad076b5f66e36599cee11187..a764767fc99837062595229503fbcf17e98bfc26 100755 (executable)
@@ -84,18 +84,18 @@ ASDCP::h__ASDCPReader::OpenMXFRead(const std::string& filename)
 
       m_Info.LabelSetType = LS_MXF_UNKNOWN;
 
-      if ( m_HeaderPart.OperationalPattern.ExactMatch(MXFInterop_OPAtom_Entry().ul) )
+      if ( m_HeaderPart.OperationalPattern.MatchExact(MXFInterop_OPAtom_Entry().ul) )
        {
          m_Info.LabelSetType = LS_MXF_INTEROP;
        }
-      else if ( m_HeaderPart.OperationalPattern.ExactMatch(SMPTE_390_OPAtom_Entry().ul) )
+      else if ( m_HeaderPart.OperationalPattern.MatchExact(SMPTE_390_OPAtom_Entry().ul) )
        {
          m_Info.LabelSetType = LS_MXF_SMPTE;
        }
       else
        {
          char strbuf[IdentBufferLen];
-         const MDDEntry* Entry = m_Dict->FindUL(m_HeaderPart.OperationalPattern.Value());
+         const MDDEntry* Entry = m_Dict->FindULExact(m_HeaderPart.OperationalPattern.Value());
 
          if ( Entry == 0 )
            {
@@ -312,7 +312,7 @@ ASDCP::Read_EKLV_Packet(Kumu::FileReader& File, const ASDCP::Dictionary& Dict,
       if ( ! UL(ess_p).MatchIgnoreStream(EssenceUL) ) // ignore the stream number
        {
          char strbuf[IntBufferLen];
-         const MDDEntry* Entry = Dict.FindUL(Key.Value());
+         const MDDEntry* Entry = Dict.FindULAnyVersion(Key.Value());
 
          if ( Entry == 0 )
            {
@@ -431,7 +431,7 @@ ASDCP::Read_EKLV_Packet(Kumu::FileReader& File, const ASDCP::Dictionary& Dict,
   else
     {
       char strbuf[IntBufferLen];
-      const MDDEntry* Entry = Dict.FindUL(Key.Value());
+      const MDDEntry* Entry = Dict.FindULAnyVersion(Key.Value());
 
       if ( Entry == 0 )
        {