compile fixes
[asdcplib.git] / src / MXF.h
index 4af89932d7c680439692e16ab85f56bf8325a035..6041772a08c7abbd5e6ddbc20d7f6c61b18e3ad7 100755 (executable)
--- a/src/MXF.h
+++ b/src/MXF.h
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2013, John Hurst
+Copyright (c) 2005-2014, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@ namespace ASDCP
       typedef ASDCP::MXF::InterchangeObject* (*MXFObjectFactory_t)(const Dictionary*&);
 
       //
-      void SetObjectFactory(UL label, MXFObjectFactory_t factory);
+      void SetObjectFactory(const UL& label, MXFObjectFactory_t factory);
 
       //
       InterchangeObject* CreateObject(const Dictionary*& Dict, const UL& label);
@@ -303,6 +303,7 @@ namespace ASDCP
       //
       class IndexTableSegment : public InterchangeObject
        {
+         IndexTableSegment();
          ASDCP_NO_COPY_CONSTRUCT(IndexTableSegment);
 
        public:
@@ -314,7 +315,7 @@ namespace ASDCP
              ui8_t   Slice;
              ui32_t  ElementData;
 
-             DeltaEntry() : PosTableIndex(-1), Slice(0), ElementData(0) {}
+             DeltaEntry() : PosTableIndex(0), Slice(0), ElementData(0) {}
              DeltaEntry(i8_t pos, ui8_t slice, ui32_t data) : PosTableIndex(pos), Slice(slice), ElementData(data) {}
              inline bool HasValue() const { return true; }
              ui32_t      ArchiveLength() const { return sizeof(ui32_t) + 2; }
@@ -404,6 +405,10 @@ namespace ASDCP
          SourcePackage*   GetSourcePackage();
        };
 
+      // Searches the header object and returns the edit rate based on the contents of the
+      // File Package items.  Logs an error message and returns false if anthing goes wrong.
+      bool GetEditRateFromFP(ASDCP::MXF::OP1aHeader& header, ASDCP::Rational& edit_rate);
+
       //
       class OPAtomIndexFooter : public Partition
        {
@@ -412,6 +417,7 @@ namespace ASDCP
          ui32_t              m_BytesPerEditUnit;
          Rational            m_EditRate;
          ui32_t              m_BodySID;
+         IndexTableSegment::DeltaEntry m_DefaultDeltaEntry;
 
          ASDCP_NO_COPY_CONSTRUCT(OPAtomIndexFooter);
          OPAtomIndexFooter();
@@ -435,6 +441,7 @@ namespace ASDCP
 
          virtual Result_t Lookup(ui32_t frame_num, IndexTableSegment::IndexEntry&) const;
          virtual void     PushIndexEntry(const IndexTableSegment::IndexEntry&);
+         virtual void     SetDeltaParams(const IndexTableSegment::DeltaEntry&);
          virtual void     SetIndexParamsCBR(IPrimerLookup* lookup, ui32_t size, const Rational& Rate);
          virtual void     SetIndexParamsVBR(IPrimerLookup* lookup, const Rational& Rate, Kumu::fpos_t offset);
        };
@@ -456,8 +463,20 @@ namespace ASDCP
        }
       };
 
-      typedef std::map<const std::string, const UL, ci_comp> mca_label_map_t;
-      bool decode_mca_string(const std::string& s, const mca_label_map_t& labels, const Dictionary& dict, const std::string& language, InterchangeObject_list_t&, ui32_t&);
+      struct label_traits
+      {
+        const std::string tag_name;
+       const bool requires_prefix;
+       const UL ul;
+
+      label_traits(const std::string& tag_name, const bool requires_prefix, const UL ul) : 
+       tag_name(tag_name), requires_prefix(requires_prefix), ul(ul) { }
+      };
+
+      typedef std::map<const std::string, const label_traits, ci_comp> mca_label_map_t;
+
+      bool decode_mca_string(const std::string& s, const mca_label_map_t& labels,
+                            const Dictionary*& dict, const std::string& language, InterchangeObject_list_t&, ui32_t&);
 
       //
       class ASDCP_MCAConfigParser : public InterchangeObject_list_t
@@ -473,7 +492,7 @@ namespace ASDCP
          
        public:
          ASDCP_MCAConfigParser(const Dictionary*&);
-         bool DecodeString(const std::string& s, const std::string& language = "en");
+         bool DecodeString(const std::string& s, const std::string& language = "en-US");
 
          // Valid only after a successful call to DecodeString
          ui32_t ChannelCount() const;