summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-09-04 23:14:46 +0100
committerCarl Hetherington <cth@carlh.net>2015-09-05 00:25:14 +0100
commit253c72987b333a747eeaf25509eb1ec32f484467 (patch)
tree2918796879f83a74952a2fe6a9f07037d6d88be3
parentf227d182fa5a829fdeabf9eca8f33da5ce7f4e0d (diff)
Don't bother with audio in the film viewer.
-rw-r--r--src/lib/audio_decoder.cc12
-rw-r--r--src/lib/audio_decoder.h3
-rw-r--r--src/lib/player.cc13
-rw-r--r--src/lib/player.h3
-rw-r--r--src/wx/film_viewer.cc1
5 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index a65e5f759..268a9d296 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -32,6 +32,7 @@ using boost::shared_ptr;
AudioDecoder::AudioDecoder (shared_ptr<const AudioContent> content)
: _audio_content (content)
+ , _ignore_audio (false)
{
BOOST_FOREACH (AudioStreamPtr i, content->audio_streams ()) {
_streams[i] = shared_ptr<AudioDecoderStream> (new AudioDecoderStream (_audio_content, i, this));
@@ -47,6 +48,10 @@ AudioDecoder::get_audio (AudioStreamPtr stream, Frame frame, Frame length, bool
void
AudioDecoder::audio (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, ContentTime time)
{
+ if (_ignore_audio) {
+ return;
+ }
+
if (_streams.find (stream) == _streams.end ()) {
/* This method can be called with an unknown stream during the following sequence:
@@ -88,3 +93,10 @@ AudioDecoder::seek (ContentTime t, bool accurate)
i->second->seek (t, accurate);
}
}
+
+/** Set this player never to produce any audio data */
+void
+AudioDecoder::set_ignore_audio ()
+{
+ _ignore_audio = true;
+}
diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h
index 6cdaeeecf..d5e7c6f55 100644
--- a/src/lib/audio_decoder.h
+++ b/src/lib/audio_decoder.h
@@ -53,6 +53,8 @@ public:
*/
ContentAudio get_audio (AudioStreamPtr stream, Frame time, Frame length, bool accurate);
+ void set_ignore_audio ();
+
protected:
void audio (AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
void flush ();
@@ -62,6 +64,7 @@ private:
boost::shared_ptr<const AudioContent> _audio_content;
/** An AudioDecoderStream object to manage each stream in _audio_content */
std::map<AudioStreamPtr, boost::shared_ptr<AudioDecoderStream> > _streams;
+ bool _ignore_audio;
};
#endif
diff --git a/src/lib/player.cc b/src/lib/player.cc
index caa2791b8..5e1fbcc63 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -74,6 +74,7 @@ Player::Player (shared_ptr<const Film> film, shared_ptr<const Playlist> playlist
, _playlist (playlist)
, _have_valid_pieces (false)
, _ignore_video (false)
+ , _ignore_audio (false)
, _always_burn_subtitles (false)
{
_film_changed_connection = _film->Changed.connect (bind (&Player::film_changed, this, _1));
@@ -180,6 +181,11 @@ Player::setup_pieces ()
vd->set_ignore_video ();
}
+ shared_ptr<AudioDecoder> ad = dynamic_pointer_cast<AudioDecoder> (decoder);
+ if (ad && _ignore_audio) {
+ ad->set_ignore_audio ();
+ }
+
_pieces.push_back (shared_ptr<Piece> (new Piece (i, decoder, frc.get ())));
}
@@ -652,6 +658,13 @@ Player::set_ignore_video ()
_ignore_video = true;
}
+/** Set this player never to produce any audio data */
+void
+Player::set_ignore_audio ()
+{
+ _ignore_audio = true;
+}
+
/** Set whether or not this player should always burn text subtitles into the image,
* regardless of the content settings.
* @param burn true to always burn subtitles, false to obey content settings.
diff --git a/src/lib/player.h b/src/lib/player.h
index 061388c44..0a2117470 100644
--- a/src/lib/player.h
+++ b/src/lib/player.h
@@ -49,6 +49,7 @@ public:
void set_video_container_size (dcp::Size);
void set_ignore_video ();
+ void set_ignore_audio ();
void set_enable_subtitles (bool enable);
void set_always_burn_subtitles (bool burn);
@@ -117,6 +118,8 @@ private:
/** true if the player should ignore all video; i.e. never produce any */
bool _ignore_video;
+ /** true if the player should ignore all audio; i.e. never produce any */
+ bool _ignore_audio;
/** true if the player should always burn subtitles into the video regardless
of content settings
*/
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 020d57ce3..3f4bc6514 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -149,6 +149,7 @@ FilmViewer::set_film (shared_ptr<Film> film)
in the preview.
*/
_player->set_always_burn_subtitles (true);
+ _player->set_ignore_audio ();
_film_connection = _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1));