diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/smpte_subtitle_asset.cc | 26 | ||||
| -rw-r--r-- | src/subtitle_asset_internal.cc | 21 | ||||
| -rw-r--r-- | src/subtitle_asset_internal.h | 2 |
3 files changed, 20 insertions, 29 deletions
diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index 11450ef3..f09d99f3 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -343,36 +343,36 @@ string SMPTESubtitleAsset::xml_as_string () const { xmlpp::Document doc; - auto root = doc.create_root_node ("dcst:SubtitleReel"); - root->set_namespace_declaration (subtitle_smpte_ns, "dcst"); + auto root = doc.create_root_node ("SubtitleReel"); + root->set_namespace_declaration (subtitle_smpte_ns); root->set_namespace_declaration ("http://www.w3.org/2001/XMLSchema", "xs"); DCP_ASSERT (_xml_id); - root->add_child("Id", "dcst")->add_child_text ("urn:uuid:" + *_xml_id); - root->add_child("ContentTitleText", "dcst")->add_child_text (_content_title_text); + root->add_child("Id")->add_child_text("urn:uuid:" + *_xml_id); + root->add_child("ContentTitleText")->add_child_text(_content_title_text); if (_annotation_text) { - root->add_child("AnnotationText", "dcst")->add_child_text (_annotation_text.get ()); + root->add_child("AnnotationText")->add_child_text(_annotation_text.get()); } - root->add_child("IssueDate", "dcst")->add_child_text (_issue_date.as_string (true)); + root->add_child("IssueDate")->add_child_text(_issue_date.as_string(true)); if (_reel_number) { - root->add_child("ReelNumber", "dcst")->add_child_text (raw_convert<string> (_reel_number.get ())); + root->add_child("ReelNumber")->add_child_text(raw_convert<string>(_reel_number.get())); } if (_language) { - root->add_child("Language", "dcst")->add_child_text (_language.get ()); + root->add_child("Language")->add_child_text(_language.get()); } - root->add_child("EditRate", "dcst")->add_child_text (_edit_rate.as_string ()); - root->add_child("TimeCodeRate", "dcst")->add_child_text (raw_convert<string> (_time_code_rate)); + root->add_child("EditRate")->add_child_text(_edit_rate.as_string()); + root->add_child("TimeCodeRate")->add_child_text(raw_convert<string>(_time_code_rate)); if (_start_time) { - root->add_child("StartTime", "dcst")->add_child_text(_start_time.get().as_string(Standard::SMPTE)); + root->add_child("StartTime")->add_child_text(_start_time.get().as_string(Standard::SMPTE)); } for (auto i: _load_font_nodes) { - auto load_font = root->add_child("LoadFont", "dcst"); + auto load_font = root->add_child("LoadFont"); load_font->add_child_text ("urn:uuid:" + i->urn); load_font->set_attribute ("ID", i->id); } - subtitles_as_xml (root->add_child("SubtitleList", "dcst"), _time_code_rate, Standard::SMPTE); + subtitles_as_xml (root->add_child("SubtitleList"), _time_code_rate, Standard::SMPTE); return doc.write_to_string ("UTF-8"); } diff --git a/src/subtitle_asset_internal.cc b/src/subtitle_asset_internal.cc index a9200618..bf73fcc3 100644 --- a/src/subtitle_asset_internal.cc +++ b/src/subtitle_asset_internal.cc @@ -49,13 +49,6 @@ using std::shared_ptr; using namespace dcp; -string -order::Context::xmlns () const -{ - return standard == Standard::SMPTE ? "dcst" : ""; -} - - order::Font::Font (shared_ptr<SubtitleString> s, Standard standard) { if (s->font()) { @@ -82,11 +75,11 @@ order::Font::Font (shared_ptr<SubtitleString> s, Standard standard) xmlpp::Element* -order::Font::as_xml (xmlpp::Element* parent, Context& context) const +order::Font::as_xml (xmlpp::Element* parent, Context&) const { - xmlpp::Element* e = parent->add_child ("Font", context.xmlns()); - for (map<string, string>::const_iterator i = _values.begin(); i != _values.end(); ++i) { - e->set_attribute (i->first, i->second); + auto e = parent->add_child("Font"); + for (const auto& i: _values) { + e->set_attribute (i.first, i.second); } return e; } @@ -207,7 +200,7 @@ position_align (xmlpp::Element* e, order::Context& context, HAlign h_align, floa xmlpp::Element* order::Text::as_xml (xmlpp::Element* parent, Context& context) const { - auto e = parent->add_child ("Text", context.xmlns()); + auto e = parent->add_child ("Text"); position_align (e, context, _h_align, _h_position, _v_align, _v_position); @@ -225,7 +218,7 @@ order::Text::as_xml (xmlpp::Element* parent, Context& context) const xmlpp::Element* order::Subtitle::as_xml (xmlpp::Element* parent, Context& context) const { - auto e = parent->add_child ("Subtitle", context.xmlns()); + auto e = parent->add_child ("Subtitle"); e->set_attribute ("SpotNumber", raw_convert<string> (context.spot_number++)); e->set_attribute ("TimeIn", _in.rebase(context.time_code_rate).as_string(context.standard)); e->set_attribute ("TimeOut", _out.rebase(context.time_code_rate).as_string(context.standard)); @@ -257,7 +250,7 @@ order::Font::clear () xmlpp::Element * order::Image::as_xml (xmlpp::Element* parent, Context& context) const { - auto e = parent->add_child ("Image", context.xmlns()); + auto e = parent->add_child ("Image"); position_align (e, context, _h_align, _h_position, _v_align, _v_position); if (context.standard == Standard::SMPTE) { diff --git a/src/subtitle_asset_internal.h b/src/subtitle_asset_internal.h index 9b5bb2da..f24ed58a 100644 --- a/src/subtitle_asset_internal.h +++ b/src/subtitle_asset_internal.h @@ -69,8 +69,6 @@ namespace order { struct Context { - std::string xmlns () const; - int time_code_rate; Standard standard; int spot_number; |
