From f632ecbf3023b632bd619f370ee303f16b3aca55 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 6 May 2015 23:54:22 +0100 Subject: Use Unknown for language in subtitles if no language has been specified. --- src/lib/writer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 9f6886a21..569953641 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -663,7 +663,11 @@ Writer::write (PlayerSubtitles subs) } if (!_subtitle_content) { - _subtitle_content.reset (new dcp::InteropSubtitleContent (_film->name(), _film->subtitle_language ())); + string lang = _film->subtitle_language (); + if (lang.empty ()) { + lang = "Unknown"; + } + _subtitle_content.reset (new dcp::InteropSubtitleContent (_film->name(), lang)); } for (list::const_iterator i = subs.text.begin(); i != subs.text.end(); ++i) { -- cgit v1.2.3 From 33de7ebf55a3059fa0f444c4b06ac00ad37cb5ae Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 7 May 2015 00:14:49 +0100 Subject: Fix writing of LoadFont tags in subtitles. --- src/lib/writer.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/lib') diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 569953641..d2116362e 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -505,18 +505,6 @@ Writer::finish () } if (_subtitle_content) { - _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _film->subtitle_xml_filename ()); - reel->add (shared_ptr ( - new dcp::ReelSubtitleAsset ( - _subtitle_content, - dcp::Fraction (_film->video_frame_rate(), 1), - _picture_mxf->intrinsic_duration (), - 0 - ) - )); - - dcp.add (_subtitle_content); - boost::filesystem::path const liberation = shared_path () / "LiberationSans-Regular.ttf"; /* Add all the fonts to the subtitle content and as assets to the DCP */ @@ -534,6 +522,18 @@ Writer::finish () LOG_WARNING_NC (String::compose ("Could not copy font %1 to DCP", from.string ())); } } + + _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _film->subtitle_xml_filename ()); + reel->add (shared_ptr ( + new dcp::ReelSubtitleAsset ( + _subtitle_content, + dcp::Fraction (_film->video_frame_rate(), 1), + _picture_mxf->intrinsic_duration (), + 0 + ) + )); + + dcp.add (_subtitle_content); } cpl->add (reel); -- cgit v1.2.3 From 7af8a1943d88e14ed26302bc0f954c90bd358e46 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 7 May 2015 00:27:11 +0100 Subject: Write subtitle stuff to a subdirectory based on ID. --- src/lib/writer.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/writer.cc b/src/lib/writer.cc index d2116362e..31c265e2f 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -512,18 +512,24 @@ Writer::finish () boost::filesystem::path const from = i->file.get_value_or (liberation); _subtitle_content->add_font (i->id, from.leaf().string ()); - boost::filesystem::path to = _film->dir (_film->dcp_name ()) / from.leaf(); + boost::filesystem::path to = _film->dir (_film->dcp_name ()) / _subtitle_content->id (); + boost::filesystem::create_directories (to, ec); + if (ec) { + throw FileError (_("Could not create directory"), to); + } + + to /= from.leaf(); boost::system::error_code ec; boost::filesystem::copy_file (from, to, ec); - if (!ec) { - dcp.add (shared_ptr (new dcp::Font (to))); - } else { - LOG_WARNING_NC (String::compose ("Could not copy font %1 to DCP", from.string ())); + if (ec) { + throw FileError ("Could not copy font to DCP", from); } + + dcp.add (shared_ptr (new dcp::Font (to))); } - _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _film->subtitle_xml_filename ()); + _subtitle_content->write_xml (_film->dir (_film->dcp_name ()) / _subtitle_content->id () / _film->subtitle_xml_filename ()); reel->add (shared_ptr ( new dcp::ReelSubtitleAsset ( _subtitle_content, -- cgit v1.2.3