{
_player_video_connection = _player->Video.connect (bind (&Butler::video, this, _1, _2));
_player_audio_connection = _player->Audio.connect (bind (&Butler::audio, this, _1, _2));
- _player_changed_connection = _player->Changed.connect (bind (&Butler::player_changed, this, _1));
+ _player_text_connection = _player->Text.connect (bind (&Butler::text, this, _1, _2, _3));
+ _player_changed_connection = _player->Changed.connect (bind (&Butler::return_seek, this, _2));
+ _player_not_changed_connection = _player->NotChanged.connect (bind (&Butler::return_seek, this, false));
_thread = new boost::thread (bind (&Butler::thread, this));
#ifdef DCPOMATIC_LINUX
pthread_setname_np (_thread->native_handle(), "butler");
return r;
}
+optional<pair<PlayerText, DCPTimePeriod> >
+Butler::get_closed_caption ()
+{
+ boost::mutex::scoped_lock lm (_mutex);
+ return _closed_caption.get ();
+}
+
void
Butler::seek (DCPTime position, bool accurate)
{
return;
}
+ _finished = false;
+ _pending_seek_position = position;
+ _pending_seek_accurate = accurate;
+
{
- boost::mutex::scoped_lock lm (_video_audio_mutex);
+ boost::mutex::scoped_lock lm (_buffers_mutex);
_video.clear ();
_audio.clear ();
+ _closed_caption.clear ();
}
- _finished = false;
- _pending_seek_position = position;
- _pending_seek_accurate = accurate;
_summon.notify_all ();
}
_prepare_service.post (bind (&Butler::prepare, this, weak_ptr<PlayerVideo>(video)));
- boost::mutex::scoped_lock lm2 (_video_audio_mutex);
+ boost::mutex::scoped_lock lm2 (_buffers_mutex);
_video.put (video, time);
}
}
}
- boost::mutex::scoped_lock lm2 (_video_audio_mutex);
+ boost::mutex::scoped_lock lm2 (_buffers_mutex);
_audio.put (remap (audio, _audio_channels, _audio_mapping), time);
}
}
void
-Butler::player_changed (int what)
+Butler::return_seek (bool frequent)
{
boost::mutex::scoped_lock lm (_mutex);
- if (_died || _pending_seek_position) {
+ if (_died || _pending_seek_position || frequent) {
return;
}
seek_to = next;
}
- {
- boost::mutex::scoped_lock lm (_video_audio_mutex);
- _video.clear ();
- _audio.clear ();
- }
-
- _finished = false;
- _summon.notify_all ();
-
seek_unlocked (seek_to, true);
_awaiting = seek_to;
}
+
+void
+Butler::text (PlayerText pt, TextType type, DCPTimePeriod period)
+{
+ if (type != TEXT_CLOSED_CAPTION) {
+ return;
+ }
+
+ boost::mutex::scoped_lock lm2 (_buffers_mutex);
+ _closed_caption.put (make_pair(pt, period));
+}