Added atmos support and new ULs per SMPTE 429-2:2013 - see README for deets.
[asdcplib.git] / src / h__Reader.cpp
index da2aca231019172eb08d2da2c962a4b28eb2270f..77d732f9f2aaae9536691767f8163fd5d7d65c18 100755 (executable)
@@ -75,19 +75,26 @@ ASDCP::h__ASDCPReader::OpenMXFRead(const char* filename)
 
   if ( KM_SUCCESS(result) )
     {
-      // if this is a three partition file, go to the body
-      // partition and read the partition pack
-      if ( m_HeaderPart.m_RIP.PairArray.size() > 2 )
-       {
-         Array<RIP::Pair>::iterator r_i = m_HeaderPart.m_RIP.PairArray.begin();
-         r_i++;
-         m_File.Seek((*r_i).ByteOffset);
-         result = m_BodyPart.InitFromFile(m_File);
-       }
+        // if this is a three partition file, go to the body
+        // partition and read the partition pack
+        if ( m_HeaderPart.m_RIP.PairArray.size() > 2 )
+        {
+            Array<RIP::Pair>::iterator r_i = m_HeaderPart.m_RIP.PairArray.begin();
+            r_i++;
+            m_File.Seek((*r_i).ByteOffset);
+            result = m_BodyPart.InitFromFile(m_File);
+            if( !ASDCP_SUCCESS(result) )
+            {
+                DefaultLogSink().Error("ASDCP::h__Reader::OpenMXFRead, m_BodyPart.InitFromFile failed\n");
+            }
+        }
     }
+    else
+      DefaultLogSink().Error("ASDCP::h__Reader::OpenMXFRead, TrackFileReader::OpenMXFRead failed\n");
+
 
   if ( KM_SUCCESS(result) )
-    m_HeaderPart.BodyOffset = m_File.Tell();
+      m_HeaderPart.BodyOffset = m_File.Tell();
 
   return result;
 }
@@ -148,6 +155,14 @@ ASDCP::h__ASDCPReader::ReadEKLVFrame(ui32_t FrameNum, ASDCP::FrameBuffer& FrameB
                                                                                     EssenceUL, Ctx, HMAC);
 }
 
+Result_t
+ASDCP::h__ASDCPReader::LocateFrame(ui32_t FrameNum, Kumu::fpos_t& streamOffset,
+                           i8_t& temporalOffset, i8_t& keyFrameOffset)
+{
+  return ASDCP::MXF::TrackFileReader<OPAtomHeader, OPAtomIndexFooter>::LocateFrame(m_HeaderPart, FrameNum,
+                                                                                   streamOffset, temporalOffset, keyFrameOffset);
+}
+
 
 //------------------------------------------------------------------------------------------
 //