Fix missing language tag in open captions. v2.18.5
authorCarl Hetherington <cth@carlh.net>
Tue, 14 Jan 2025 13:40:16 +0000 (14:40 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 15 Jan 2025 19:11:35 +0000 (20:11 +0100)
src/lib/reel_writer.cc
test/open_caption_test.cc

index 7bcc2d796299ba34dd05077bd5376b44f6066417..9037c9ef95b7c0009e3e59126e09189c46317f65 100644 (file)
@@ -800,7 +800,7 @@ ReelWriter::empty_text_asset (TextType type, optional<DCPTextTrack> track, bool
        if (film()->interop()) {
                auto s = make_shared<dcp::InteropTextAsset>();
                s->set_movie_title (film()->name());
-               if (type == TextType::OPEN_SUBTITLE) {
+               if (is_open(type)) {
                        s->set_language (lang.first ? lang.first->to_string() : "Unknown");
                } else if (track->language) {
                        s->set_language (track->language->to_string());
@@ -811,7 +811,7 @@ ReelWriter::empty_text_asset (TextType type, optional<DCPTextTrack> track, bool
                auto s = make_shared<dcp::SMPTETextAsset>();
                s->set_content_title_text (film()->name());
                s->set_metadata (mxf_metadata());
-               if (type == TextType::OPEN_SUBTITLE && lang.first) {
+               if (is_open(type) && lang.first) {
                        s->set_language (*lang.first);
                } else if (track && track->language) {
                        s->set_language (dcp::LanguageTag(track->language->to_string()));
index 06b08c1519760cf6e060656bed5b9bfab7bc110d..d1f1730626e746dda06f120c7abb74459372f450 100644 (file)
@@ -32,13 +32,13 @@ BOOST_AUTO_TEST_CASE(basic_open_caption_test)
        auto film = new_test_film("basic_open_caption_test", { content });
 
        content->text[0]->set_type(TextType::OPEN_CAPTION);
+       content->text[0]->set_language(dcp::LanguageTag("de"));
 
        make_and_verify_dcp(
                film,
                {
                        dcp::VerificationNote::Code::MISSING_CPL_METADATA,
-                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
-                       dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
                }
        );