#include "image_decoder.h"
#include "compose.hpp"
#include "shuffler.h"
+#include "delay.h"
#include <dcp/reel.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel_subtitle_asset.h>
, _play_referenced (false)
, _audio_merger (_film->audio_frame_rate())
, _shuffler (0)
+ , _delay (0)
{
_film_changed_connection = _film->Changed.connect (bind (&Player::film_changed, this, _1));
_playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this));
Player::~Player ()
{
delete _shuffler;
+ delete _delay;
}
void
_shuffler = new Shuffler();
_shuffler->Video.connect(bind(&Player::video, this, _1, _2));
+ delete _delay;
+ _delay = new Delay();
+ _delay->Video.connect(bind(&Player::video, this, _1, _2));
+
BOOST_FOREACH (shared_ptr<Content> i, _playlist->content ()) {
if (!i->paths_valid ()) {
if (decoder->video) {
if (i->video->frame_type() == VIDEO_FRAME_TYPE_3D_LEFT || i->video->frame_type() == VIDEO_FRAME_TYPE_3D_RIGHT) {
+ /* We need a Shuffler to cope with 3D L/R video data arriving out of sequence */
decoder->video->Data.connect (bind (&Shuffler::video, _shuffler, weak_ptr<Piece>(piece), _1));
} else {
- decoder->video->Data.connect (bind (&Player::video, this, weak_ptr<Piece>(piece), _1));
+ /* We need a Delay to give a little wiggle room to ensure that relevent subtitles arrive at the
+ player before the video that requires them.
+ */
+ decoder->video->Data.connect (bind (&Delay::video, _delay, weak_ptr<Piece>(piece), _1));
}
}
if (done) {
_shuffler->flush ();
+ _delay->flush ();
}
return done;
}
_shuffler->clear ();
}
+ if (_delay) {
+ _delay->clear ();
+ }
+
if (_audio_processor) {
_audio_processor->flush ();
}