Use a LanguageTag for closed caption tracks.
authorCarl Hetherington <cth@carlh.net>
Fri, 20 Nov 2020 15:52:56 +0000 (16:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 20 Nov 2020 22:47:03 +0000 (23:47 +0100)
src/lib/reel_writer.cc
src/wx/dcp_text_track_dialog.cc
src/wx/dcp_text_track_dialog.h

index 345bcde..fa84180 100644 (file)
@@ -608,7 +608,7 @@ ReelWriter::create_reel (list<ReferencedReelAsset> const & refs, list<shared_ptr
                        );
                if (a) {
                        a->set_annotation_text (i->first.name);
-                       a->set_language (i->first.language);
+                       a->set_language (dcp::LanguageTag(i->first.language));
                }
        }
 
index d48b3be..3e8750c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
 #include "dcp_text_track_dialog.h"
+#include "language_tag_widget.h"
 #include <boost/algorithm/string.hpp>
 
+
 using std::string;
 
+
 DCPTextTrackDialog::DCPTextTrackDialog (wxWindow* parent)
        : TableDialog (parent, _("DCP Text Track"), 2, 1, true)
 {
        add (_("Name"), true);
        add (_name = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(300, -1)));
        add (_("Language"), true);
-       add (_language = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(150, -1)));
+       _language = new LanguageTagWidget (this, wxT(""), dcp::LanguageTag("en-US"));
+       add (_language->sizer());
 
        layout ();
 }
 
+
 DCPTextTrack
 DCPTextTrackDialog::get () const
 {
-       return DCPTextTrack(wx_to_std(_name->GetValue()), wx_to_std(_language->GetValue()));
+       return DCPTextTrack(wx_to_std(_name->GetValue()), _language->get().to_string());
 }
index dd4894a..c073696 100644 (file)
 #include "wx_util.h"
 #include "lib/dcp_text_track.h"
 
+
+class LanguageTagWidget;
+
+
 class DCPTextTrackDialog : public TableDialog
 {
 public:
@@ -34,7 +38,7 @@ public:
 
 private:
        wxTextCtrl* _name;
-       wxTextCtrl* _language;
+       LanguageTagWidget* _language;
 };
 
 #endif