X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_content.cc;h=4f5fd87489893b8140cf4ef2b170df16eb46178a;hb=b539d468acc3ca73cc58a4434002e511a4995f7d;hp=b513fb443de0ec3e6631914bf3a1f1299a8bfe87;hpb=f67bc45820b4e56f90eecb97ba3b7762c119f9b5;p=dcpomatic.git diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index b513fb443..4f5fd8748 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "i18n.h" @@ -39,10 +38,11 @@ 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; /** Something stream-related has changed */ int const AudioContentProperty::STREAMS = 200; @@ -136,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()); } @@ -146,10 +146,10 @@ AudioContent::technical_summary () const void AudioContent::set_mapping (AudioMapping mapping) { - ChangeSignaller 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) { @@ -165,7 +165,7 @@ AudioMapping AudioContent::mapping () const { int channels = 0; - BOOST_FOREACH (AudioStreamPtr i, streams ()) { + for (auto i: streams()) { channels += i->channels (); } @@ -174,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) { @@ -196,8 +196,7 @@ AudioContent::mapping () const int AudioContent::resampled_frame_rate (shared_ptr film) const { - /* Resample to a DCI-approved sample rate */ - double t = has_rate_above_48k() ? 96000 : 48000; + double t = film->audio_frame_rate (); FrameRateChange frc (film, _parent); @@ -232,7 +231,7 @@ AudioContent::processing_description (shared_ptr film) const bool same = true; optional common_frame_rate; - BOOST_FOREACH (AudioStreamPtr i, streams()) { + for (auto i: streams()) { if (i->frame_rate() != resampled_frame_rate(film)) { resampled = true; } else { @@ -264,31 +263,19 @@ AudioContent::processing_description (shared_ptr film) const return ""; } -/** @return true if any stream in this content has a sampling rate of more than 48kHz */ -bool -AudioContent::has_rate_above_48k () const -{ - BOOST_FOREACH (AudioStreamPtr i, streams ()) { - if (i->frame_rate() > 48000) { - return true; - } - } - - return false; -} - /** @return User-visible names of each of our audio channels */ -vector +vector AudioContent::channel_names () const { - vector n; + vector 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; @@ -341,7 +328,7 @@ AudioContent::add_properties (shared_ptr film, list& p void AudioContent::set_streams (vector streams) { - ChangeSignaller cc (_parent, AudioContentProperty::STREAMS); + ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS); { boost::mutex::scoped_lock lm (_mutex); @@ -360,7 +347,7 @@ AudioContent::stream () const void AudioContent::add_stream (AudioStreamPtr stream) { - ChangeSignaller cc (_parent, AudioContentProperty::STREAMS); + ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS); { boost::mutex::scoped_lock lm (_mutex); @@ -371,7 +358,7 @@ AudioContent::add_stream (AudioStreamPtr stream) void AudioContent::set_stream (AudioStreamPtr stream) { - ChangeSignaller cc (_parent, AudioContentProperty::STREAMS); + ContentChangeSignaller cc (_parent, AudioContentProperty::STREAMS); { boost::mutex::scoped_lock lm (_mutex);