Fix typo.
[asdcplib.git] / src / AS_02.h
index 69f159b7c51720a8eadeaaa0e98dfcdc3ecf8637..61a2c1e0ba6b83c0e1fd715086c01c5361643d52 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2011-2016, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
+Copyright (c) 2011-2018, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
 John Hurst
 
 All rights reserved.
@@ -349,6 +349,11 @@ namespace AS_02
          Result_t ResolveRID(const byte_t* uuid, ASDCP::TimedText::FrameBuffer& FrameBuf) const;
        };
       
+
+      // Generate UUID asset ID values from file contents
+      Kumu::UUID CreatePNGNameId(const std::string& image_name);
+      Kumu::UUID CreateFontNameId(const std::string& font_name);
+
       //
       class ST2052_TextParser
        {
@@ -367,6 +372,11 @@ namespace AS_02
          // Parse an XML string 
          Result_t OpenRead(const std::string& xml_doc, const std::string& filename) const;
 
+         // The "profile_name" parameter was removed from OpenRead() because it made the API
+         // awkward WRT lexical compatibility with TimedText_Parser. The value can still be
+         // modified by changing the descriptor's NamespaceName property after the call to
+         // FillTimedTextDescriptor() has set it.
+                             
          // Fill a TimedTextDescriptor struct with the values from the file's contents.
          // Returns RESULT_INIT if the file is not open.
          Result_t FillTimedTextDescriptor(ASDCP::TimedText::TimedTextDescriptor&) const;
@@ -488,8 +498,7 @@ namespace AS_02
        };
     } // namespace TimedText
 
-
-  namespace AuxData
+  namespace ISXD
   { 
     //
     class MXFWriter
@@ -511,8 +520,7 @@ namespace AS_02
       // the operation cannot be completed or if nonsensical data is discovered
       // in the essence descriptor.
       Result_t OpenWrite(const std::string& filename, const ASDCP::WriterInfo&,
-                        ASDCP::MXF::FileDescriptor* essence_descriptor,
-                        ASDCP::MXF::InterchangeObject_list_t& essence_sub_descriptor_list,
+                        const std::string& isxd_document_namespace,
                         const ASDCP::Rational& edit_rate, const ui32_t& header_size = 16384,
                         const IndexStrategy_t& strategy = IS_FOLLOW, const ui32_t& partition_space = 10);
 
@@ -522,6 +530,12 @@ namespace AS_02
       // error occurs.
       Result_t WriteFrame(const ASDCP::FrameBuffer&, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0);
 
+      // Writes an XML text document to the MXF file as per RP 2057. If the
+      // optional AESEncContext argument is present, the document is encrypted
+      // prior to writing. Fails if the file is not open, is finalized, or an
+      // operating system error occurs.
+      Result_t AddDmsGenericPartUtf8Text(const ASDCP::FrameBuffer& frame_buffer, ASDCP::AESEncContext* enc = 0, ASDCP::HMACContext* hmac = 0);
+
       // Closes the MXF file, writing the index and revised header.
       Result_t Finalize();
     };
@@ -561,8 +575,15 @@ namespace AS_02
       // not NULL, the HMAC will be calculated (if the file supports it).
       // Returns RESULT_INIT if the file is not open, failure if the frame number is
       // out of range, or if optional decrypt or HAMC operations fail.
-      Result_t ReadFrame(ui32_t frame_number, ASDCP::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
-
+      Result_t ReadFrame(ui32_t frame_number, ASDCP::FrameBuffer&,
+                        ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
+
+      // Reads a Generic Stream Partition payload. Returns RESULT_INIT if the file is
+      // not open, or RESULT_FORMAT if the SID is not present in the  RIP, or if the
+      // actual partition at ByteOffset does not have a matching BodySID value.
+      // Encryption is not currently supported.
+      Result_t ReadGenericStreamPartitionPayload(ui32_t SID, ASDCP::FrameBuffer& FrameBuf);
+  
       // Print debugging information to stream
       void     DumpHeaderMetadata(FILE* = 0) const;
       void     DumpIndex(FILE* = 0) const;