Various fix-ups.
authorCarl Hetherington <cth@carlh.net>
Wed, 10 Apr 2013 18:40:45 +0000 (19:40 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 10 Apr 2013 18:40:45 +0000 (19:40 +0100)
src/lib/player.cc
src/wx/film_editor.cc
src/wx/film_viewer.cc
src/wx/film_viewer.h

index 19899f6daabe92f404c6148bde4da6633ce37c91..c66d091cf66fb27f82ed58235ec162aef36917be 100644 (file)
@@ -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<shared_ptr<const VideoContent> > vc = _playlist->video ();
                for (list<shared_ptr<const VideoContent> >::iterator i = vc.begin(); i != vc.end(); ++i) {
index a197a7490b4b2b7f7f36d5fa8be29fc04c36d99a..9cd10ad615c8344333466593b239aa0166f3c3fa 100644 (file)
@@ -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(),
index 8fca8f3709975fdf9cbe7a05a9da47e0e8f0a30b..d180836941331da2da3863abe7217055b1a07ea3 100644 (file)
@@ -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<Film> f, wxWindow* p)
@@ -146,6 +147,7 @@ FilmViewer::set_film (shared_ptr<Film> 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<Content>, int p)
+{
+       if (p == VideoContentProperty::VIDEO_LENGTH) {
+               /* Force an update to our frame */
+               wxScrollEvent ev;
+               slider_moved (ev);
+       }
+}
index 0f7b142b50f55630b04dabad29f41550481336c5..0ce8a526eb8f2ac19e9136e803e6b7c9c75c7818 100644 (file)
@@ -61,6 +61,7 @@ public:
 
 private:
        void film_changed (Film::Property);
+       void film_content_changed (boost::weak_ptr<Content>, int);
        void paint_panel (wxPaintEvent &);
        void panel_sized (wxSizeEvent &);
        void slider_moved (wxScrollEvent &);