o Oops, mistakenly turned off timed-text ancillary resource decryption
[asdcplib.git] / src / AS_02_internal.h
index f67af68741d9748efb37ab9f6342a93b07ec865b..e068f8de2dd945e471a6933d5a2f0f86d70a7e5f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2011-2015, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
+Copyright (c) 2011-2018, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
 John Hurst
 
 All rights reserved.
@@ -179,6 +179,8 @@ namespace AS_02
 
        this->m_IndexWriter.SetPrimerLookup(&this->m_HeaderPart.m_Primer);
        this->m_RIP.PairArray.push_back(RIP::PartitionPair(0, 0)); // Header partition RIP entry
+       this->m_IndexWriter.MajorVersion = m_HeaderPart.MajorVersion;
+       this->m_IndexWriter.MinorVersion = m_HeaderPart.MinorVersion;
        this->m_IndexWriter.OperationalPattern = this->m_HeaderPart.OperationalPattern;
        this->m_IndexWriter.EssenceContainers = this->m_HeaderPart.EssenceContainers;
 
@@ -186,13 +188,15 @@ namespace AS_02
 
        if ( KM_SUCCESS(result) )
          {
-           this->m_PartitionSpace *= floor( EditRate.Quotient() + 0.5 );  // convert seconds to edit units
+           this->m_PartitionSpace *= (ui32_t)floor( EditRate.Quotient() + 0.5 );  // convert seconds to edit units
            this->m_ECStart = this->m_File.Tell();
            this->m_IndexWriter.IndexSID = 129;
 
            UL body_ul(this->m_Dict->ul(MDD_ClosedCompleteBodyPartition));
            Partition body_part(this->m_Dict);
            body_part.BodySID = 1;
+           body_part.MajorVersion = this->m_HeaderPart.MajorVersion;
+           body_part.MinorVersion = this->m_HeaderPart.MinorVersion;
            body_part.OperationalPattern = this->m_HeaderPart.OperationalPattern;
            body_part.EssenceContainers = this->m_HeaderPart.EssenceContainers;
            body_part.ThisPartition = this->m_ECStart;
@@ -203,9 +207,7 @@ namespace AS_02
        return result;
       }
 
-      // standard method of writing the header and footer of a completed AS-02 file
-      //
-      Result_t WriteAS02Footer()
+      void FlushIndexPartition()
       {
        if ( this->m_IndexWriter.GetDuration() > 0 )
          {
@@ -213,7 +215,14 @@ namespace AS_02
            this->m_IndexWriter.WriteToFile(this->m_File);
            this->m_RIP.PairArray.push_back(RIP::PartitionPair(0, this->m_IndexWriter.ThisPartition));
          }
-
+      }
+      
+      // standard method of writing the header and footer of a completed AS-02 file
+      //
+      Result_t WriteAS02Footer()
+      {
+       this->FlushIndexPartition();
+         
        // update all Duration properties
        ASDCP::MXF::Partition footer_part(this->m_Dict);
        DurationElementList_t::iterator dli = this->m_DurationUpdateList.begin();
@@ -231,6 +240,8 @@ namespace AS_02
        this->m_HeaderPart.FooterPartition = here;
 
        assert(this->m_Dict);
+       footer_part.MajorVersion = this->m_HeaderPart.MajorVersion;
+       footer_part.MinorVersion = this->m_HeaderPart.MinorVersion;
        footer_part.OperationalPattern = this->m_HeaderPart.OperationalPattern;
        footer_part.EssenceContainers = this->m_HeaderPart.EssenceContainers;
        footer_part.FooterPartition = here;