o Fixed Partiton and Preface version numbers in AS-02 files
[asdcplib.git] / src / AS_DCP_internal.h
index c1df8aded6b09910a19ea989fe31a4618d717d34..aaa9e606e09058ada3a0b38307b9d3d9b7db5ce4 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2004-2013, John Hurst
+Copyright (c) 2004-2016, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -122,6 +122,14 @@ namespace ASDCP
   { 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b,
     0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b };
 
+  // Version of MXF spec to which an MXF file conforms
+  enum MXFVersion
+  {
+    MXFVersion_2004,
+    MXFVersion_2011,
+    MXFVersion_MAX
+  };
+
   //------------------------------------------------------------------------------------------
   //
 
@@ -528,11 +536,11 @@ namespace ASDCP
 
        const MXF::RIP& GetRIP() const { return m_RIP; }
 
-       void InitHeader()
+       void InitHeader(const MXFVersion& mxf_ver)
        {
          assert(m_Dict);
          assert(m_EssenceDescriptor);
-
          m_HeaderPart.m_Primer.ClearTagList();
          m_HeaderPart.m_Preface = new Preface(m_Dict);
          m_HeaderPart.AddChildObject(m_HeaderPart.m_Preface);
@@ -542,6 +550,20 @@ namespace ASDCP
          m_HeaderPart.m_Preface->OperationalPattern = UL(m_Dict->ul(MDD_OP1a));
          m_HeaderPart.OperationalPattern = m_HeaderPart.m_Preface->OperationalPattern;
 
+         if ( mxf_ver == MXFVersion_2004 )
+           {
+             m_HeaderPart.MinorVersion = 2;
+             m_HeaderPart.m_Preface->Version = 258;
+             m_HeaderPart.m_Preface->ObjectModelVersion = 1;
+           }
+         else
+           {
+             assert(mxf_ver == MXFVersion_2011);
+             m_HeaderPart.MinorVersion = 3;
+             m_HeaderPart.m_Preface->Version = 259;
+             m_HeaderPart.m_Preface->ObjectModelVersion = 1;
+           }
+
          // Identification
          Identification* Ident = new Identification(m_Dict);
          m_HeaderPart.AddChildObject(Ident);