diff options
| author | jhurst <jhurst@cinecert.com> | 2016-12-02 18:17:25 +0000 |
|---|---|---|
| committer | jhurst <> | 2016-12-02 18:17:25 +0000 |
| commit | 6f5cb81faa06f80b07e2d641732b2a8b692e14d8 (patch) | |
| tree | 1fd4ee9f7f8b543609b3c63694e30ebf4fa7e07c /src | |
| parent | 65c102640dea51a709bd4c25ef6ca006edcbee71 (diff) | |
o The NamespaceURI property of AS-02 timed text files has been exposed in the API
and via as-02-wrap -P. This behavior replaces previous bad behavior, but puts
responsibility for selecting the correct value on the operator.
Diffstat (limited to 'src')
| -rw-r--r-- | src/AS_02.h | 5 | ||||
| -rw-r--r-- | src/ST2052_TextParser.cpp | 38 | ||||
| -rwxr-xr-x | src/as-02-wrap.cpp | 11 |
3 files changed, 27 insertions, 27 deletions
diff --git a/src/AS_02.h b/src/AS_02.h index e4f761f..188c5b7 100644 --- a/src/AS_02.h +++ b/src/AS_02.h @@ -362,10 +362,11 @@ namespace AS_02 // Opens an XML file for reading, parses data to provide a complete // set of stream metadata for the MXFWriter below. - Result_t OpenRead(const std::string& filename) const; + Result_t OpenRead(const std::string& filename, const std::string& profile_name) const; // Parse an XML string - Result_t OpenRead(const std::string& xml_doc, const std::string& filename) const; + Result_t OpenRead(const std::string& xml_doc, const std::string& filename, + const std::string& profile_name) const; // Fill a TimedTextDescriptor struct with the values from the file's contents. // Returns RESULT_INIT if the file is not open. diff --git a/src/ST2052_TextParser.cpp b/src/ST2052_TextParser.cpp index 012f4ce..5bc2f9d 100644 --- a/src/ST2052_TextParser.cpp +++ b/src/ST2052_TextParser.cpp @@ -229,7 +229,7 @@ class AS_02::TimedText::ST2052_TextParser::h__TextParser { XMLElement m_Root; ResourceTypeMap_t m_ResourceTypes; - Result_t OpenRead(); + Result_t OpenRead(const std::string& profile_name); ASDCP_NO_COPY_CONSTRUCT(h__TextParser); @@ -258,22 +258,22 @@ public: return m_DefaultResolver; } - Result_t OpenRead(const std::string& filename); - Result_t OpenRead(const std::string& xml_doc, const std::string& filename); + Result_t OpenRead(const std::string& filename, const std::string& profile_name); + Result_t OpenRead(const std::string& xml_doc, const std::string& filename, const std::string& profile_name); Result_t ReadAncillaryResource(const byte_t *uuid, ASDCP::TimedText::FrameBuffer& FrameBuf, const ASDCP::TimedText::IResourceResolver& Resolver) const; }; // Result_t -AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead(const std::string& filename) +AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead(const std::string& filename, const std::string& profile_name) { Result_t result = ReadFileIntoString(filename, m_XMLDoc); if ( KM_SUCCESS(result) ) { m_Filename = filename; - result = OpenRead(); + result = OpenRead(profile_name); } return result; @@ -281,11 +281,12 @@ AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead(const std::string& // Result_t -AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead(const std::string& xml_doc, const std::string& filename) +AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead(const std::string& xml_doc, const std::string& filename, + const std::string& profile_name) { m_XMLDoc = xml_doc; m_Filename = filename; - return OpenRead(); + return OpenRead(profile_name); } // @@ -340,7 +341,7 @@ public: // Result_t -AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead() +AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead(const std::string& profile_name) { setup_default_font_family_list(); @@ -353,17 +354,7 @@ AS_02::TimedText::ST2052_TextParser::h__TextParser::OpenRead() m_TDesc.EncodingName = "UTF-8"; // the XML parser demands UTF-8 m_TDesc.ResourceList.clear(); m_TDesc.ContainerDuration = 0; - const XMLNamespace* ns = m_Root.Namespace(); - - if ( ns == 0 ) - { - DefaultLogSink(). Warn("Document has no namespace name, assuming %s\n", c_tt_namespace_name); - m_TDesc.NamespaceName = c_tt_namespace_name; - } - else - { - m_TDesc.NamespaceName = ns->Name(); - } + m_TDesc.NamespaceName = profile_name; AttributeVisitor png_visitor("backgroundImage"); apply_visitor(m_Root, png_visitor); @@ -466,11 +457,11 @@ AS_02::TimedText::ST2052_TextParser::~ST2052_TextParser() // Opens the stream for reading, parses enough data to provide a complete // set of stream metadata for the MXFWriter below. ASDCP::Result_t -AS_02::TimedText::ST2052_TextParser::OpenRead(const std::string& filename) const +AS_02::TimedText::ST2052_TextParser::OpenRead(const std::string& filename, const std::string& profile_name) const { const_cast<AS_02::TimedText::ST2052_TextParser*>(this)->m_Parser = new h__TextParser; - Result_t result = m_Parser->OpenRead(filename); + Result_t result = m_Parser->OpenRead(filename, profile_name); if ( ASDCP_FAILURE(result) ) const_cast<AS_02::TimedText::ST2052_TextParser*>(this)->m_Parser = 0; @@ -480,11 +471,12 @@ AS_02::TimedText::ST2052_TextParser::OpenRead(const std::string& filename) const // Parses an XML document to provide a complete set of stream metadata for the MXFWriter below. Result_t -AS_02::TimedText::ST2052_TextParser::OpenRead(const std::string& xml_doc, const std::string& filename) const +AS_02::TimedText::ST2052_TextParser::OpenRead(const std::string& xml_doc, const std::string& filename, + const std::string& profile_name) const { const_cast<AS_02::TimedText::ST2052_TextParser*>(this)->m_Parser = new h__TextParser; - Result_t result = m_Parser->OpenRead(xml_doc, filename); + Result_t result = m_Parser->OpenRead(xml_doc, filename, profile_name); if ( ASDCP_FAILURE(result) ) const_cast<AS_02::TimedText::ST2052_TextParser*>(this)->m_Parser = 0; diff --git a/src/as-02-wrap.cpp b/src/as-02-wrap.cpp index 98ff21e..50f2665 100755 --- a/src/as-02-wrap.cpp +++ b/src/as-02-wrap.cpp @@ -150,6 +150,7 @@ Options:\n\ -M - Do not create HMAC values when writing\n\ -m <expr> - Write MCA labels using <expr>. Example:\n\ 51(L,R,C,LFE,Ls,Rs,),HI,VIN\n\ + -P <string> - Set NamespaceURI property when creating timed text MXF\n\ -p <ul> - Set broadcast profile\n\ -r <n>/<d> - Edit Rate of the output file. 24/1 is the default\n\ -R - Indicates RGB image essence (default)\n\ @@ -228,7 +229,7 @@ public: // MXF::LineMapPair line_map; - std::string out_file; // + std::string out_file, profile_name; // // bool set_video_line_map(const std::string& arg) @@ -426,6 +427,11 @@ public: } break; + case 'P': + TEST_EXTRA_ARG(i, 'P'); + profile_name = argv[i]; + break; + case 'p': TEST_EXTRA_ARG(i, 'p'); if ( ! picture_coding.DecodeHex(argv[i]) ) @@ -888,7 +894,8 @@ write_timed_text_file(CommandOptions& Options) Kumu::FortunaRNG RNG; // set up essence parser - Result_t result = Parser.OpenRead(Options.filenames.front().c_str()); + Result_t result = Parser.OpenRead(Options.filenames.front().c_str(), + Options.profile_name); // set up MXF writer if ( ASDCP_SUCCESS(result) ) |
