Fix Object ref not being written: this prevented GenericStreamTextBasedSet to be...
[asdcplib.git] / src / AS_02_internal.h
index 9153ac94b4c6d6c411a7b176e10bfdd1ad53685c..4be764d8935a30907a0248ca18d6dcbfb90ca579 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2011-2016, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
+Copyright (c) 2011-2018, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
 John Hurst
 
 All rights reserved.
@@ -107,6 +107,7 @@ namespace AS_02
 
        ui32_t GetDuration() const;
        void PushIndexEntry(const ASDCP::MXF::IndexTableSegment::IndexEntry&);
+       void SetEditRate(const ASDCP::Rational& edit_rate);
       };
 
 
@@ -179,6 +180,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,7 +189,7 @@ 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;
 
@@ -205,9 +208,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 )
          {
@@ -215,7 +216,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();
@@ -301,6 +309,7 @@ namespace AS_02
       virtual ~h__AS02WriterFrame();
 
       Result_t WriteEKLVPacket(const ASDCP::FrameBuffer& FrameBuf,const byte_t* EssenceUL,
+                              const ui32_t& MinEssenceElementBerLength,
                               AESEncContext* Ctx, HMACContext* HMAC);
     };