Cleanup: move some methods from util to maths_util.
[dcpomatic.git] / src / lib / audio_content.cc
index 3d9f6ac051ca9fa102daf1adffc42e8291bc89f9..32e713ff2eda9cde84caa7260a969b6b20137351 100644 (file)
@@ -25,6 +25,7 @@
 #include "exceptions.h"
 #include "film.h"
 #include "frame_rate_change.h"
+#include "maths_util.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
@@ -52,7 +53,6 @@ using namespace dcpomatic;
 int const AudioContentProperty::STREAMS = 200;
 int const AudioContentProperty::GAIN = 201;
 int const AudioContentProperty::DELAY = 202;
-int const AudioContentProperty::LANGUAGE = 203;
 
 
 AudioContent::AudioContent (Content* parent)
@@ -90,10 +90,6 @@ AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node)
 {
        _gain = node->number_child<double> ("AudioGain");
        _delay = node->number_child<int> ("AudioDelay");
-       auto lang = node->optional_node_child ("Language");
-       if (lang) {
-               _language = dcp::LanguageTag (lang->content());
-       }
 
        /* Backwards compatibility */
        auto r = node->optional_number_child<double>("AudioVideoFrameRate");
@@ -103,7 +99,7 @@ AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node)
 }
 
 
-AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c)
+AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content>> c)
        : ContentPart (parent)
 {
        auto ref = c[0]->audio;
@@ -117,16 +113,11 @@ AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c)
                if (c[i]->audio->delay() != ref->delay()) {
                        throw JoinError (_("Content to be joined must have the same audio delay."));
                }
-
-               if (c[i]->audio->language() != ref->language()) {
-                       throw JoinError (_("Content to be joined must have the same audio language."));
-               }
        }
 
        _gain = ref->gain ();
        _delay = ref->delay ();
        _streams = ref->streams ();
-       _language = ref->language ();
 }
 
 
@@ -136,9 +127,6 @@ AudioContent::as_xml (xmlpp::Node* node) const
        boost::mutex::scoped_lock lm (_mutex);
        node->add_child("AudioGain")->add_child_text(raw_convert<string>(_gain));
        node->add_child("AudioDelay")->add_child_text(raw_convert<string>(_delay));
-       if (_language) {
-               node->add_child("Language")->add_child_text(_language->to_string());
-       }
 }
 
 
@@ -156,13 +144,6 @@ AudioContent::set_delay (int d)
 }
 
 
-void
-AudioContent::set_language (optional<dcp::LanguageTag> language)
-{
-       maybe_set (_language, language, AudioContentProperty::LANGUAGE);
-}
-
-
 string
 AudioContent::technical_summary () const
 {