From: Carl Hetherington Date: Wed, 10 Apr 2013 18:40:45 +0000 (+0100) Subject: Various fix-ups. X-Git-Tag: v2.0.48~1337^2~459 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=5c620f37c8979a645a2094aa36b9af3d4f4ef5ec Various fix-ups. --- diff --git a/src/lib/player.cc b/src/lib/player.cc index 19899f6da..c66d091cf 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -153,11 +153,11 @@ Player::seek (double t) setup_decoders (); _have_valid_decoders = true; } - + /* Find the decoder that contains this position */ _video_decoder = _video_decoders.begin (); while (_video_decoder != _video_decoders.end ()) { - double const this_length = (*_video_decoder)->video_length() / _film->video_frame_rate (); + double const this_length = double ((*_video_decoder)->video_length()) / _film->video_frame_rate (); if (t < this_length) { break; } @@ -179,6 +179,10 @@ Player::seek (double t) void Player::setup_decoders () { + _video_decoders.clear (); + _video_decoder = _video_decoders.end (); + _sndfile_decoders.clear (); + if (_video) { list > vc = _playlist->video (); for (list >::iterator i = vc.begin(); i != vc.end(); ++i) { diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index a197a7490..9cd10ad61 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -788,7 +788,7 @@ FilmEditor::setup_frame_rate_description () if (_film->video_frame_rate()) { d << std_to_wx (FrameRateConversion (_film->video_frame_rate(), _film->dcp_frame_rate()).description); #ifdef HAVE_SWRESAMPLE - if (_film->audio_frame_rate() != _film->target_audio_sample_rate ()) { + if (_film->audio_frame_rate() && _film->audio_frame_rate() != _film->target_audio_sample_rate ()) { d << wxString::Format ( _("Audio will be resampled from %dHz to %dHz\n"), _film->audio_frame_rate(), diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 8fca8f370..d18083694 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -49,6 +49,7 @@ using std::cout; using std::list; using boost::shared_ptr; using boost::dynamic_pointer_cast; +using boost::weak_ptr; using libdcp::Size; FilmViewer::FilmViewer (shared_ptr f, wxWindow* p) @@ -146,6 +147,7 @@ FilmViewer::set_film (shared_ptr f) _player->Video.connect (bind (&FilmViewer::process_video, this, _1, _2, _3)); _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1)); + _film->ContentChanged.connect (boost::bind (&FilmViewer::film_content_changed, this, _1, _2)); film_changed (Film::CONTENT); film_changed (Film::FORMAT); @@ -431,3 +433,12 @@ FilmViewer::active_jobs_changed (bool a) _play_button->Enable (!a); } +void +FilmViewer::film_content_changed (weak_ptr, int p) +{ + if (p == VideoContentProperty::VIDEO_LENGTH) { + /* Force an update to our frame */ + wxScrollEvent ev; + slider_moved (ev); + } +} diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 0f7b142b5..0ce8a526e 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -61,6 +61,7 @@ public: private: void film_changed (Film::Property); + void film_content_changed (boost::weak_ptr, int); void paint_panel (wxPaintEvent &); void panel_sized (wxSizeEvent &); void slider_moved (wxScrollEvent &);