X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Freel_writer.cc;h=44da409a126f99ab07cba60253da7b882a9c5a88;hb=c269ebfdae53a2f5c5e9acc6f6588ebb47eeac9d;hp=0b367ae38581a15649b9e3eef7de8c545561c1cf;hpb=8963f0007af1a312017b9627c18b82ec2a577591;p=dcpomatic.git diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 0b367ae38..44da409a1 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -168,12 +168,12 @@ ReelWriter::ReelWriter ( } if (film()->audio_channels()) { - auto langs = film()->audio_languages(); + auto lang = film()->audio_language(); _sound_asset = make_shared ( dcp::Fraction(film()->video_frame_rate(), 1), film()->audio_frame_rate(), film()->audio_channels(), - langs.empty() ? dcp::LanguageTag("en-US") : langs.front(), + lang ? *lang : dcp::LanguageTag("en-US"), standard ); @@ -440,6 +440,10 @@ ReelWriter::finish (boost::filesystem::path output_dcp) } } + +/** Try to make a ReelAsset for a subtitles or closed captions in a given period in the DCP. + * A SubtitleAsset can be provided, or we will use one from @ref refs if not. + */ template shared_ptr maybe_add_text ( @@ -641,7 +645,7 @@ ReelWriter::create_reel_text ( } else if (ensure_subtitles) { /* We had no subtitle asset, but we've been asked to make sure there is one */ subtitle = maybe_add_text ( - empty_text_asset(TextType::OPEN_SUBTITLE, optional()), + empty_text_asset(TextType::OPEN_SUBTITLE, optional(), true), duration, reel, refs, @@ -670,7 +674,7 @@ ReelWriter::create_reel_text ( /* Make empty tracks for anything we've been asked to ensure but that we haven't added */ for (auto i: ensure_closed_captions) { auto a = maybe_add_text ( - empty_text_asset(TextType::CLOSED_CAPTION, i), duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only + empty_text_asset(TextType::CLOSED_CAPTION, i, true), duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only ); DCPOMATIC_ASSERT (a); a->set_annotation_text (i.name); @@ -681,7 +685,6 @@ ReelWriter::create_reel_text ( } - void ReelWriter::create_reel_markers (shared_ptr reel) const { @@ -784,7 +787,7 @@ ReelWriter::write (shared_ptr audio) shared_ptr -ReelWriter::empty_text_asset (TextType type, optional track) const +ReelWriter::empty_text_asset (TextType type, optional track, bool with_dummy) const { shared_ptr asset; @@ -815,29 +818,31 @@ ReelWriter::empty_text_asset (TextType type, optional track) const if (film()->encrypted()) { s->set_key (film()->key()); } - s->add ( - std::make_shared( - optional(), - false, - false, - false, - dcp::Colour(), - 42, - 1.0, - dcp::Time(0, 0, 0, 0, 24), - dcp::Time(0, 0, 1, 0, 24), - 0.5, - dcp::HAlign::CENTER, - 0.5, - dcp::VAlign::CENTER, - dcp::Direction::LTR, - "", - dcp::Effect::NONE, - dcp::Colour(), - dcp::Time(), - dcp::Time() - ) - ); + if (with_dummy) { + s->add ( + std::make_shared( + optional(), + false, + false, + false, + dcp::Colour(), + 42, + 1.0, + dcp::Time(0, 0, 0, 0, 24), + dcp::Time(0, 0, 1, 0, 24), + 0.5, + dcp::HAlign::CENTER, + 0.5, + dcp::VAlign::CENTER, + dcp::Direction::LTR, + " ", + dcp::Effect::NONE, + dcp::Colour(), + dcp::Time(), + dcp::Time() + ) + ); + } asset = s; } @@ -863,7 +868,7 @@ ReelWriter::write (PlayerText subs, TextType type, optional track, } if (!asset) { - asset = empty_text_asset (type, track); + asset = empty_text_asset (type, track, false); } switch (type) {