o Fixed soundfield split-syntax fault (was tagging out-of-group channels with the...
authorjhurst <jhurst@cinecert.com>
Mon, 23 Jul 2018 15:44:25 +0000 (15:44 +0000)
committerjhurst <>
Mon, 23 Jul 2018 15:44:25 +0000 (15:44 +0000)
 o Added asdcp.decode_mca_string() subroutine

src/MXF.cpp

index 049953cd2ea7feb410f631c65c32603070aaf00f..df53b2183e7faa45ff4590ac7aaf9ee006a9680a 100755 (executable)
@@ -1493,7 +1493,7 @@ ASDCP::MXF::decode_mca_string(const std::string& s, const mca_label_map_t& label
 {
   std::string symbol_buf;
   channel_count = 0;
-  ASDCP::MXF::SoundfieldGroupLabelSubDescriptor *current_soundfield = 0;
+  ASDCP::MXF::SoundfieldGroupLabelSubDescriptor *current_soundfield = 0, *prev_soundfield = 0;
   std::string::const_iterator i;
 
   for ( i = s.begin(); i != s.end(); ++i )
@@ -1512,12 +1512,21 @@ ASDCP::MXF::decode_mca_string(const std::string& s, const mca_label_map_t& label
            }
          else if ( symbol_buf.empty() )
            {
-             DefaultLogSink().Error("Encountered '(', without leading soundfield group symbol.\n");
-             return false;
+             if ( prev_soundfield != 0 )
+               {
+                 current_soundfield = prev_soundfield;
+                 // appending to the existing soundfield group
+                 continue;
+               }
+             else
+               {
+                 DefaultLogSink().Error("Encountered '(', without leading soundfield group symbol.\n");
+                 return false;
+               }
            }
 
          mca_label_map_t::const_iterator i = labels.find(symbol_buf);
-      
+
          if ( i == labels.end() )
            {
              DefaultLogSink().Error("Unknown symbol: '%s'\n", symbol_buf.c_str());
@@ -1538,6 +1547,7 @@ ASDCP::MXF::decode_mca_string(const std::string& s, const mca_label_map_t& label
          current_soundfield->RFC5646SpokenLanguage = language;
          current_soundfield->MCALabelDictionaryID = i->second.ul;
          descriptor_list.push_back(reinterpret_cast<ASDCP::MXF::InterchangeObject*>(current_soundfield));
+         prev_soundfield = current_soundfield;
          symbol_buf.clear();
        }
       else if ( *i == ')' )
@@ -1576,6 +1586,7 @@ ASDCP::MXF::decode_mca_string(const std::string& s, const mca_label_map_t& label
          channel_descr->MCALabelDictionaryID = i->second.ul;
          descriptor_list.push_back(reinterpret_cast<ASDCP::MXF::InterchangeObject*>(channel_descr));
          symbol_buf.clear();
+         current_soundfield = 0;
        }
       else if ( *i == ',' )
        {