Bump patch version post tag.
[asdcplib.git] / src / MXFTypes.cpp
index a98a4d2fd701f42c4eb17d6d3156df56000b5f0f..72338bbfda5f3290f8de2b9990345e4c52e92ba9 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2016, John Hurst
+Copyright (c) 2005-2019, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -774,6 +774,63 @@ ASDCP::MXF::Raw::EncodeString(char* str_buf, ui32_t buf_len) const
   return str_buf;
 }
 
+
+//
+bool
+ASDCP::MXF::J2KExtendedCapabilitiesType::Archive(Kumu::MemIOWriter* Writer) const {
+  if ( ! Writer->WriteUi32BE(Pcap) )
+    {
+      return false;
+    }
+
+    if ( ! Ccap.Archive(Writer) )
+    {
+        return false;
+    }
+
+  return true;
+}
+
+//
+bool
+ASDCP::MXF::J2KExtendedCapabilitiesType::Unarchive(Kumu::MemIOReader* Reader) {
+  if ( ! Reader->ReadUi32BE(&Pcap) )
+    {
+      return false;
+    }
+
+ if ( ! Ccap.Unarchive(Reader) )
+    {
+        return false;
+    }
+
+  return true;
+}
+
+//
+const char*
+ASDCP::MXF::J2KExtendedCapabilitiesType::EncodeString(char* str_buf, ui32_t buf_len) const
+{
+  const int str_len = ( sizeof(ui16_t) + 1 ) * JP2K::MaxCapabilities;
+
+  if ( Pcap != 0 && buf_len > str_len )
+    {
+      for ( int i = 0; i < Ccap.size(); ++i )
+        {
+         snprintf(str_buf+(i*3), 4, "%02hx.", Ccap[i].value);
+        }
+
+      str_buf[str_len-1] = 0;
+    }
+  else
+    {
+      str_buf[0] = 0;
+    }
+
+  return str_buf;
+}
+
+
 //
 // end MXFTypes.cpp
 //