Add a temporary to reduce some boilerplate.
authorCarl Hetherington <cth@carlh.net>
Wed, 6 Mar 2024 00:15:46 +0000 (01:15 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 11 Mar 2024 08:24:17 +0000 (09:24 +0100)
src/lib/dcp_examiner.cc

index 88c9a5b700a64e279c5b459610c29f70955ec1d3..22e9f9b506b2333ab02f180b9754af06315e5dac 100644 (file)
@@ -195,17 +195,17 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
                        }
                }
 
-               if (reel->main_subtitle()) {
-                       if (!reel->main_subtitle()->asset_ref().resolved()) {
-                               LOG_GENERAL("Main subtitle %1 of reel %2 is missing", reel->main_subtitle()->id(), reel->id());
+               if (auto sub = reel->main_subtitle()) {
+                       if (!sub->asset_ref().resolved()) {
+                               LOG_GENERAL("Main subtitle %1 of reel %2 is missing", sub->id(), reel->id());
                                _needs_assets = true;
                        } else {
-                               LOG_GENERAL("Main subtitle %1 of reel %2 found", reel->main_subtitle()->id(), reel->id());
+                               LOG_GENERAL("Main subtitle %1 of reel %2 found", sub->id(), reel->id());
 
                                _text_count[TextType::OPEN_SUBTITLE] = 1;
-                               _open_subtitle_language = try_to_parse_language(reel->main_subtitle()->language());
+                               _open_subtitle_language = try_to_parse_language(sub->language());
 
-                               auto asset = reel->main_subtitle()->asset();
+                               auto asset = sub->asset();
                                for (auto const& font: asset->font_data()) {
                                        _fonts.push_back({reel_index, asset->id(), make_shared<dcpomatic::Font>(font.first, font.second)});
                                }