bugfix in indexing
[asdcplib.git] / src / MXF.h
index fc0d9962430efc517a9454be2252e7fee33efc5d..74c64dbb6e7b8317819c9232e1881c1c28d13d37 100755 (executable)
--- a/src/MXF.h
+++ b/src/MXF.h
@@ -1,6 +1,33 @@
-//
-//
-//
+/*
+Copyright (c) 2005-2006, John Hurst
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+/*! \file    MXF.h
+    \version $Id$
+    \brief   MXF objects
+*/
 
 #ifndef _MXF_H_
 #define _MXF_H_
@@ -30,7 +57,7 @@ namespace ASDCP
 
            inline const char* ToString(char* str_buf) const {
              char intbuf[IntBufferLen];
-             sprintf(str_buf, "%-6lu: %s", BodySID, ui64sz(ByteOffset, intbuf));
+             snprintf(str_buf, IdentBufferLen, "%-6lu: %s", BodySID, ui64sz(ByteOffset, intbuf));
              return str_buf;
            }
 
@@ -107,7 +134,7 @@ namespace ASDCP
              ASDCP::UL   UL;
 
              inline const char* ToString(char* str_buf) const {
-               sprintf(str_buf, "%02x %02x: ", Tag.a, Tag.b);
+               snprintf(str_buf, IdentBufferLen, "%02x %02x: ", Tag.a, Tag.b);
                UL.ToString(str_buf + strlen(str_buf));
                return str_buf;
              }
@@ -158,15 +185,14 @@ namespace ASDCP
        public:
          IPrimerLookup* m_Lookup;
          UID            InstanceUID;
+         UUID           GenerationUID;
 
          InterchangeObject() : m_Lookup(0) {}
          virtual ~InterchangeObject() {}
+          virtual Result_t InitFromTLVSet(TLVReader& TLVSet);
          virtual Result_t WriteToBuffer(ASDCP::FrameBuffer&);
          virtual bool     IsA(const byte_t* label);
-
-         virtual void Dump(FILE* stream = 0) {
-           KLVPacket::Dump(stream, true);
-         }
+         virtual void     Dump(FILE* stream = 0);
        };
 
       //
@@ -254,6 +280,7 @@ namespace ASDCP
       //
       class h__PacketList; // See MXF.cpp
       class Identification;
+      class SourcePackage;
 
       //
       class OPAtomHeader : public Partition
@@ -274,7 +301,8 @@ namespace ASDCP
          virtual Result_t WriteToFile(ASDCP::FileWriter& Writer, ui32_t HeaderLength = 16384);
          virtual void     Dump(FILE* = 0);
          virtual Result_t GetMDObjectByType(const byte_t*, InterchangeObject** = 0);
-         Identification* GetIdentification();
+         Identification*  GetIdentification();
+         SourcePackage*   GetSourcePackage();
        };
 
       //