From fdf31e0105bf8272a6b7fa9c4039941dff37a271 Mon Sep 17 00:00:00 2001 From: jhurst Date: Sun, 26 Mar 2006 02:16:21 +0000 Subject: [PATCH] now reads/writes 3-partition files --- src/AS_DCP_JP2K.cpp | 14 ++++++++-- src/AS_DCP_MPEG2.cpp | 14 ++++++++-- src/AS_DCP_PCM.cpp | 15 ++++++++-- src/Dict.cpp | 23 +++++++++++++-- src/MDD.cpp | 4 +-- src/MXF.cpp | 4 ++- src/MXFTypes.h | 16 +++++------ src/h__Reader.cpp | 33 +++++++++++++++------- src/h__Writer.cpp | 66 ++++++++++++++++++++++++-------------------- src/klvwalk.cpp | 43 ----------------------------- 10 files changed, 126 insertions(+), 106 deletions(-) diff --git a/src/AS_DCP_JP2K.cpp b/src/AS_DCP_JP2K.cpp index bf276e7..f08203a 100755 --- a/src/AS_DCP_JP2K.cpp +++ b/src/AS_DCP_JP2K.cpp @@ -320,10 +320,14 @@ class ASDCP::JP2K::MXFWriter::h__Writer : public ASDCP::h__Writer public: PictureDescriptor m_PDesc; + byte_t m_EssenceUL[SMPTE_UL_LENGTH]; ASDCP_NO_COPY_CONSTRUCT(h__Writer); - h__Writer() : m_EssenceSubDescriptor(0) {} + h__Writer() : m_EssenceSubDescriptor(0) { + memset(m_EssenceUL, 0, SMPTE_UL_LENGTH); + } + ~h__Writer(){} Result_t OpenWrite(const char*, ui32_t HeaderSize); @@ -420,7 +424,11 @@ ASDCP::JP2K::MXFWriter::h__Writer::SetSourceStream(const PictureDescriptor& PDes m_PDesc.EditRate, 24 /* TCFrameRate */); if ( ASDCP_SUCCESS(result) ) - result = m_State.Goto_READY(); + { + memcpy(m_EssenceUL, Dict::ul(MDD_JPEG2000Essence), SMPTE_UL_LENGTH); + m_EssenceUL[SMPTE_UL_LENGTH-1] = 1; // first (and only) essence container + result = m_State.Goto_READY(); + } return result; } @@ -443,7 +451,7 @@ ASDCP::JP2K::MXFWriter::h__Writer::WriteFrame(const FrameBuffer& FrameBuf, AESEn Entry.StreamOffset = m_StreamOffset; if ( ASDCP_SUCCESS(result) ) - result = WriteEKLVPacket(FrameBuf, Dict::ul(MDD_JPEG2000Essence), Ctx, HMAC); + result = WriteEKLVPacket(FrameBuf, m_EssenceUL, Ctx, HMAC); if ( ASDCP_SUCCESS(result) ) { diff --git a/src/AS_DCP_MPEG2.cpp b/src/AS_DCP_MPEG2.cpp index 26988e4..e265848 100755 --- a/src/AS_DCP_MPEG2.cpp +++ b/src/AS_DCP_MPEG2.cpp @@ -387,10 +387,14 @@ class ASDCP::MPEG2::MXFWriter::h__Writer : public ASDCP::h__Writer public: VideoDescriptor m_VDesc; ui32_t m_GOPOffset; + byte_t m_EssenceUL[SMPTE_UL_LENGTH]; ASDCP_NO_COPY_CONSTRUCT(h__Writer); - h__Writer() : m_GOPOffset(0) {} + h__Writer() : m_GOPOffset(0) { + memset(m_EssenceUL, 0, SMPTE_UL_LENGTH); + } + ~h__Writer(){} Result_t OpenWrite(const char*, ui32_t HeaderSize); @@ -436,7 +440,11 @@ ASDCP::MPEG2::MXFWriter::h__Writer::SetSourceStream(const VideoDescriptor& VDesc m_VDesc.EditRate, 24 /* TCFrameRate */); if ( ASDCP_SUCCESS(result) ) - result = m_State.Goto_READY(); + { + memcpy(m_EssenceUL, Dict::ul(MDD_MPEG2Essence), SMPTE_UL_LENGTH); + m_EssenceUL[SMPTE_UL_LENGTH-1] = 1; // first (and only) essence container + result = m_State.Goto_READY(); + } return result; } @@ -459,7 +467,7 @@ ASDCP::MPEG2::MXFWriter::h__Writer::WriteFrame(const FrameBuffer& FrameBuf, AESE Entry.StreamOffset = m_StreamOffset; if ( ASDCP_SUCCESS(result) ) - result = WriteEKLVPacket(FrameBuf, Dict::ul(MDD_MPEG2Essence), Ctx, HMAC); + result = WriteEKLVPacket(FrameBuf, m_EssenceUL, Ctx, HMAC); if ( ASDCP_FAILURE(result) ) return result; diff --git a/src/AS_DCP_PCM.cpp b/src/AS_DCP_PCM.cpp index 9063210..8036745 100755 --- a/src/AS_DCP_PCM.cpp +++ b/src/AS_DCP_PCM.cpp @@ -312,10 +312,15 @@ class ASDCP::PCM::MXFWriter::h__Writer : public ASDCP::h__Writer { public: AudioDescriptor m_ADesc; + byte_t m_EssenceUL[SMPTE_UL_LENGTH]; + ASDCP_NO_COPY_CONSTRUCT(h__Writer); - h__Writer(){} + h__Writer(){ + memset(m_EssenceUL, 0, SMPTE_UL_LENGTH); + } + ~h__Writer(){} Result_t OpenWrite(const char*, ui32_t HeaderSize); @@ -379,7 +384,11 @@ ASDCP::PCM::MXFWriter::h__Writer::SetSourceStream(const AudioDescriptor& ADesc) m_ADesc.SampleRate, 24 /* TCFrameRate */, calc_CBR_frame_size(m_Info, m_ADesc)); if ( ASDCP_SUCCESS(result) ) - result = m_State.Goto_READY(); + { + memcpy(m_EssenceUL, Dict::ul(MDD_WAVEssence), SMPTE_UL_LENGTH); + m_EssenceUL[SMPTE_UL_LENGTH-1] = 1; // first (and only) essence container + result = m_State.Goto_READY(); + } return result; } @@ -397,7 +406,7 @@ ASDCP::PCM::MXFWriter::h__Writer::WriteFrame(const FrameBuffer& FrameBuf, AESEnc result = m_State.Goto_RUNNING(); // first time through if ( ASDCP_SUCCESS(result) ) - result = WriteEKLVPacket(FrameBuf, Dict::ul(MDD_WAVEssence), Ctx, HMAC); + result = WriteEKLVPacket(FrameBuf, m_EssenceUL, Ctx, HMAC); if ( ASDCP_SUCCESS(result) ) m_FramesWritten++; diff --git a/src/Dict.cpp b/src/Dict.cpp index fe29880..fa51fbd 100755 --- a/src/Dict.cpp +++ b/src/Dict.cpp @@ -30,10 +30,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "Mutex.h" #include "KLV.h" #include "MDD.cpp" #include +static ASDCP::Mutex s_Lock; static bool s_md_init = false; static std::map s_md_lookup; @@ -54,14 +56,29 @@ ASDCP::Dict::FindUL(const byte_t* ul_buf) { if ( ! s_md_init ) { - for ( ui32_t x = 0; x < s_MDD_Table_size; x++ ) - s_md_lookup.insert(std::map::value_type(UL(s_MDD_Table[x].ul), x)); + AutoMutex AL(s_Lock); + if ( ! s_md_init ) + { + for ( ui32_t x = 0; x < s_MDD_Table_size; x++ ) + s_md_lookup.insert(std::map::value_type(UL(s_MDD_Table[x].ul), x)); + + s_md_init = true; + } } std::map::iterator i = s_md_lookup.find(UL(ul_buf)); if ( i == s_md_lookup.end() ) - return 0; + { + byte_t tmp_ul[SMPTE_UL_LENGTH]; + memcpy(tmp_ul, ul_buf, SMPTE_UL_LENGTH); + tmp_ul[SMPTE_UL_LENGTH-1] = 0; + + i = s_md_lookup.find(UL(tmp_ul)); + + if ( i == s_md_lookup.end() ) + return 0; + } return &s_MDD_Table[(*i).second]; } diff --git a/src/MDD.cpp b/src/MDD.cpp index ba7007c..32d2c69 100644 --- a/src/MDD.cpp +++ b/src/MDD.cpp @@ -64,13 +64,13 @@ static const ASDCP::MDDEntry s_MDD_Table[] = { 0x0d, 0x01, 0x03, 0x01, 0x02, 0x06, 0x01, 0x00 }, {0}, false, "WAVWrapping" }, { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x02, // 10 - 0x0d, 0x01, 0x03, 0x01, 0x02, 0x04, 0x60, 0x01 }, + 0x0d, 0x01, 0x03, 0x01, 0x02, 0x04, 0x60, 0x00 }, {0}, false, "MPEG2_VESWrapping" }, { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x07, // 11 0x0d, 0x01, 0x03, 0x01, 0x02, 0x0c, 0x01, 0x00 }, {0}, false, "JPEG_2000Wrapping" }, { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x02, 0x01, 0x01, // 12 - 0x0d, 0x01, 0x03, 0x01, 0x15, 0x01, 0x08, 0x01 }, + 0x0d, 0x01, 0x03, 0x01, 0x15, 0x01, 0x08, 0x00 }, {0}, false, "JPEG2000Essence" }, { { 0x06, 0x0e, 0x2b, 0x34, 0x01, 0x02, 0x01, 0x01, // 13 0x0d, 0x01, 0x03, 0x01, 0x15, 0x01, 0x05, 0x00 }, diff --git a/src/MXF.cpp b/src/MXF.cpp index 413513c..ed16cab 100755 --- a/src/MXF.cpp +++ b/src/MXF.cpp @@ -200,7 +200,7 @@ ASDCP::MXF::Partition::Partition() : MajorVersion(1), MinorVersion(2), KAGSize(1), ThisPartition(0), PreviousPartition(0), FooterPartition(0), HeaderByteCount(0), IndexByteCount(0), IndexSID(0), - BodyOffset(0), BodySID(1) + BodyOffset(0), BodySID(0) { m_PacketList = new h__PacketList; } @@ -637,6 +637,8 @@ ASDCP::MXF::OPAtomHeader::InitFromFile(const ASDCP::FileReader& Reader) if ( ASDCP_SUCCESS(result) ) result = Partition::InitFromFile(Reader); // test UL and OP + Partition::Dump(); + // is it really OP-Atom? UL OPAtomUL(Dict::ul(MDD_OPAtom)); UL InteropOPAtomUL(Dict::ul(MDD_MXFInterop_OPAtom)); diff --git a/src/MXFTypes.h b/src/MXFTypes.h index 6c52463..e78b55c 100755 --- a/src/MXFTypes.h +++ b/src/MXFTypes.h @@ -124,7 +124,7 @@ namespace ASDCP return result; } - inline bool HasValue() const { return ! empty(); } + inline bool HasValue() const { return ! this->empty(); } // Result_t Archive(ASDCP::MemIOWriter& Writer) const { @@ -134,11 +134,11 @@ namespace ASDCP if ( ASDCP_SUCCESS(result) ) result = Writer.WriteUi32BE(0); - if ( ASDCP_FAILURE(result) || empty() ) + if ( ASDCP_FAILURE(result) || this->empty() ) return result; - typename std::vector::const_iterator l_i = begin(); - assert(l_i != end()); + typename std::vector::const_iterator l_i = this->begin(); + assert(l_i != this->end()); ui32_t ItemSize = Writer.Remainder(); result = (*l_i).Archive(Writer); @@ -146,7 +146,7 @@ namespace ASDCP i2p(ASDCP_i32_BE(ItemSize), p); l_i++; - for ( ; l_i != end() && ASDCP_SUCCESS(result); l_i++ ) + for ( ; l_i != this->end() && ASDCP_SUCCESS(result); l_i++ ) result = (*l_i).Archive(Writer); return result; @@ -187,14 +187,14 @@ namespace ASDCP return RESULT_OK; } - inline bool HasValue() const { return ! empty(); } + inline bool HasValue() const { return ! this->empty(); } // Result_t Archive(ASDCP::MemIOWriter& Writer) const { Result_t result = RESULT_OK; - typename std::list::const_iterator l_i = begin(); + typename std::list::const_iterator l_i = this->begin(); - for ( ; l_i != end() && ASDCP_SUCCESS(result); l_i++ ) + for ( ; l_i != this->end() && ASDCP_SUCCESS(result); l_i++ ) result = (*l_i).Archive(Writer); return result; diff --git a/src/h__Reader.cpp b/src/h__Reader.cpp index e958e34..7851953 100755 --- a/src/h__Reader.cpp +++ b/src/h__Reader.cpp @@ -112,14 +112,18 @@ ASDCP::h__Reader::OpenMXFRead(const char* filename) // partition and read off the partition pack if ( m_HeaderPart.m_RIP.PairArray.size() == 3 ) { - DefaultLogSink().Error("RIP count is 3: must write code...\n"); - return RESULT_FORMAT; + fprintf(stderr, "Three part!\n"); + Array::iterator r_i = m_HeaderPart.m_RIP.PairArray.begin(); + r_i++; + m_File.Seek((*r_i).ByteOffset); + + result = m_BodyPart.InitFromFile(m_File); + m_BodyPart.Dump(); + // TODO: check the partition pack to make sure it is + // really a body with a single essence container } - // TODO: check the partition pack to make sure it is - // really a body with a single essence container m_EssenceStart = m_File.Tell(); - return RESULT_OK; } @@ -208,12 +212,11 @@ ASDCP::h__Reader::ReadEKLVPacket(ui32_t FrameNum, ASDCP::FrameBuffer& FrameBuf, return result; UL Key(Reader.Key()); - UL CryptEssenceUL(Dict::ul(MDD_CryptEssence)); - UL InteropCryptEssenceUL(Dict::ul(MDD_MXFInterop_CryptEssence)); ui64_t PacketLength = Reader.Length(); m_LastPosition = m_LastPosition + Reader.KLLength() + PacketLength; - if ( Key == InteropCryptEssenceUL || Key == CryptEssenceUL ) + if ( memcmp(Key.Value(), Dict::ul(MDD_CryptEssence), Key.Size() - 1) == 0 // ignore the stream numbers + || memcmp(Key.Value(), Dict::ul(MDD_MXFInterop_CryptEssence), Key.Size() - 1) == 0 ) { if ( ! m_Info.EncryptedEssence ) { @@ -263,7 +266,17 @@ ASDCP::h__Reader::ReadEKLVPacket(ui32_t FrameNum, ASDCP::FrameBuffer& FrameBuf, if ( ! read_test_BER(&ess_p, SMPTE_UL_LENGTH) ) return RESULT_FORMAT; - // TODO: test essence UL + // test essence UL + if ( memcmp(ess_p, EssenceUL, SMPTE_UL_LENGTH - 1) != 0 ) // ignore the stream number + { + char strbuf[IntBufferLen]; + const MDDEntry* Entry = Dict::FindUL(Key.Value()); + if ( Entry == 0 ) + DefaultLogSink().Warn("Unexpected Essence UL found: %s.\n", Key.ToString(strbuf)); + else + DefaultLogSink().Warn("Unexpected Essence UL found: %s.\n", Entry->name); + return RESULT_FORMAT; + } ess_p += SMPTE_UL_LENGTH; // read SourceLength length @@ -328,7 +341,7 @@ ASDCP::h__Reader::ReadEKLVPacket(ui32_t FrameNum, ASDCP::FrameBuffer& FrameBuf, FrameBuf.PlaintextOffset(PlaintextOffset); } } - else if ( Key == EssenceUL ) + else if ( memcmp(Key.Value(), EssenceUL, Key.Size() - 1) == 0 ) // ignore the stream number { // read plaintext frame if ( FrameBuf.Capacity() < PacketLength ) { diff --git a/src/h__Writer.cpp b/src/h__Writer.cpp index 8fad4ed..1449748 100755 --- a/src/h__Writer.cpp +++ b/src/h__Writer.cpp @@ -38,7 +38,7 @@ using namespace ASDCP::MXF; // a magic number identifying asdcplib #ifndef ASDCP_BUILD_NUMBER -#define ASDCP_BUILD_NUMBER 0x4A48 +#define ASDCP_BUILD_NUMBER 0x6A68 #endif @@ -111,7 +111,7 @@ ASDCP::h__Writer::WriteMXFHeader(const std::string& PackageLabel, const UL& Wrap // so we tell the world by using OP1a m_HeaderPart.m_Preface->OperationalPattern = UL(Dict::ul(MDD_OP1a)); m_HeaderPart.OperationalPattern = m_HeaderPart.m_Preface->OperationalPattern; - m_HeaderPart.m_RIP.PairArray.push_back(RIP::Pair(1, 0)); // First RIP Entry + m_HeaderPart.m_RIP.PairArray.push_back(RIP::Pair(0, 0)); // First RIP Entry // // Identification @@ -125,7 +125,7 @@ ASDCP::h__Writer::WriteMXFHeader(const std::string& PackageLabel, const UL& Wrap Ident->ProductName = m_Info.ProductName.c_str(); Ident->VersionString = m_Info.ProductVersion.c_str(); Ident->ProductUID.Set(m_Info.ProductUUID); - // Ident->Platform = "Foonix"; // ASDCP_PLATFORM; + Ident->Platform = ASDCP_PLATFORM; Ident->ToolkitVersion.Major = VERSION_MAJOR; Ident->ToolkitVersion.Minor = VERSION_APIMINOR; Ident->ToolkitVersion.Patch = VERSION_IMPMINOR; @@ -148,11 +148,9 @@ ASDCP::h__Writer::WriteMXFHeader(const std::string& PackageLabel, const UL& Wrap // UMID PackageUMID; PackageUMID.MakeUMID(0x0f); // unidentified essence - m_MaterialPackage = new MaterialPackage; m_MaterialPackage->Name = "AS-DCP Material Package"; m_MaterialPackage->PackageUID = PackageUMID; - m_HeaderPart.AddChildObject(m_MaterialPackage); Storage->Packages.push_back(m_MaterialPackage->InstanceUID); @@ -262,7 +260,6 @@ ASDCP::h__Writer::WriteMXFHeader(const std::string& PackageLabel, const UL& Wrap { UL CryptEssenceUL(Dict::ul(MDD_EncryptedContainerLabel)); m_HeaderPart.EssenceContainers.push_back(CryptEssenceUL); - m_HeaderPart.m_Preface->EssenceContainers.push_back(CryptEssenceUL); m_HeaderPart.m_Preface->DMSchemes.push_back(UL(Dict::ul(MDD_CryptographicFrameworkLabel))); AddDMScrypt(m_HeaderPart, *m_FilePackage, m_Info, WrappingUL); } @@ -270,29 +267,43 @@ ASDCP::h__Writer::WriteMXFHeader(const std::string& PackageLabel, const UL& Wrap { m_HeaderPart.EssenceContainers.push_back(UL(Dict::ul(MDD_GCMulti))); m_HeaderPart.EssenceContainers.push_back(WrappingUL); - m_HeaderPart.m_Preface->EssenceContainers = m_HeaderPart.EssenceContainers; } + m_HeaderPart.m_Preface->EssenceContainers = m_HeaderPart.EssenceContainers; m_HeaderPart.AddChildObject(m_EssenceDescriptor); m_FilePackage->Descriptor = m_EssenceDescriptor->InstanceUID; // Write the header partition Result_t result = m_HeaderPart.WriteToFile(m_File, m_HeaderSize); - // - // Body Partition - // - + if ( ASDCP_SUCCESS(result) ) + { + // Body Partition + m_BodyPart.EssenceContainers = m_HeaderPart.EssenceContainers; + m_BodyPart.ThisPartition = m_File.Tell(); + m_BodyPart.BodySID = 1; + UL OPAtomUL(Dict::ul(MDD_OPAtom)); + + if ( m_Info.LabelSetType == LS_MXF_INTEROP ) + OPAtomUL.Set(Dict::ul(MDD_MXFInterop_OPAtom)); + + m_BodyPart.OperationalPattern = OPAtomUL; + m_HeaderPart.m_RIP.PairArray.push_back(RIP::Pair(1, m_BodyPart.ThisPartition)); // Second RIP Entry + + UL BodyUL(Dict::ul(MDD_ClosedCompleteBodyPartition)); + result = m_BodyPart.WriteToFile(m_File, BodyUL); + } - // - // Index setup - // - fpos_t ECoffset = m_File.Tell(); + if ( ASDCP_SUCCESS(result) ) + { + // Index setup + fpos_t ECoffset = m_File.Tell(); - if ( BytesPerEditUnit == 0 ) - m_FooterPart.SetIndexParamsVBR(&m_HeaderPart.m_Primer, EditRate, ECoffset); - else - m_FooterPart.SetIndexParamsCBR(&m_HeaderPart.m_Primer, BytesPerEditUnit, EditRate); + if ( BytesPerEditUnit == 0 ) + m_FooterPart.SetIndexParamsVBR(&m_HeaderPart.m_Primer, EditRate, ECoffset); + else + m_FooterPart.SetIndexParamsCBR(&m_HeaderPart.m_Primer, BytesPerEditUnit, EditRate); + } return result; } @@ -419,20 +430,14 @@ Result_t ASDCP::h__Writer::WriteMXFFooter() { // Set top-level file package correctly for OP-Atom - m_MPTCSequence->Duration = m_FramesWritten; - m_MPTimecode->Duration = m_FramesWritten; - m_MPClSequence->Duration = m_FramesWritten; - m_MPClip->Duration = m_FramesWritten; - m_FPTCSequence->Duration = m_FramesWritten; - m_FPTimecode->Duration = m_FramesWritten; - m_FPClSequence->Duration = m_FramesWritten; - m_FPClip->Duration = m_FramesWritten; - m_EssenceDescriptor->ContainerDuration = m_FramesWritten; + + m_MPTCSequence->Duration = m_MPTimecode->Duration = m_MPClSequence->Duration = m_MPClip->Duration = + m_FPTCSequence->Duration = m_FPTimecode->Duration = m_FPClSequence->Duration = m_FPClip->Duration = + m_EssenceDescriptor->ContainerDuration = m_FramesWritten; fpos_t here = m_File.Tell(); - m_HeaderPart.m_RIP.PairArray.push_back(RIP::Pair(1, here)); // Third RIP Entry + m_HeaderPart.m_RIP.PairArray.push_back(RIP::Pair(0, here)); // Third RIP Entry m_HeaderPart.FooterPartition = here; - m_HeaderPart.BodySID = 1; // re-label the partition UL OPAtomUL(Dict::ul(MDD_OPAtom)); @@ -443,6 +448,7 @@ ASDCP::h__Writer::WriteMXFFooter() m_HeaderPart.OperationalPattern = OPAtomUL; m_HeaderPart.m_Preface->OperationalPattern = m_HeaderPart.OperationalPattern; + m_FooterPart.PreviousPartition = m_BodyPart.ThisPartition; m_FooterPart.OperationalPattern = m_HeaderPart.OperationalPattern; m_FooterPart.EssenceContainers = m_HeaderPart.EssenceContainers; m_FooterPart.FooterPartition = here; diff --git a/src/klvwalk.cpp b/src/klvwalk.cpp index 5db8fac..b5b3cea 100755 --- a/src/klvwalk.cpp +++ b/src/klvwalk.cpp @@ -55,7 +55,6 @@ main(int argc, char** argv) { Result_t result = RESULT_OK; bool read_mxf = false; - bool rewrite_mxf = false; int arg_i = 1; set_debug_mode(true, true); @@ -64,12 +63,6 @@ main(int argc, char** argv) read_mxf = true; arg_i++; } - else if ( strcmp(argv[1], "-w") == 0 ) - { - rewrite_mxf = true; - arg_i++; - assert(argc - arg_i == 2); - } fprintf(stderr, "Opening file %s\n", argv[arg_i]); @@ -83,7 +76,6 @@ main(int argc, char** argv) if ( ASDCP_SUCCESS(result) ) result = Header.InitFromFile(Reader); - // if ( ASDCP_SUCCESS(result) ) Header.Dump(stdout); if ( ASDCP_SUCCESS(result) ) @@ -101,41 +93,6 @@ main(int argc, char** argv) Index.Dump(stdout); } } - else if ( rewrite_mxf ) - { - ASDCP::FileReader Reader; - ASDCP::FileWriter Writer; - ASDCP::MXF::OPAtomHeader Header; - ASDCP::MXF::OPAtomIndexFooter Index; - - result = Reader.OpenRead(argv[arg_i++]); - - if ( ASDCP_SUCCESS(result) ) - result = Header.InitFromFile(Reader); - - if ( ASDCP_SUCCESS(result) ) - result = Reader.Seek(Header.FooterPartition); - - if ( ASDCP_SUCCESS(result) ) - result = Index.InitFromFile(Reader); - - Header.m_Primer.ClearTagList(); - - if ( ASDCP_SUCCESS(result) ) - result = Writer.OpenWrite(argv[arg_i]); - - if ( ASDCP_SUCCESS(result) ) - result = Header.WriteToFile(Writer); - -// if ( ASDCP_SUCCESS(result) ) -// result = Index.WriteToFile(Writer); - - // essence packets - - // index - - // RIP - } else // dump klv { ASDCP::FileReader Reader; -- 2.30.2