using std::bad_alloc;
using std::make_pair;
using std::exception;
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
-using boost::weak_ptr;
+using std::shared_ptr;
+using std::dynamic_pointer_cast;
+using std::weak_ptr;
using boost::optional;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
, _closed_captions_dialog (new ClosedCaptionsDialog(p, this))
, _outline_content (false)
, _pad_black (false)
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , _background_image (false)
-#endif
, _idle_get (false)
{
switch (Config::instance()->video_view_type()) {
return;
}
- if (_video_view->display_next_frame(true)) {
- _idle_get = false;
- } else {
+ if (_video_view->display_next_frame(true) == VideoView::AGAIN) {
/* get() could not complete quickly so we'll try again later */
signal_manager->when_idle (boost::bind(&FilmViewer::idle_handler, this));
+ } else {
+ _idle_get = false;
}
}
_film->LengthChange.connect (boost::bind(&FilmViewer::film_length_change, this));
_player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
- film_change (CHANGE_TYPE_DONE, Film::VIDEO_FRAME_RATE);
- film_change (CHANGE_TYPE_DONE, Film::THREE_D);
+ film_change (ChangeType::DONE, Film::Property::VIDEO_FRAME_RATE);
+ film_change (ChangeType::DONE, Film::Property::THREE_D);
film_length_change ();
/* Keep about 1 second's worth of history samples */
_butler.reset(
new Butler(
+ _film,
_player,
Config::instance()->audio_mapping(_audio_channels),
_audio_channels,
bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24),
+ VideoRange::FULL,
false,
true
)
}
_playing = true;
- _video_view->start ();
+ /* Calling start() below may directly result in Stopped being emitted, and if that
+ * happens we want it to come after the Started signal, so do that first.
+ */
Started (position());
+ _video_view->start ();
}
bool
void
FilmViewer::player_change (ChangeType type, int property, bool frequent)
{
- if (type != CHANGE_TYPE_DONE || frequent) {
+ if (type != ChangeType::DONE || frequent) {
return;
}
void
FilmViewer::film_change (ChangeType type, Film::Property p)
{
- if (type != CHANGE_TYPE_DONE) {
+ if (type != ChangeType::DONE) {
return;
}
- if (p == Film::AUDIO_CHANNELS) {
+ if (p == Film::Property::AUDIO_CHANNELS) {
recreate_butler ();
- } else if (p == Film::VIDEO_FRAME_RATE) {
+ } else if (p == Film::Property::VIDEO_FRAME_RATE) {
_video_view->set_video_frame_rate (_film->video_frame_rate());
- } else if (p == Film::THREE_D) {
+ } else if (p == Film::Property::THREE_D) {
_video_view->set_three_d (_film->three_d());
- } else if (p == Film::CONTENT) {
+ } else if (p == Film::Property::CONTENT) {
_closed_captions_dialog->update_tracks (_film);
}
}
if (!_video_view || !_film || !_player) {
return true;
}
- return _video_view->refresh_metadata (_film, _player->video_container_size(), _film->frame_size());
+ return _video_view->reset_metadata (_film, _player->video_container_size());
}
void
_coalesce_player_changes = c;
if (!c) {
- BOOST_FOREACH (int i, _pending_player_changes) {
- player_change (CHANGE_TYPE_DONE, i, false);
+ for (auto i: _pending_player_changes) {
+ player_change (ChangeType::DONE, i, false);
}
_pending_player_changes.clear ();
}
/* We're going to start playing again straight away
so wait for the seek to finish.
*/
- while (!_video_view->display_next_frame(false)) {}
+ while (_video_view->display_next_frame(false) == VideoView::AGAIN) {}
}
resume ();
void
FilmViewer::config_changed (Config::Property p)
{
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- if (p == Config::PLAYER_BACKGROUND_IMAGE) {
- _video_view->update ();
- return;
- }
-#endif
-
if (p == Config::AUDIO_MAPPING) {
recreate_butler ();
return;
sp.nChannels = _audio_channels;
sp.firstChannel = 0;
_audio.openStream (&sp, 0, RTAUDIO_FLOAT32, 48000, &_audio_block_size, &rtaudio_callback, this);
-#ifdef DCPOMATIC_USE_RTERROR
- } catch (RtError& e) {
-#else
} catch (RtAudioError& e) {
-#endif
_audio_channels = 0;
error_dialog (
_video_view->get(),
}
Frame total = 0;
- BOOST_FOREACH (Frame i, _latency_history) {
+ for (auto i: _latency_history) {
total += i;
}
void
FilmViewer::content_change (ChangeType type, int property)
{
- if (type != CHANGE_TYPE_DONE) {
+ if (type != ChangeType::DONE) {
return;
}
}
}
+
+void
+FilmViewer::image_changed (shared_ptr<PlayerVideo> pv)
+{
+ emit (boost::bind(boost::ref(ImageChanged), pv));
+}
+