From f285ea055151fae2e13d71c2d0282201197a9143 Mon Sep 17 00:00:00 2001 From: jhurst Date: Mon, 3 Jun 2013 00:12:31 +0000 Subject: the big-pre-as-02-refactor --- src/AS_DCP_DCData.cpp | 68 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 21 deletions(-) (limited to 'src/AS_DCP_DCData.cpp') diff --git a/src/AS_DCP_DCData.cpp b/src/AS_DCP_DCData.cpp index 53e4497..6ee1098 100644 --- a/src/AS_DCP_DCData.cpp +++ b/src/AS_DCP_DCData.cpp @@ -39,7 +39,7 @@ namespace ASDCP { namespace DCData { - static std::string DC_DATA_PACKAGE_LABEL = "File Package: SMPTE 382M frame wrapping of D-Cinema Generic data"; + static std::string DC_DATA_PACKAGE_LABEL = "File Package: SMPTE-GC frame wrapping of D-Cinema Generic data"; static std::string DC_DATA_DEF_LABEL = "D-Cinema Generic Data Track"; } // namespace DCData } // namespace ASDCP @@ -128,12 +128,6 @@ ASDCP::DCData::h__Reader::OpenRead(const char* filename) return RESULT_FORMAT; } - if( ASDCP_SUCCESS(result) ) - result = InitMXFIndex(); - - if( ASDCP_SUCCESS(result) ) - result = InitInfo(); - return result; } @@ -161,6 +155,7 @@ class ASDCP::DCData::MXFReader::h__Reader : public DCData::h__Reader public: h__Reader(const Dictionary& d) : DCData::h__Reader(d) {} + virtual ~h__Reader() {} }; @@ -198,13 +193,13 @@ ASDCP::DCData::MXFReader::~MXFReader() // Warning: direct manipulation of MXF structures can interfere // with the normal operation of the wrapper. Caveat emptor! // -ASDCP::MXF::OPAtomHeader& -ASDCP::DCData::MXFReader::OPAtomHeader() +ASDCP::MXF::OP1aHeader& +ASDCP::DCData::MXFReader::OP1aHeader() { if ( m_Reader.empty() ) { - assert(g_OPAtomHeader); - return *g_OPAtomHeader; + assert(g_OP1aHeader); + return *g_OP1aHeader; } return m_Reader->m_HeaderPart; @@ -222,7 +217,22 @@ ASDCP::DCData::MXFReader::OPAtomIndexFooter() return *g_OPAtomIndexFooter; } - return m_Reader->m_FooterPart; + return m_Reader->m_IndexAccess; +} + +// Warning: direct manipulation of MXF structures can interfere +// with the normal operation of the wrapper. Caveat emptor! +// +ASDCP::MXF::RIP& +ASDCP::DCData::MXFReader::RIP() +{ + if ( m_Reader.empty() ) + { + assert(g_RIP); + return *g_RIP; + } + + return m_Reader->m_RIP; } // Open the file for reading. The file must exist. Returns error if the @@ -294,7 +304,7 @@ void ASDCP::DCData::MXFReader::DumpIndex(FILE* stream) const { if ( m_Reader->m_File.IsOpen() ) - m_Reader->m_FooterPart.Dump(stream); + m_Reader->m_IndexAccess.Dump(stream); } // @@ -398,9 +408,9 @@ ASDCP::DCData::h__Writer::SetSourceStream(DCDataDescriptor const& DDesc, { ui32_t TCFrameRate = m_DDesc.EditRate.Numerator; - result = WriteMXFHeader(packageLabel, UL(m_Dict->ul(MDD_DCDataWrapping)), - defLabel, UL(m_EssenceUL), UL(m_Dict->ul(MDD_DataDataDef)), - m_DDesc.EditRate, TCFrameRate); + result = WriteASDCPHeader(packageLabel, UL(m_Dict->ul(MDD_DCDataWrapping)), + defLabel, UL(m_EssenceUL), UL(m_Dict->ul(MDD_DataDataDef)), + m_DDesc.EditRate, TCFrameRate); } return result; @@ -441,7 +451,7 @@ ASDCP::DCData::h__Writer::Finalize() m_State.Goto_FINAL(); - return WriteMXFFooter(); + return WriteASDCPFooter(); } @@ -456,6 +466,7 @@ class ASDCP::DCData::MXFWriter::h__Writer : public DCData::h__Writer public: h__Writer(const Dictionary& d) : DCData::h__Writer(d) {} + virtual ~h__Writer() {} }; @@ -472,13 +483,13 @@ ASDCP::DCData::MXFWriter::~MXFWriter() // Warning: direct manipulation of MXF structures can interfere // with the normal operation of the wrapper. Caveat emptor! // -ASDCP::MXF::OPAtomHeader& -ASDCP::DCData::MXFWriter::OPAtomHeader() +ASDCP::MXF::OP1aHeader& +ASDCP::DCData::MXFWriter::OP1aHeader() { if ( m_Writer.empty() ) { - assert(g_OPAtomHeader); - return *g_OPAtomHeader; + assert(g_OP1aHeader); + return *g_OP1aHeader; } return m_Writer->m_HeaderPart; @@ -499,6 +510,21 @@ ASDCP::DCData::MXFWriter::OPAtomIndexFooter() return m_Writer->m_FooterPart; } +// Warning: direct manipulation of MXF structures can interfere +// with the normal operation of the wrapper. Caveat emptor! +// +ASDCP::MXF::RIP& +ASDCP::DCData::MXFWriter::RIP() +{ + if ( m_Writer.empty() ) + { + assert(g_RIP); + return *g_RIP; + } + + return m_Writer->m_RIP; +} + // Open the file for writing. The file must not exist. Returns error if // the operation cannot be completed. ASDCP::Result_t -- cgit v1.2.3