X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2FMXF.h;h=6a9b14d47dca824db2cd5aa00242bcc614c30e15;hb=830570c46c4d39a8a5767f83875e3ef2f79ecc98;hp=a38b6dbcdd05b332f13e9b45e2324fe1a0d6e379;hpb=1c20f520f0ac0d44c64cc53991f12c84a416b48f;p=asdcplib.git diff --git a/src/MXF.h b/src/MXF.h index a38b6db..6a9b14d 100755 --- a/src/MXF.h +++ b/src/MXF.h @@ -40,6 +40,16 @@ namespace ASDCP { class InterchangeObject; + // + typedef ASDCP::MXF::InterchangeObject* (*MXFObjectFactory_t)(); + + // + void SetObjectFactory(UL label, MXFObjectFactory_t factory); + + // + InterchangeObject* CreateObject(const byte_t* label); + + // seek an open file handle to the start of the RIP KLV packet Result_t SeekToRIP(const Kumu::FileReader&); @@ -68,15 +78,16 @@ namespace ASDCP return str_buf; } - inline virtual bool Unarchive(Kumu::MemIOReader* Reader) { + inline bool HasValue() const { return true; } + inline ui32_t ArchiveLength() const { return sizeof(ui32_t) + sizeof(ui64_t); } + + inline bool Unarchive(Kumu::MemIOReader* Reader) { if ( ! Reader->ReadUi32BE(&BodySID) ) return false; if ( ! Reader->ReadUi64BE(&ByteOffset) ) return false; return true; } - inline virtual bool HasValue() const { return true; } - - inline virtual bool Archive(Kumu::MemIOWriter* Writer) const { + inline bool Archive(Kumu::MemIOWriter* Writer) const { if ( ! Writer->WriteUi32BE(BodySID) ) return false; if ( ! Writer->WriteUi64BE(ByteOffset) ) return false; return true; @@ -89,6 +100,7 @@ namespace ASDCP virtual ~RIP() {} virtual Result_t InitFromFile(const Kumu::FileReader& Reader); virtual Result_t WriteToFile(Kumu::FileWriter& Writer); + virtual Result_t GetPairBySID(ui32_t, Pair&) const; virtual void Dump(FILE* = 0); }; @@ -137,7 +149,7 @@ namespace ASDCP public: // - class LocalTagEntry + class LocalTagEntry : Kumu::IArchive { public: TagValue Tag; @@ -149,6 +161,9 @@ namespace ASDCP return str_buf; } + inline bool HasValue() const { return UL.HasValue(); } + inline ui32_t ArchiveLength() const { return 2 + UL.ArchiveLength(); } + inline bool Unarchive(Kumu::MemIOReader* Reader) { if ( ! Reader->ReadUi8(&Tag.a) ) return false; if ( ! Reader->ReadUi8(&Tag.b) ) return false; @@ -200,9 +215,6 @@ namespace ASDCP virtual void Dump(FILE* stream = 0); }; - // - InterchangeObject* CreateObject(const byte_t* label); - // class Preface : public InterchangeObject { @@ -238,7 +250,7 @@ namespace ASDCP public: // - class DeltaEntry + class DeltaEntry : public Kumu::IArchive { public: i8_t PosTableIndex; @@ -246,23 +258,30 @@ namespace ASDCP ui32_t ElementData; DeltaEntry() : PosTableIndex(-1), Slice(0), ElementData(0) {} + inline bool HasValue() const { return true; } + ui32_t ArchiveLength() const { return sizeof(ui32_t) + 2; } bool Unarchive(Kumu::MemIOReader* Reader); bool Archive(Kumu::MemIOWriter* Writer) const; const char* EncodeString(char* str_buf, ui32_t buf_len) const; }; // - class IndexEntry + class IndexEntry : public Kumu::IArchive { public: i8_t TemporalOffset; i8_t KeyFrameOffset; ui8_t Flags; ui64_t StreamOffset; + + // if you use these, you will need to change CBRIndexEntriesPerSegment in MXF.cpp + // to a more suitable value // std::list SliceOffset; // Array PosTable; IndexEntry() : TemporalOffset(0), KeyFrameOffset(0), Flags(0), StreamOffset() {} + inline bool HasValue() const { return true; } + ui32_t ArchiveLength() const { return sizeof(ui64_t) + 3; }; bool Unarchive(Kumu::MemIOReader* Reader); bool Archive(Kumu::MemIOWriter* Writer) const; const char* EncodeString(char* str_buf, ui32_t buf_len) const; @@ -290,7 +309,6 @@ namespace ASDCP //--------------------------------------------------------------------------------- // - class h__PacketList; // See MXF.cpp class Identification; class SourcePackage; @@ -311,7 +329,9 @@ namespace ASDCP virtual Result_t InitFromFile(const Kumu::FileReader& Reader); virtual Result_t WriteToFile(Kumu::FileWriter& Writer, ui32_t HeaderLength = 16384); virtual void Dump(FILE* = 0); + virtual Result_t GetMDObjectByID(const UUID&, InterchangeObject** = 0); virtual Result_t GetMDObjectByType(const byte_t*, InterchangeObject** = 0); + virtual Result_t GetMDObjectsByType(const byte_t* ObjectID, std::list& ObjectList); Identification* GetIdentification(); SourcePackage* GetSourcePackage(); }; @@ -336,7 +356,7 @@ namespace ASDCP virtual Result_t WriteToFile(Kumu::FileWriter& Writer, ui64_t duration); virtual void Dump(FILE* = 0); - virtual Result_t Lookup(ui32_t frame_num, IndexTableSegment::IndexEntry&); + virtual Result_t Lookup(ui32_t frame_num, IndexTableSegment::IndexEntry&) const; virtual void PushIndexEntry(const IndexTableSegment::IndexEntry&); virtual void SetIndexParamsCBR(IPrimerLookup* lookup, ui32_t size, const Rational& Rate); virtual void SetIndexParamsVBR(IPrimerLookup* lookup, const Rational& Rate, Kumu::fpos_t offset);