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/ST2052_TextParser.cpp | |
| 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/ST2052_TextParser.cpp')
| -rw-r--r-- | src/ST2052_TextParser.cpp | 38 |
1 files changed, 15 insertions, 23 deletions
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; |
