summaryrefslogtreecommitdiff
path: root/src/h__Reader.cpp
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2006-03-11 01:43:02 +0000
committerjhurst <>2006-03-11 01:43:02 +0000
commit9bfe9676115531eb76649e1ebd5e14b904b53ae2 (patch)
treedf29b4a9f7d1bbb00821560ac3bca69ec7982683 /src/h__Reader.cpp
parente73ef2046cf4f6beb730be071022aaedb3b44bba (diff)
metadata reformed...
Diffstat (limited to 'src/h__Reader.cpp')
-rwxr-xr-xsrc/h__Reader.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/h__Reader.cpp b/src/h__Reader.cpp
index 4c1cf12..95c510c 100755
--- a/src/h__Reader.cpp
+++ b/src/h__Reader.cpp
@@ -31,8 +31,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AS_DCP_internal.h"
#include "KLV.h"
-#include "MDD.h"
-#include <assert.h>
using namespace ASDCP;
using namespace ASDCP::MXF;
@@ -95,6 +93,7 @@ ASDCP::h__Reader::InitInfo(WriterInfo& Info)
Result_t
ASDCP::h__Reader::OpenMXFRead(const char* filename)
{
+ m_LastPosition = 0;
Result_t result = m_File.OpenRead(filename);
if ( ASDCP_SUCCESS(result) )
@@ -145,6 +144,9 @@ ASDCP::h__Reader::InitMXFIndex()
result = m_FooterPart.InitFromFile(m_File);
}
+ if ( ASDCP_SUCCESS(result) )
+ m_File.Seek(m_EssenceStart);
+
return result;
}
@@ -164,10 +166,15 @@ ASDCP::h__Reader::ReadEKLVPacket(ui32_t FrameNum, ASDCP::FrameBuffer& FrameBuf,
}
// get frame position and go read the frame's key and length
+ Result_t result = RESULT_OK;
ASDCP::KLVReader Reader;
ASDCP::fpos_t FilePosition = m_EssenceStart + TmpEntry.StreamOffset;
- Result_t result = m_File.Seek(FilePosition);
+ if ( FilePosition != m_LastPosition )
+ {
+ m_LastPosition = FilePosition;
+ result = m_File.Seek(FilePosition);
+ }
if ( ASDCP_SUCCESS(result) )
result = Reader.ReadKLFromFile(m_File);
@@ -179,6 +186,7 @@ ASDCP::h__Reader::ReadEKLVPacket(ui32_t FrameNum, ASDCP::FrameBuffer& FrameBuf,
UL InteropRef(CryptEssenceUL_Data);
UL SMPTERef(CryptEssenceUL_Data);
ui64_t PacketLength = Reader.Length();
+ m_LastPosition = m_LastPosition + Reader.KLLength() + PacketLength;
if ( Key == InteropRef || Key == SMPTERef )
{