o Fixed ISXD bugs:
authorjhurst <jhurst@cinecert.com>
Tue, 12 Feb 2019 17:13:35 +0000 (09:13 -0800)
committerjhurst <jhurst@cinecert.com>
Tue, 12 Feb 2019 17:13:35 +0000 (09:13 -0800)
   o Incorrect UTF_8_Text_DataEssenceCoding UL
   o Incorrect ISXDDataEssenceDescriptor_NamespaceURI UL
   o Incorrect use of FrameWrappedISXDData UL
   o Incorrect use of FrameWrappedISXDContainer UL
 o Added KM_WIN32_UTF8 macro to protect old users from new ideas

src/AS_02_ISXD.cpp
src/KM_fileio.cpp
src/KM_fileio.h
src/MDD.cpp
src/as-02-wrap.cpp

index 1483bfb43dbb789afe72139eb755d75278239c55..f4e29c07ff592fc3b3100065f2a3a5da48fc0eb6 100644 (file)
@@ -289,7 +289,7 @@ AS_02::ISXD::MXFWriter::h__Writer::OpenWrite(const std::string& filename, const
                                             const ui32_t& PartitionSpace_sec, const ui32_t& HeaderSize)
 {
   m_DataEssenceDescriptor = new ISXDDataEssenceDescriptor(m_Dict);
-  m_DataEssenceDescriptor->DataEssenceCoding = m_Dict->ul(MDD_FrameWrappedISXDContainer);
+  m_DataEssenceDescriptor->DataEssenceCoding = m_Dict->ul(MDD_UTF_8_Text_DataEssenceCoding);
   m_DataEssenceDescriptor->SampleRate = edit_rate;
   m_DataEssenceDescriptor->NamespaceURI = isxd_document_namespace;
 
@@ -336,7 +336,7 @@ AS_02::ISXD::MXFWriter::h__Writer::SetSourceStream(const std::string& label, con
 
   if ( KM_SUCCESS(result) )
     {
-      result = WriteAS02Header(label, UL(m_Dict->ul(MDD_FrameWrappedISXDData)),
+      result = WriteAS02Header(label, UL(m_Dict->ul(MDD_FrameWrappedISXDContainer)),
                               PICT_DEF_LABEL, UL(m_EssenceUL), UL(m_Dict->ul(MDD_DataDataDef)),
                               edit_rate, derive_timecode_rate_from_edit_rate(edit_rate));
 
index 0dfa473dda79cbef35ee4557e7dae176a652342a..07c649fecc91343cb1d8ff0c317a3d5b61a6e54e 100644 (file)
@@ -762,6 +762,7 @@ Kumu::FileWriter::Writev(const byte_t* buf, ui32_t buf_len)
 
 
 #ifdef KM_WIN32
+#ifdef KM_WIN32_UTF8
 
 //
 Kumu::Result_t
@@ -808,6 +809,7 @@ Kumu::utf8_to_wbstr(const std::string& in, Kumu::ByteString& out)
   return RESULT_OK;
 }
 
+#endif // KM_WIN32_UTF8
 
 //------------------------------------------------------------------------------------------
 //
@@ -816,6 +818,7 @@ Kumu::Result_t
 Kumu::FileReader::OpenRead(const std::string& filename) const
 {
   const_cast<FileReader*>(this)->m_Filename = filename;
+#ifdef KM_WIN32_UTF8
   ByteString wb_filename;
   Result_t result = utf8_to_wbstr(m_Filename, wb_filename);
 
@@ -823,12 +826,17 @@ Kumu::FileReader::OpenRead(const std::string& filename) const
     {
       return result;
     }
+#endif
 
   // suppress popup window on error
   UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
 
+#ifdef KM_WIN32_UTF8
   const_cast<FileReader*>(this)->m_Handle =
             ::CreateFileW((wchar_t*)wb_filename.RoData(),
+#else
+  const_cast<FileReader*>(this)->m_Handle = ::CreateFileA(filename.c_str(),
+#endif
                          (GENERIC_READ),                // open for reading
                          FILE_SHARE_READ,               // share for reading
                          NULL,                          // no security
@@ -949,6 +957,7 @@ Kumu::Result_t
 Kumu::FileWriter::OpenWrite(const std::string& filename)
 {
   m_Filename = filename;
+#ifdef KM_WIN32_UTF8
   ByteString wb_filename;
   Result_t result = utf8_to_wbstr(m_Filename, wb_filename);
 
@@ -956,11 +965,16 @@ Kumu::FileWriter::OpenWrite(const std::string& filename)
     {
       return result;
     }
+#endif
 
   // suppress popup window on error
   UINT prev = ::SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
 
+#ifdef KM_WIN32_UTF8
   m_Handle = ::CreateFileW((wchar_t*)wb_filename.RoData(),
+#else
+  m_Handle = ::CreateFileA(filename.c_str(),
+#endif
                          (GENERIC_WRITE|GENERIC_READ),  // open for reading
                          FILE_SHARE_READ,               // share for reading
                          NULL,                          // no security
index bf258e69e3ed5b081d6569280478b6c3287dd42c..60e1e6a3c37988d61e5968841e9e224f8eece206 100755 (executable)
@@ -300,7 +300,7 @@ namespace Kumu
   Result_t WriteBufferIntoFile(const Kumu::ByteString& Buffer, const std::string& Filename);
 
 
-#ifdef KM_WIN32
+#ifdef KM_WIN32_UTF8
   //------------------------------------------------------------------------------------------
   // wide char support for win32 file I/O
   //------------------------------------------------------------------------------------------
index bdd9eb900cc5edb35c1ba1fe4292a67566e6e9f3..7a284e47d7464c8319df96022c00c435ae1ba1ec 100644 (file)
@@ -1538,13 +1538,13 @@ static const ASDCP::MDDEntry s_MDD_Table[] = {
        0x0e, 0x09, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00 },
      {0}, false, "ISXDDataEssenceDescriptor" },
    { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x05, // 495
-       0x0e, 0x09, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
+       0x0e, 0x09, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
      {0}, false, "ISXDDataEssenceDescriptor_NamespaceURI" },
    { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x05, // 496
-       0x0e, 0x09, 0x06, 0x06, 0x00, 0x00, 0x00, 0xff },
+       0x0e, 0x09, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
      {0}, false, "UTF_8_Text_DataEssenceCoding" },
    { { 0x06, 0x0e, 0x2b, 0x34, 0x02, 0x53, 0x01, 0x01, // 497-chk
-       0x0D, 0x01, 0x04, 0x01, 0x04, 0x01, 0x01, 0x00 },
+       0x0d, 0x01, 0x04, 0x01, 0x04, 0x01, 0x01, 0x00 },
      {0}, false, "TextBasedDMFramework" },
    { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x01, 0x01, 0x0D, // 498-chk
        0x06, 0x01, 0x01, 0x04, 0x05, 0x41, 0x01, 0x00 },
index 204feb0d2007b76ec610f3fdb82646d5ce1d96a8..de13d957047287172b4ddb85feaec0c69b9044d8 100755 (executable)
@@ -176,8 +176,8 @@ Options:\n\
   -t <min>          - Set RGB component minimum code value (default: 0)\n\
   -T <max>          - Set RGB component maximum code value (default: 1023)\n\
   -u                - Print UL catalog to stdout\n\
-  -u <URI>          - ISXD (RDD47) document URI (use 'auto' to read the\n\
-                      namespace name from the first edit unit\n\
+  -U <URI>          - ISXD (RDD47) document URI (use 'auto' to read the\n\
+                      namespace name from the first edit unit)\n\
   -v                - Verbose, prints informative messages to stderr\n\
   -W                - Read input file only, do not write source file\n\
   -x <int>          - Horizontal subsampling degree (default: 2)\n\