Use enum class for Film::Property.
[dcpomatic.git] / src / lib / audio_content.cc
index 014221f2e892afc95ef5f31d57aa3f4e44bea997..4f5fd87489893b8140cf4ef2b170df16eb46178a 100644 (file)
@@ -27,7 +27,6 @@
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
-#include <boost/foreach.hpp>
 #include <iostream>
 
 #include "i18n.h"
@@ -39,8 +38,8 @@ using std::fixed;
 using std::list;
 using std::pair;
 using std::setprecision;
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::dynamic_pointer_cast;
 using boost::optional;
 using dcp::raw_convert;
 using namespace dcpomatic;
@@ -137,7 +136,7 @@ string
 AudioContent::technical_summary () const
 {
        string s = "audio: ";
-       BOOST_FOREACH (AudioStreamPtr i, streams ()) {
+       for (auto i: streams()) {
                s += String::compose ("stream channels %1 rate %2 ", i->channels(), i->frame_rate());
        }
 
@@ -147,10 +146,10 @@ AudioContent::technical_summary () const
 void
 AudioContent::set_mapping (AudioMapping mapping)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        int c = 0;
-       BOOST_FOREACH (AudioStreamPtr i, streams ()) {
+       for (auto i: streams()) {
                AudioMapping stream_mapping (i->channels (), MAX_DCP_AUDIO_CHANNELS);
                for (int j = 0; j < i->channels(); ++j) {
                        for (int k = 0; k < MAX_DCP_AUDIO_CHANNELS; ++k) {
@@ -166,7 +165,7 @@ AudioMapping
 AudioContent::mapping () const
 {
        int channels = 0;
-       BOOST_FOREACH (AudioStreamPtr i, streams ()) {
+       for (auto i: streams()) {
                channels += i->channels ();
        }
 
@@ -175,7 +174,7 @@ AudioContent::mapping () const
 
        int c = 0;
        int s = 0;
-       BOOST_FOREACH (AudioStreamPtr i, streams ()) {
+       for (auto i: streams()) {
                AudioMapping mapping = i->mapping ();
                for (int j = 0; j < mapping.input_channels(); ++j) {
                        for (int k = 0; k < MAX_DCP_AUDIO_CHANNELS; ++k) {
@@ -232,7 +231,7 @@ AudioContent::processing_description (shared_ptr<const Film> film) const
        bool same = true;
 
        optional<int> common_frame_rate;
-       BOOST_FOREACH (AudioStreamPtr i, streams()) {
+       for (auto i: streams()) {
                if (i->frame_rate() != resampled_frame_rate(film)) {
                        resampled = true;
                } else {
@@ -265,17 +264,18 @@ AudioContent::processing_description (shared_ptr<const Film> film) const
 }
 
 /** @return User-visible names of each of our audio channels */
-vector<string>
+vector<NamedChannel>
 AudioContent::channel_names () const
 {
-       vector<string> n;
+       vector<NamedChannel> n;
 
-       int t = 1;
-       BOOST_FOREACH (AudioStreamPtr i, streams ()) {
+       int index = 0;
+       int stream = 1;
+       for (auto i: streams()) {
                for (int j = 0; j < i->channels(); ++j) {
-                       n.push_back (String::compose ("%1:%2", t, j + 1));
+                       n.push_back (NamedChannel(String::compose ("%1:%2", stream, j + 1), index++));
                }
-               ++t;
+               ++stream;
        }
 
        return n;
@@ -328,7 +328,7 @@ AudioContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& p
 void
 AudioContent::set_streams (vector<AudioStreamPtr> streams)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -347,7 +347,7 @@ AudioContent::stream () const
 void
 AudioContent::add_stream (AudioStreamPtr stream)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);
@@ -358,7 +358,7 @@ AudioContent::add_stream (AudioStreamPtr stream)
 void
 AudioContent::set_stream (AudioStreamPtr stream)
 {
-       ChangeSignaller<Content> cc (_parent, AudioContentProperty::STREAMS);
+       ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS);
 
        {
                boost::mutex::scoped_lock lm (_mutex);