diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-04-21 22:41:52 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-04-21 22:41:52 +0100 |
| commit | 47f25009bcbc765e397bcb471dd361a511c99daf (patch) | |
| tree | 356ac924524183047a84e34674985b3a00c5ca24 /src/lib/player.cc | |
| parent | afc495f722f89fea0bcc579046d1a5d362e36f69 (diff) | |
| parent | e8d8a27c7f6861b031b3250b0ad50d04c41a7721 (diff) | |
Untested merge of master.
Diffstat (limited to 'src/lib/player.cc')
| -rw-r--r-- | src/lib/player.cc | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index c77059b0a..635b67cad 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -41,7 +41,6 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p) , _audio (true) , _subtitles (true) , _have_valid_decoders (false) - , _video_sync (true) { _playlist->Changed.connect (bind (&Player::playlist_changed, this)); _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2)); @@ -92,8 +91,9 @@ Player::pass () } } - Audio (_audio_buffers); + Audio (_audio_buffers, _audio_time.get()); _audio_buffers.reset (); + _audio_time = boost::none; } return done; @@ -118,18 +118,21 @@ Player::set_progress (shared_ptr<Job> job) } void -Player::process_video (shared_ptr<Image> i, bool same, shared_ptr<Subtitle> s) +Player::process_video (shared_ptr<Image> i, bool same, shared_ptr<Subtitle> s, double t) { - Video (i, same, s); + /* XXX: this time will need mangling to add on the offset of the start of the content */ + Video (i, same, s, t); } void -Player::process_audio (weak_ptr<const AudioContent> c, shared_ptr<AudioBuffers> b) +Player::process_audio (weak_ptr<const AudioContent> c, shared_ptr<AudioBuffers> b, double t) { + /* XXX: this time will need mangling to add on the offset of the start of the content */ AudioMapping mapping = _film->audio_mapping (); if (!_audio_buffers) { _audio_buffers.reset (new AudioBuffers (mapping.dcp_channels(), b->frames ())); _audio_buffers->make_silent (); + _audio_time = t; } for (int i = 0; i < b->channels(); ++i) { @@ -141,8 +144,9 @@ Player::process_audio (weak_ptr<const AudioContent> c, shared_ptr<AudioBuffers> if (_playlist->audio_from() == Playlist::AUDIO_FFMPEG) { /* We can just emit this audio now as it will all be here */ - Audio (_audio_buffers); + Audio (_audio_buffers, t); _audio_buffers.reset (); + _audio_time = boost::none; } } @@ -177,6 +181,20 @@ Player::seek (double t) return false; } + +void +Player::seek_back () +{ + /* XXX */ +} + +void +Player::seek_forward () +{ + /* XXX */ +} + + void Player::setup_decoders () { @@ -198,13 +216,12 @@ Player::setup_decoders () new FFmpegDecoder ( _film, fc, _video, _audio && _playlist->audio_from() == Playlist::AUDIO_FFMPEG, - _subtitles, - _video_sync + _subtitles ) ); if (_playlist->audio_from() == Playlist::AUDIO_FFMPEG) { - fd->Audio.connect (bind (&Player::process_audio, this, fc, _1)); + fd->Audio.connect (bind (&Player::process_audio, this, fc, _1, _2)); } d = fd; @@ -227,17 +244,11 @@ Player::setup_decoders () for (list<shared_ptr<const SndfileContent> >::iterator i = sc.begin(); i != sc.end(); ++i) { shared_ptr<SndfileDecoder> d (new SndfileDecoder (_film, *i)); _sndfile_decoders.push_back (d); - d->Audio.connect (bind (&Player::process_audio, this, *i, _1)); + d->Audio.connect (bind (&Player::process_audio, this, *i, _1, _2)); } } } -void -Player::disable_video_sync () -{ - _video_sync = false; -} - double Player::last_video_time () const { |
