Remove swaroop variant.
[dcpomatic.git] / src / wx / video_view.cc
index 4edc2cd23a28cf0f3b943fe3a9d6cb409fecd973..aa3a469dab5267cfb5b9aed3eba70db604c7bdc2 100644 (file)
 #include "wx_util.h"
 #include "film_viewer.h"
 #include "lib/butler.h"
+#include "lib/dcpomatic_log.h"
 #include <boost/optional.hpp>
 
+using std::pair;
 using boost::shared_ptr;
 using boost::optional;
 
 VideoView::VideoView (FilmViewer* viewer)
        : _viewer (viewer)
-#ifdef DCPOMATIC_VARIANT_SWAROOP
-       , _in_watermark (false)
-#endif
        , _state_timer ("viewer")
        , _video_frame_rate (0)
        , _eyes (EYES_LEFT)
        , _three_d (false)
        , _dropped (0)
+       , _errored (0)
        , _gets (0)
 {
 
@@ -71,10 +71,14 @@ VideoView::get_next_frame (bool non_blocking)
 
        do {
                Butler::Error e;
-               _player_video = butler->get_video (!non_blocking, &e);
-               if (!_player_video.first && e == Butler::AGAIN) {
+               pair<shared_ptr<PlayerVideo>, dcpomatic::DCPTime> pv = butler->get_video (!non_blocking, &e);
+               if (e.code == Butler::Error::DIED) {
+                       LOG_ERROR ("Butler died with %1", e.summary());
+               }
+               if (!pv.first && e.code == Butler::Error::AGAIN) {
                        return false;
                }
+               _player_video = pv;
        } while (
                _player_video.first &&
                _three_d &&
@@ -82,6 +86,10 @@ VideoView::get_next_frame (bool non_blocking)
                _player_video.first->eyes() != EYES_BOTH
                );
 
+       if (_player_video.first && _player_video.first->error()) {
+               ++_errored;
+       }
+
        return true;
 }
 
@@ -113,17 +121,18 @@ VideoView::start ()
 {
        boost::mutex::scoped_lock lm (_mutex);
        _dropped = 0;
+       _errored = 0;
 }
 
 bool
 VideoView::refresh_metadata (shared_ptr<const Film> film, dcp::Size video_container_size, dcp::Size film_frame_size)
 {
-       boost::mutex::scoped_lock lm (_mutex);
-       if (!_player_video.first) {
+       pair<shared_ptr<PlayerVideo>, dcpomatic::DCPTime> pv = player_video ();
+       if (!pv.first) {
                return false;
        }
 
-       if (!_player_video.first->reset_metadata (film, video_container_size, film_frame_size)) {
+       if (!pv.first->reset_metadata (film, video_container_size, film_frame_size)) {
                return false;
        }