A few fixes; try to support sndfile audio in player.
[dcpomatic.git] / src / wx / film_viewer.cc
index 4d8685dd0cb232d3f95575c20f149500efd2119c..bd56efd579055347dc0b5522061a98803188d915 100644 (file)
@@ -84,18 +84,6 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
        _play_button->Connect (wxID_ANY, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler (FilmViewer::play_clicked), 0, this);
        _timer.Connect (wxID_ANY, wxEVT_TIMER, wxTimerEventHandler (FilmViewer::timer), 0, this);
 
-       if (f) {
-               /* We need a player before we set_film() so that the first frame will be displayed */
-               _player = f->player ();
-               _player->disable_audio ();
-               _player->disable_video_sync ();
-               /* Don't disable subtitles here as we may need them, and it's nice to be able to turn them
-                  on and off without needing obtain a new Player.
-               */
-               
-               _player->Video.connect (bind (&FilmViewer::process_video, this, _1, _2, _3));
-       }
-
        set_film (f);
 
        JobManager::instance()->ActiveJobsChanged.connect (
@@ -142,13 +130,22 @@ FilmViewer::set_film (shared_ptr<Film> f)
        if (_film == f) {
                return;
        }
-       
+
        _film = f;
 
        if (!_film) {
                return;
        }
 
+       _player = f->player ();
+       _player->disable_audio ();
+       _player->disable_video_sync ();
+       /* Don't disable subtitles here as we may need them, and it's nice to be able to turn them
+          on and off without needing obtain a new Player.
+       */
+       
+       _player->Video.connect (bind (&FilmViewer::process_video, this, _1, _2, _3));
+       
        _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1));
 
        film_changed (Film::CONTENT);