X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fvideo_view.h;h=5d5d3316377c2c3e03a9af08d11254086bf479bd;hb=f77529bdfa01ae13f889442900988fc401b63c62;hp=d9ef2a65f4859afd8a8bea01dd8ef9abd0c8642b;hpb=046d84f45621f7e128cb30160a315f98881c6f4b;p=dcpomatic.git diff --git a/src/wx/video_view.h b/src/wx/video_view.h index d9ef2a65f..5d5d33163 100644 --- a/src/wx/video_view.h +++ b/src/wx/video_view.h @@ -22,33 +22,33 @@ #define DCPOMATIC_VIDEO_VIEW_H #include "lib/dcpomatic_time.h" +#include "lib/timer.h" +#include "lib/types.h" +#include "lib/exception_store.h" #include #include #include +#include class Image; class wxWindow; class FilmViewer; class PlayerVideo; -class VideoView +class VideoView : public ExceptionStore, public boost::noncopyable { public: - VideoView (FilmViewer* viewer) - : _viewer (viewer) -#ifdef DCPOMATIC_VARIANT_SWAROOP - , _in_watermark (false) -#endif - {} - + VideoView (FilmViewer* viewer); virtual ~VideoView () {} virtual void set_image (boost::shared_ptr image) = 0; virtual wxWindow* get () const = 0; + /** Redraw the view after something has changed like content outlining, + * the film being removed, etc. + */ virtual void update () = 0; - /* XXX_b: make pure */ - virtual void start () {} + virtual void start (); /* XXX_b: make pure */ virtual void stop () {} @@ -61,14 +61,43 @@ public: /* XXX_b: to remove */ virtual void display_player_video () {} + int dropped () const { + boost::mutex::scoped_lock lm (_mutex); + return _dropped; + } + + int gets () const { + boost::mutex::scoped_lock lm (_mutex); + return _gets; + } + + StateTimer const & state_timer () const { + return _state_timer; + } + dcpomatic::DCPTime position () const { boost::mutex::scoped_lock lm (_mutex); return _player_video.second; } - void set_film (boost::shared_ptr film) { + void set_video_frame_rate (int r) { + boost::mutex::scoped_lock lm (_mutex); + _video_frame_rate = r; + } + + void set_length (dcpomatic::DCPTime len) { + boost::mutex::scoped_lock lm (_mutex); + _length = len; + } + + void set_eyes (Eyes eyes) { + boost::mutex::scoped_lock lm (_mutex); + _eyes = eyes; + } + + void set_three_d (bool t) { boost::mutex::scoped_lock lm (_mutex); - _film = film; + _three_d = t; } protected: @@ -79,16 +108,32 @@ protected: int time_until_next_frame () const; dcpomatic::DCPTime one_video_frame () const; - boost::shared_ptr film () const { + int video_frame_rate () const { boost::mutex::scoped_lock lm (_mutex); - return _film; + return _video_frame_rate; } - FilmViewer* _viewer; - std::pair, dcpomatic::DCPTime> _player_video; + dcpomatic::DCPTime length () const { + boost::mutex::scoped_lock lm (_mutex); + return _length; + } - /** Mutex protecting all the state in VideoView */ - mutable boost::mutex _mutex; + std::pair, dcpomatic::DCPTime> player_video () const { + boost::mutex::scoped_lock lm (_mutex); + return _player_video; + } + + void add_dropped () { + boost::mutex::scoped_lock lm (_mutex); + ++_dropped; + } + + void add_get () { + boost::mutex::scoped_lock lm (_mutex); + ++_gets; + } + + FilmViewer* _viewer; #ifdef DCPOMATIC_VARIANT_SWAROOP bool _in_watermark; @@ -96,8 +141,21 @@ protected: int _watermark_y; #endif + StateTimer _state_timer; + private: - boost::shared_ptr _film; + /** Mutex protecting all the state in VideoView */ + mutable boost::mutex _mutex; + + std::pair, dcpomatic::DCPTime> _player_video; + int _video_frame_rate; + /** length of the film we are playing, or 0 if there is none */ + dcpomatic::DCPTime _length; + Eyes _eyes; + bool _three_d; + + int _dropped; + int _gets; }; #endif