diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_content.cc | 17 | ||||
| -rw-r--r-- | src/lib/dcp_content.h | 4 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.cc | 10 | ||||
| -rw-r--r-- | src/lib/dcp_examiner.h | 5 | ||||
| -rw-r--r-- | src/wx/player_information.cc | 2 |
5 files changed, 35 insertions, 3 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 87e59de50..e2b19fb8e 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -160,6 +160,8 @@ DCPContent::DCPContent (cxml::ConstNodePtr node, int version) for (auto i: node->node_children("ContentVersion")) { _content_versions.push_back (i->content()); } + + _active_audio_channels = node->optional_number_child<int>("ActiveAudioChannels"); } void @@ -252,6 +254,8 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) auto m = as->mapping (); m.make_default (film ? film->audio_processor() : 0); as->set_mapping (m); + + _active_audio_channels = examiner->active_audio_channels(); } if (examiner->has_atmos()) { @@ -413,6 +417,10 @@ DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const for (auto i: _content_versions) { node->add_child("ContentVersion")->add_child_text(i); } + + if (_active_audio_channels) { + node->add_child("ActiveAudioChannels")->add_child_text(raw_convert<string>(*_active_audio_channels)); + } } DCPTime @@ -862,3 +870,12 @@ DCPContent::check_font_ids() add_fonts_from_examiner(text.front(), examiner.fonts()); } + +int +DCPContent::active_audio_channels() const +{ + return _active_audio_channels.get_value_or( + (audio && audio->stream()) ? audio->stream()->channels() : 0 + ); +} + diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 96ae09521..fd78cd0ac 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -174,6 +174,8 @@ public: return _content_versions; } + int active_audio_channels() const; + void check_font_ids(); private: @@ -225,6 +227,8 @@ private: std::map<dcp::Marker, dcpomatic::ContentTime> _markers; std::vector<dcp::Rating> _ratings; std::vector<std::string> _content_versions; + + boost::optional<int> _active_audio_channels; }; diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc index 50b19e2fd..e369b46ff 100644 --- a/src/lib/dcp_examiner.cc +++ b/src/lib/dcp_examiner.cc @@ -175,11 +175,17 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant) auto asset = reel->main_sound()->asset(); if (!_audio_channels) { - _audio_channels = asset->active_channels(); - } else if (_audio_channels.get() != asset->active_channels()) { + _audio_channels = asset->channels(); + } else if (_audio_channels.get() != asset->channels()) { throw DCPError (_("Mismatched audio channel counts in DCP")); } + if (!_active_audio_channels) { + _active_audio_channels = asset->active_channels(); + } else if (_active_audio_channels.get() != asset->active_channels()) { + throw DCPError(_("Mismatched active audio channel counts in DCP")); + } + if (!_audio_frame_rate) { _audio_frame_rate = asset->sampling_rate (); } else if (_audio_frame_rate.get() != asset->sampling_rate ()) { diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h index b51e7ae7a..1a3615867 100644 --- a/src/lib/dcp_examiner.h +++ b/src/lib/dcp_examiner.h @@ -90,6 +90,10 @@ public: return _audio_channels.get_value_or (0); } + int active_audio_channels() const { + return _active_audio_channels.get_value_or(0); + } + Frame audio_length () const override { return _audio_length; } @@ -179,6 +183,7 @@ private: boost::optional<dcp::Size> _video_size; Frame _video_length = 0; boost::optional<int> _audio_channels; + boost::optional<int> _active_audio_channels; boost::optional<int> _audio_frame_rate; Frame _audio_length = 0; std::string _name; diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc index 4e95e0956..806611140 100644 --- a/src/wx/player_information.cc +++ b/src/wx/player_information.cc @@ -166,7 +166,7 @@ PlayerInformation::triggered_update () checked_set (_dcp[r++], wxString::Format(_("Frame rate: %d"), (int) lrint(*dcp->video_frame_rate()))); } if (dcp->audio && !dcp->audio->streams().empty()) { - checked_set (_dcp[r++], wxString::Format(_("Audio channels: %d"), dcp->audio->streams().front()->channels())); + checked_set(_dcp[r++], wxString::Format(_("Audio channels: %d"), dcp->active_audio_channels())); } if (!dcp->text.empty()) { checked_set (_dcp[r++], _("Subtitles: yes")); |
