diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-06-02 15:12:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-06-02 15:12:00 +0100 |
| commit | c157cd97740a2ba55d3e87bd9844429cc7d49ce7 (patch) | |
| tree | a27db11e3df078ef35b980ffe26f54152657932e /src/lib | |
| parent | 0a93237cb5e4642d3b698ff9b7d0cfae5401478c (diff) | |
Apply single-processor branch manually; processor is now in Film, not AudioContent.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/film.cc | 18 | ||||
| -rw-r--r-- | src/lib/film.h | 10 | ||||
| -rw-r--r-- | src/lib/player.cc | 11 | ||||
| -rw-r--r-- | src/lib/player.h | 2 |
4 files changed, 40 insertions, 1 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index edcb124e5..0e55ec1d3 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -41,6 +41,7 @@ #include "safe_stringstream.h" #include "environment_info.h" #include "raw_convert.h" +#include "audio_processor.h" #include <libcxml/cxml.h> #include <dcp/cpl.h> #include <dcp/signer.h> @@ -126,6 +127,7 @@ Film::Film (boost::filesystem::path dir, bool log) , _sequence_video (true) , _interop (false) , _burn_subtitles (false) + , _audio_processor (0) , _state_version (current_state_version) , _dirty (false) { @@ -328,6 +330,9 @@ Film::metadata () const root->add_child("Signed")->add_child_text (_signed ? "1" : "0"); root->add_child("Encrypted")->add_child_text (_encrypted ? "1" : "0"); root->add_child("Key")->add_child_text (_key.hex ()); + if (_audio_processor) { + root->add_child("AudioProcessor")->add_child_text (_audio_processor->id ()); + } _playlist->as_xml (root->add_child ("Playlist")); return doc; @@ -408,6 +413,12 @@ Film::read_metadata () } _key = dcp::Key (f.string_child ("Key")); + if (f.optional_string_child ("AudioProcessor")) { + _audio_processor = AudioProcessor::from_id (f.string_child ("AudioProcessor")); + } else { + _audio_processor = 0; + } + list<string> notes; /* This method is the only one that can return notes (so far) */ _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); @@ -770,6 +781,13 @@ Film::set_burn_subtitles (bool b) } void +Film::set_audio_processor (AudioProcessor const * processor) +{ + _audio_processor = processor; + signal_changed (AUDIO_PROCESSOR); +} + +void Film::signal_changed (Property p) { _dirty = true; diff --git a/src/lib/film.h b/src/lib/film.h index f55d8182f..8d7d2e0fb 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -47,6 +47,7 @@ class Player; class Playlist; class AudioContent; class Screen; +class AudioProcessor; struct isdcf_name_test; /** @class Film @@ -161,6 +162,7 @@ public: INTEROP, /** The setting of _burn_subtitles has changed */ BURN_SUBTITLES, + AUDIO_PROCESSOR, }; @@ -235,6 +237,10 @@ public: bool burn_subtitles () const { return _burn_subtitles; } + + AudioProcessor const * audio_processor () const { + return _audio_processor; + } /* SET */ @@ -263,6 +269,7 @@ public: void set_sequence_video (bool); void set_interop (bool); void set_burn_subtitles (bool); + void set_audio_processor (AudioProcessor const * processor); /** Emitted when some property has of the Film has changed */ mutable boost::signals2::signal<void (Property)> Changed; @@ -305,6 +312,7 @@ private: Resolution _resolution; bool _signed; bool _encrypted; + dcp::Key _key; /** bandwidth for J2K files in bits per second */ int _j2k_bandwidth; /** ISDCF naming stuff */ @@ -322,7 +330,7 @@ private: bool _sequence_video; bool _interop; bool _burn_subtitles; - dcp::Key _key; + AudioProcessor const * _audio_processor; int _state_version; diff --git a/src/lib/player.cc b/src/lib/player.cc index b81eb4d80..1a55a8472 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -45,6 +45,7 @@ #include "dcp_decoder.h" #include "dcp_subtitle_content.h" #include "dcp_subtitle_decoder.h" +#include "audio_processor.h" #include <boost/foreach.hpp> #include <stdint.h> #include <algorithm> @@ -77,6 +78,8 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p) _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3)); _film_changed_connection = _film->Changed.connect (bind (&Player::film_changed, this, _1)); set_video_container_size (_film->frame_size ()); + + film_changed (Film::AUDIO_PROCESSOR); } void @@ -247,6 +250,10 @@ Player::film_changed (Film::Property p) if (p == Film::CONTAINER || p == Film::VIDEO_FRAME_RATE) { Changed (false); + } else if (p == Film::AUDIO_PROCESSOR) { + if (_film->audio_processor ()) { + _audio_processor = _film->audio_processor()->clone (_film->audio_frame_rate ()); + } } } @@ -460,6 +467,10 @@ Player::get_audio (DCPTime time, DCPTime length, bool accurate) } } } + + if (_audio_processor) { + dcp_mapped = _audio_processor->run (dcp_mapped); + } all.audio = dcp_mapped; diff --git a/src/lib/player.h b/src/lib/player.h index a5194a169..14aee002a 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -159,6 +159,8 @@ private: /** true if the player should ignore all video; i.e. never produce any */ bool _ignore_video; + boost::shared_ptr<AudioProcessor> _audio_processor; + PlayerStatistics _statistics; boost::signals2::scoped_connection _playlist_changed_connection; |
