X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcp_examiner.cc;h=0cfe499a3234b982063e7617c4fe98405140c6d0;hb=dbf2fbd90051f646ed827505ed1523f9449373f5;hp=f2ec68bddd8786a9a73f6258dc8d757c8600b50b;hpb=86eb90b563efb7ef093d5b17a5d6db0fc330e301;p=dcpomatic.git diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index f2ec68bdd..0cfe499a3 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -54,8 +54,10 @@ using std::cout; using std::dynamic_pointer_cast; +using std::make_shared; using std::shared_ptr; using std::string; +using std::vector; using boost::optional; @@ -70,12 +72,12 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) auto cpls = dcp::find_and_resolve_cpls (content->directories(), tolerant); if (content->cpl ()) { - /* Use the CPL that the content was using before */ - for (auto i: cpls) { - if (i->id() == content->cpl().get()) { - cpl = i; - } + /* Use the CPL that was specified, or that the content was using before */ + auto iter = std::find_if(cpls.begin(), cpls.end(), [content](shared_ptr cpl) { return cpl->id() == content->cpl().get(); }); + if (iter == cpls.end()) { + throw CPLNotFoundError(content->cpl().get()); } + cpl = *iter; } else { /* Choose the CPL with the fewest unsatisfied references */ @@ -132,6 +134,7 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) for (auto i: cpl->reels()) { LOG_GENERAL ("Reel %1", i->id()); + vector> reel_fonts; if (i->main_picture ()) { if (!i->main_picture()->asset_ref().resolved()) { @@ -203,6 +206,10 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) _text_count[static_cast(TextType::OPEN_SUBTITLE)] = 1; _open_subtitle_language = try_to_parse_language (i->main_subtitle()->language()); + + for (auto const& font: i->main_subtitle()->asset()->font_data()) { + reel_fonts.push_back(make_shared(font.first, font.second)); + } } for (auto j: i->closed_captions()) { @@ -244,6 +251,12 @@ DCPExaminer::DCPExaminer (shared_ptr content, bool tolerant) } else if (!i->atmos()) { _reel_lengths.push_back (i->atmos()->actual_duration()); } + + if (reel_fonts.empty()) { + reel_fonts.push_back(make_shared("")); + } + + _fonts.push_back(reel_fonts); } _encrypted = cpl->any_encrypted ();