Merge master.
[dcpomatic.git] / src / lib / audio_mapping.cc
index e35c1ae9464cf67061426ddb065cfb8c9d162b7a..b3757c5f1be9bd2fefc2a38199215201cde2cf11 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 
 #include <libxml++/libxml++.h>
 #include <libcxml/cxml.h>
-#include <libdcp/raw_convert.h>
+#include <dcp/raw_convert.h>
 #include "audio_mapping.h"
 #include "util.h"
 #include "md5_digester.h"
@@ -32,7 +32,7 @@ using std::string;
 using std::min;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
-using libdcp::raw_convert;
+using dcp::raw_convert;
 
 AudioMapping::AudioMapping ()
        : _content_channels (0)
@@ -41,11 +41,11 @@ AudioMapping::AudioMapping ()
 }
 
 /** Create a default AudioMapping for a given channel count.
- *  @param c Number of channels.
+ *  @param channels Number of channels.
  */
-AudioMapping::AudioMapping (int c)
+AudioMapping::AudioMapping (int channels)
 {
-       setup (c);
+       setup (channels);
 }
 
 void
@@ -70,16 +70,16 @@ AudioMapping::make_default ()
 
        if (_content_channels == 1) {
                /* Mono -> Centre */
-               set (0, libdcp::CENTRE, 1);
+               set (0, dcp::CENTRE, 1);
        } else {
                /* 1:1 mapping */
                for (int i = 0; i < min (_content_channels, MAX_DCP_AUDIO_CHANNELS); ++i) {
-                       set (i, static_cast<libdcp::Channel> (i), 1);
+                       set (i, static_cast<dcp::Channel> (i), 1);
                }
        }
 }
 
-AudioMapping::AudioMapping (shared_ptr<const cxml::Node> node, int state_version)
+AudioMapping::AudioMapping (cxml::ConstNodePtr node, int state_version)
 {
        setup (node->number_child<int> ("ContentChannels"));
 
@@ -87,14 +87,14 @@ AudioMapping::AudioMapping (shared_ptr<const cxml::Node> node, int state_version
                /* Old-style: on/off mapping */
                list<cxml::NodePtr> const c = node->node_children ("Map");
                for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
-                       set ((*i)->number_child<int> ("ContentIndex"), static_cast<libdcp::Channel> ((*i)->number_child<int> ("DCP")), 1);
+                       set ((*i)->number_child<int> ("ContentIndex"), static_cast<dcp::Channel> ((*i)->number_child<int> ("DCP")), 1);
                }
        } else {
                list<cxml::NodePtr> const c = node->node_children ("Gain");
                for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
                        set (
                                (*i)->number_attribute<int> ("Content"),
-                               static_cast<libdcp::Channel> ((*i)->number_attribute<int> ("DCP")),
+                               static_cast<dcp::Channel> ((*i)->number_attribute<int> ("DCP")),
                                raw_convert<float> ((*i)->content ())
                                );
                }
@@ -102,13 +102,13 @@ AudioMapping::AudioMapping (shared_ptr<const cxml::Node> node, int state_version
 }
 
 void
-AudioMapping::set (int c, libdcp::Channel d, float g)
+AudioMapping::set (int c, dcp::Channel d, float g)
 {
        _gain[c][d] = g;
 }
 
 float
-AudioMapping::get (int c, libdcp::Channel d) const
+AudioMapping::get (int c, dcp::Channel d) const
 {
        return _gain[c][d];
 }
@@ -123,7 +123,7 @@ AudioMapping::as_xml (xmlpp::Node* node) const
                        xmlpp::Element* t = node->add_child ("Gain");
                        t->set_attribute ("Content", raw_convert<string> (c));
                        t->set_attribute ("DCP", raw_convert<string> (d));
-                       t->add_child_text (raw_convert<string> (get (c, static_cast<libdcp::Channel> (d))));
+                       t->add_child_text (raw_convert<string> (get (c, static_cast<dcp::Channel> (d))));
                }
        }
 }