X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2FMXF.h;h=6a9b14d47dca824db2cd5aa00242bcc614c30e15;hb=830570c46c4d39a8a5767f83875e3ef2f79ecc98;hp=076e999f1ef875dcce804e62c7d7f48e7d7e81ae;hpb=a526fabf937848823b02d5486a6ec38f8442bb1c;p=asdcplib.git diff --git a/src/MXF.h b/src/MXF.h index 076e999..6a9b14d 100755 --- a/src/MXF.h +++ b/src/MXF.h @@ -38,8 +38,20 @@ namespace ASDCP { namespace MXF { + 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 FileReader&); + Result_t SeekToRIP(const Kumu::FileReader&); // class RIP : public ASDCP::KLVFilePacket @@ -48,53 +60,60 @@ namespace ASDCP public: // - class Pair { - public: - ui32_t BodySID; - ui64_t ByteOffset; - - ui32_t Size() { return sizeof(ui32_t) + sizeof(ui64_t); } - - inline const char* ToString(char* str_buf) const { - char intbuf[IntBufferLen]; - sprintf(str_buf, "%-6lu: %s", BodySID, ui64sz(ByteOffset, intbuf)); - return str_buf; - } - - inline Result_t ReadFrom(ASDCP::MemIOReader& Reader) { - Result_t result = Reader.ReadUi32BE(&BodySID); + class Pair : public Kumu::IArchive + { + public: + ui32_t BodySID; + ui64_t ByteOffset; - if ( ASDCP_SUCCESS(result) ) - result = Reader.ReadUi64BE(&ByteOffset); + Pair() : BodySID(0), ByteOffset(0) {} + Pair(ui32_t sid, ui64_t offset) : BodySID(sid), ByteOffset(offset) {} + virtual ~Pair() {} - return result; - } + ui32_t Size() { return sizeof(ui32_t) + sizeof(ui64_t); } - inline Result_t WriteTo(ASDCP::MemIOWriter& Writer) { - Result_t result = Writer.WriteUi32BE(BodySID); + inline const char* EncodeString(char* str_buf, ui32_t buf_len) const { + Kumu::ui64Printer offset_str(ByteOffset); + snprintf(str_buf, buf_len, "%-6u: %s", BodySID, offset_str.c_str()); + return str_buf; + } - if ( ASDCP_SUCCESS(result) ) - result = Writer.WriteUi64BE(ByteOffset); + inline bool HasValue() const { return true; } + inline ui32_t ArchiveLength() const { return sizeof(ui32_t) + sizeof(ui64_t); } - return result; - } - }; + inline bool Unarchive(Kumu::MemIOReader* Reader) { + if ( ! Reader->ReadUi32BE(&BodySID) ) return false; + if ( ! Reader->ReadUi64BE(&ByteOffset) ) return false; + return true; + } + + inline bool Archive(Kumu::MemIOWriter* Writer) const { + if ( ! Writer->WriteUi32BE(BodySID) ) return false; + if ( ! Writer->WriteUi64BE(ByteOffset) ) return false; + return true; + } + }; Array PairArray; RIP() {} virtual ~RIP() {} - virtual Result_t InitFromFile(const ASDCP::FileReader& Reader); - virtual Result_t WriteToFile(ASDCP::FileWriter& Writer); + 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); }; // class Partition : public ASDCP::KLVFilePacket - { + { ASDCP_NO_COPY_CONSTRUCT(Partition); + protected: + class h__PacketList; + mem_ptr m_PacketList; + public: ui16_t MajorVersion; ui16_t MinorVersion; @@ -110,57 +129,51 @@ namespace ASDCP UL OperationalPattern; Batch