X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Fplayer.cc;fp=src%2Flib%2Fplayer.cc;h=635b67cad728e3cc0d08905b91e427500eef9c26;hp=c77059b0ab546ce5fdb503fa12b6becce155e3e1;hb=47f25009bcbc765e397bcb471dd361a511c99daf;hpb=afc495f722f89fea0bcc579046d1a5d362e36f69 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 f, shared_ptr 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) } void -Player::process_video (shared_ptr i, bool same, shared_ptr s) +Player::process_video (shared_ptr i, bool same, shared_ptr 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 c, shared_ptr b) +Player::process_audio (weak_ptr c, shared_ptr 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 c, shared_ptr 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 >::iterator i = sc.begin(); i != sc.end(); ++i) { shared_ptr 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 {