diff options
| author | jhurst <jhurst@cinecert.com> | 2009-05-18 05:18:32 +0000 |
|---|---|---|
| committer | jhurst <> | 2009-05-18 05:18:32 +0000 |
| commit | 65a8ec13b66c700b74788d3fc7525e91cf62bab0 (patch) | |
| tree | 15f588026b93aae7e65a4bf37ed4cffe8e4bc4ad /src/MXF.cpp | |
| parent | 111e0170052b57fc128a37fa02736015edb8c60f (diff) | |
massive dictionary re-factoring
Diffstat (limited to 'src/MXF.cpp')
| -rwxr-xr-x | src/MXF.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/MXF.cpp b/src/MXF.cpp index 2a70e7e..bf8b049 100755 --- a/src/MXF.cpp +++ b/src/MXF.cpp @@ -113,7 +113,7 @@ ASDCP::MXF::RIP::GetPairBySID(ui32_t SID, Pair& outPair) const ASDCP::Result_t ASDCP::MXF::RIP::InitFromFile(const Kumu::FileReader& Reader) { - Result_t result = KLVFilePacket::InitFromFile(Reader, Dict::ul(MDD_RandomIndexMetadata)); + Result_t result = KLVFilePacket::InitFromFile(Reader, m_Dict.ul(MDD_RandomIndexMetadata)); if ( ASDCP_SUCCESS(result) ) { @@ -136,7 +136,7 @@ ASDCP::MXF::RIP::WriteToFile(Kumu::FileWriter& Writer) Result_t result = Buffer.Capacity(RIPSize); if ( ASDCP_SUCCESS(result) ) - result = WriteKLToFile(Writer, Dict::ul(MDD_RandomIndexMetadata), RIPSize); + result = WriteKLToFile(Writer, m_Dict.ul(MDD_RandomIndexMetadata), RIPSize); if ( ASDCP_SUCCESS(result) ) { @@ -164,7 +164,7 @@ ASDCP::MXF::RIP::Dump(FILE* stream) if ( stream == 0 ) stream = stderr; - KLVFilePacket::Dump(stream, false); + KLVFilePacket::Dump(stream, m_Dict, false); PairArray.Dump(stream, false); } @@ -251,7 +251,8 @@ public: // -ASDCP::MXF::Partition::Partition() : +ASDCP::MXF::Partition::Partition(const Dictionary& d) : + m_Dict(d), MajorVersion(1), MinorVersion(2), KAGSize(1), ThisPartition(0), PreviousPartition(0), FooterPartition(0), HeaderByteCount(0), IndexByteCount(0), IndexSID(0), @@ -383,7 +384,7 @@ ASDCP::MXF::Partition::Dump(FILE* stream) if ( stream == 0 ) stream = stderr; - KLVFilePacket::Dump(stream, false); + KLVFilePacket::Dump(stream, m_Dict, false); fprintf(stream, " MajorVersion = %hu\n", MajorVersion); fprintf(stream, " MinorVersion = %hu\n", MinorVersion); fprintf(stream, " KAGSize = %u\n", KAGSize); @@ -396,7 +397,7 @@ ASDCP::MXF::Partition::Dump(FILE* stream) fprintf(stream, " BodyOffset = %s\n", ui64sz(BodyOffset, identbuf)); fprintf(stream, " BodySID = %u\n", BodySID); fprintf(stream, " OperationalPattern = %s\n", OperationalPattern.EncodeString(identbuf, IdentBufferLen)); - fputs("Essence Containers:\n", stream); EssenceContainers.Dump(stream, false); + fputs("Essence Containers:\n", stream); EssenceContainers.Dump(stream); } @@ -417,7 +418,7 @@ public: // -ASDCP::MXF::Primer::Primer() : m_LocalTag(0xff) {} +ASDCP::MXF::Primer::Primer(const Dictionary& d) : m_LocalTag(0xff), m_Dict(d) {} // ASDCP::MXF::Primer::~Primer() {} @@ -434,7 +435,7 @@ ASDCP::MXF::Primer::ClearTagList() ASDCP::Result_t ASDCP::MXF::Primer::InitFromBuffer(const byte_t* p, ui32_t l) { - Result_t result = KLVPacket::InitFromBuffer(p, l, Dict::ul(MDD_Primer)); + Result_t result = KLVPacket::InitFromBuffer(p, l, m_Dict.ul(MDD_Primer)); if ( ASDCP_SUCCESS(result) ) { @@ -481,7 +482,7 @@ ASDCP::MXF::Primer::WriteToBuffer(ASDCP::FrameBuffer& Buffer) if ( ASDCP_SUCCESS(result) ) { ui32_t packet_length = MemWRT.Length(); - result = WriteKLToBuffer(Buffer, Dict::ul(MDD_Primer), packet_length); + result = WriteKLToBuffer(Buffer, m_Dict.ul(MDD_Primer), packet_length); if ( ASDCP_SUCCESS(result) ) Buffer.Size(Buffer.Size() + packet_length); @@ -555,7 +556,7 @@ ASDCP::MXF::Primer::Dump(FILE* stream) if ( stream == 0 ) stream = stderr; - KLVPacket::Dump(stream, false); + KLVPacket::Dump(stream, m_Dict, false); fprintf(stream, "Primer: %u %s\n", (ui32_t)LocalTagEntryBatch.size(), ( LocalTagEntryBatch.size() == 1 ? "entry" : "entries" )); @@ -563,7 +564,7 @@ ASDCP::MXF::Primer::Dump(FILE* stream) Batch<LocalTagEntry>::iterator i = LocalTagEntryBatch.begin(); for ( ; i != LocalTagEntryBatch.end(); i++ ) { - const MDDEntry* Entry = Dict::FindUL((*i).UL.Value()); + const MDDEntry* Entry = m_Dict.FindUL((*i).UL.Value()); fprintf(stream, " %s %s\n", (*i).EncodeString(identbuf, IdentBufferLen), (Entry ? Entry->name : "Unknown")); } } @@ -610,7 +611,7 @@ ASDCP::MXF::Preface::WriteToTLVSet(TLVWriter& TLVSet) ASDCP::Result_t ASDCP::MXF::Preface::InitFromBuffer(const byte_t* p, ui32_t l) { - m_Typeinfo = &Dict::Type(MDD_Preface); + m_Typeinfo = &m_Dict.Type(MDD_Preface); return InterchangeObject::InitFromBuffer(p, l); } @@ -618,7 +619,7 @@ ASDCP::MXF::Preface::InitFromBuffer(const byte_t* p, ui32_t l) ASDCP::Result_t ASDCP::MXF::Preface::WriteToBuffer(ASDCP::FrameBuffer& Buffer) { - m_Typeinfo = &Dict::Type(MDD_Preface); + m_Typeinfo = &m_Dict.Type(MDD_Preface); return InterchangeObject::WriteToBuffer(Buffer); } @@ -646,7 +647,7 @@ ASDCP::MXF::Preface::Dump(FILE* stream) //------------------------------------------------------------------------------------------ // -ASDCP::MXF::OPAtomHeader::OPAtomHeader() : m_Preface(0), m_HasRIP(false) {} +ASDCP::MXF::OPAtomHeader::OPAtomHeader(const Dictionary& d) : Partition(d), m_Dict(d), m_RIP(d), m_Primer(d), m_Preface(0), m_HasRIP(false) {} ASDCP::MXF::OPAtomHeader::~OPAtomHeader() {} // @@ -701,13 +702,13 @@ ASDCP::MXF::OPAtomHeader::InitFromFile(const Kumu::FileReader& Reader) return result; // is it really OP-Atom? - UL OPAtomUL(Dict::ul(MDD_OPAtom)); - UL InteropOPAtomUL(Dict::ul(MDD_MXFInterop_OPAtom)); + UL OPAtomUL(m_Dict.ul(MDD_OPAtom)); + UL InteropOPAtomUL(m_Dict.ul(MDD_MXFInterop_OPAtom)); if ( ! ( OperationalPattern == OPAtomUL || OperationalPattern == InteropOPAtomUL ) ) { char strbuf[IdentBufferLen]; - const MDDEntry* Entry = Dict::FindUL(OperationalPattern.Value()); + const MDDEntry* Entry = m_Dict.FindUL(OperationalPattern.Value()); if ( Entry == 0 ) DefaultLogSink().Warn("Operational pattern is not OP-Atom: %s\n", OperationalPattern.EncodeString(strbuf, IdentBufferLen)); else @@ -771,7 +772,7 @@ ASDCP::MXF::OPAtomHeader::InitFromBuffer(const byte_t* p, ui32_t l) while ( ASDCP_SUCCESS(result) && p < end_p ) { // parse the packets and index them by uid, discard KLVFill items - InterchangeObject* object = CreateObject(p); + InterchangeObject* object = CreateObject(m_Dict, p); assert(object); object->m_Lookup = &m_Primer; @@ -782,11 +783,11 @@ ASDCP::MXF::OPAtomHeader::InitFromBuffer(const byte_t* p, ui32_t l) if ( ASDCP_SUCCESS(result) ) { - if ( object->IsA(Dict::ul(MDD_KLVFill)) ) + if ( object->IsA(m_Dict.ul(MDD_KLVFill)) ) { delete object; } - else if ( object->IsA(Dict::ul(MDD_Primer)) ) + else if ( object->IsA(m_Dict.ul(MDD_Primer)) ) { delete object; result = m_Primer.InitFromBuffer(redo_p, end_p - redo_p); @@ -795,7 +796,7 @@ ASDCP::MXF::OPAtomHeader::InitFromBuffer(const byte_t* p, ui32_t l) { m_PacketList->AddPacket(object); - if ( object->IsA(Dict::ul(MDD_Preface)) && m_Preface == 0 ) + if ( object->IsA(m_Dict.ul(MDD_Preface)) && m_Preface == 0 ) m_Preface = (Preface*)object; } } @@ -893,7 +894,7 @@ ASDCP::MXF::OPAtomHeader::WriteToFile(Kumu::FileWriter& Writer, ui32_t HeaderSiz if ( ASDCP_SUCCESS(result) ) { - UL TmpUL(Dict::ul(MDD_ClosedCompleteHeader)); + UL TmpUL(m_Dict.ul(MDD_ClosedCompleteHeader)); result = Partition::WriteToFile(Writer, TmpUL); } @@ -931,7 +932,7 @@ ASDCP::MXF::OPAtomHeader::WriteToFile(Kumu::FileWriter& Writer, ui32_t HeaderSiz } klv_fill_length -= kl_length; - result = WriteKLToFile(Writer, Dict::ul(MDD_KLVFill), klv_fill_length); + result = WriteKLToFile(Writer, m_Dict.ul(MDD_KLVFill), klv_fill_length); if ( ASDCP_SUCCESS(result) ) result = NilBuf.Capacity(klv_fill_length); @@ -969,7 +970,8 @@ ASDCP::MXF::OPAtomHeader::Dump(FILE* stream) //------------------------------------------------------------------------------------------ // -ASDCP::MXF::OPAtomIndexFooter::OPAtomIndexFooter() : +ASDCP::MXF::OPAtomIndexFooter::OPAtomIndexFooter(const Dictionary& d) : + Partition(d), m_Dict(d), m_CurrentSegment(0), m_BytesPerEditUnit(0), m_BodySID(0), m_ECOffset(0), m_Lookup(0) { @@ -1038,7 +1040,7 @@ ASDCP::MXF::OPAtomIndexFooter::InitFromBuffer(const byte_t* p, ui32_t l) while ( ASDCP_SUCCESS(result) && p < end_p ) { // parse the packets and index them by uid, discard KLVFill items - InterchangeObject* object = CreateObject(p); + InterchangeObject* object = CreateObject(m_Dict, p); assert(object); object->m_Lookup = m_Lookup; @@ -1107,7 +1109,7 @@ ASDCP::MXF::OPAtomIndexFooter::WriteToFile(Kumu::FileWriter& Writer, ui64_t dura if ( ASDCP_SUCCESS(result) ) { IndexByteCount = FooterBuffer.Size(); - UL FooterUL(Dict::ul(MDD_CompleteFooter)); + UL FooterUL(m_Dict.ul(MDD_CompleteFooter)); result = Partition::WriteToFile(Writer, FooterUL); } @@ -1181,7 +1183,7 @@ ASDCP::MXF::OPAtomIndexFooter::SetIndexParamsCBR(IPrimerLookup* lookup, ui32_t s m_BytesPerEditUnit = size; m_EditRate = Rate; - IndexTableSegment* Index = new IndexTableSegment; + IndexTableSegment* Index = new IndexTableSegment(m_Dict); AddChildObject(Index); Index->EditUnitByteCount = m_BytesPerEditUnit; Index->IndexEditRate = Rate; @@ -1211,7 +1213,7 @@ ASDCP::MXF::OPAtomIndexFooter::PushIndexEntry(const IndexTableSegment::IndexEntr // do we have an available segment? if ( m_CurrentSegment == 0 ) { // no, set up a new segment - m_CurrentSegment = new IndexTableSegment; + m_CurrentSegment = new IndexTableSegment(m_Dict); assert(m_CurrentSegment); AddChildObject(m_CurrentSegment); m_CurrentSegment->DeltaEntryArray.push_back(IndexTableSegment::DeltaEntry()); @@ -1223,7 +1225,7 @@ ASDCP::MXF::OPAtomIndexFooter::PushIndexEntry(const IndexTableSegment::IndexEntr m_CurrentSegment->IndexDuration = m_CurrentSegment->IndexEntryArray.size(); ui64_t StartPosition = m_CurrentSegment->IndexStartPosition + m_CurrentSegment->IndexDuration; - m_CurrentSegment = new IndexTableSegment; + m_CurrentSegment = new IndexTableSegment(m_Dict); assert(m_CurrentSegment); AddChildObject(m_CurrentSegment); m_CurrentSegment->DeltaEntryArray.push_back(IndexTableSegment::DeltaEntry()); @@ -1311,7 +1313,7 @@ ASDCP::MXF::InterchangeObject::Dump(FILE* stream) char identbuf[IdentBufferLen]; fputc('\n', stream); - KLVPacket::Dump(stream, false); + KLVPacket::Dump(stream, m_Dict, false); fprintf(stream, " InstanceUID = %s\n", InstanceUID.EncodeHex(identbuf, IdentBufferLen)); fprintf(stream, " GenerationUID = %s\n", GenerationUID.EncodeHex(identbuf, IdentBufferLen)); } @@ -1376,10 +1378,9 @@ ASDCP::MXF::SetObjectFactory(ASDCP::UL label, ASDCP::MXF::MXFObjectFactory_t fac s_FactoryList.Insert(label, factory); } - // ASDCP::MXF::InterchangeObject* -ASDCP::MXF::CreateObject(const byte_t* label) +ASDCP::MXF::CreateObject(const Dictionary& Dict, const UL& label) { if ( label == 0 ) return 0; @@ -1390,7 +1391,7 @@ ASDCP::MXF::CreateObject(const byte_t* label) if ( ! s_TypesInit ) { - MXF::Metadata_InitTypes(); + MXF::Metadata_InitTypes(Dict); s_TypesInit = true; } } @@ -1398,13 +1399,12 @@ ASDCP::MXF::CreateObject(const byte_t* label) FLi_t i = s_FactoryList.find(label); if ( i == s_FactoryList.end() ) - return new InterchangeObject; + return new InterchangeObject(Dict); - return i->second(); + return i->second(Dict); } - // // end MXF.cpp // |
