Use more direct route to fix hangs after calling some Player methods.
[dcpomatic.git] / src / lib / player.h
index 223db86b3d442e7cd7540d0c60442d1e426570bc..20b68ef774243d632d0048747fce5b264802b289 100644 (file)
@@ -73,11 +73,13 @@ public:
        std::list<boost::shared_ptr<Font> > get_subtitle_fonts ();
        std::list<ReferencedReelAsset> get_reel_assets ();
        dcp::Size video_container_size () const {
+               boost::mutex::scoped_lock lm (_mutex);
                return _video_container_size;
        }
 
        void set_video_container_size (dcp::Size);
        void set_ignore_video ();
+       void set_ignore_audio ();
        void set_ignore_text ();
        void set_always_burn_open_subtitles ();
        void set_fast ();
@@ -86,8 +88,6 @@ public:
 
        DCPTime content_time_to_dcp (boost::shared_ptr<Content> content, ContentTime t);
 
-       std::list<PlayerText> closed_captions_for_frame (DCPTime time) const;
-
        /** Emitted when something has changed such that if we went back and emitted
         *  the last frame again it would look different.  This is not emitted after
         *  a seek.
@@ -141,6 +141,12 @@ private:
        void do_emit_video (boost::shared_ptr<PlayerVideo> pv, DCPTime time);
        void emit_audio (boost::shared_ptr<AudioBuffers> data, DCPTime time);
 
+       /** Mutex to protect the whole Player state.  When it's used for the preview we have
+           seek() and pass() called from the Butler thread and lots of other stuff called
+           from the GUI thread.
+       */
+       mutable boost::mutex _mutex;
+
        boost::shared_ptr<const Film> _film;
        boost::shared_ptr<const Playlist> _playlist;
 
@@ -154,6 +160,7 @@ private:
 
        /** true if the player should ignore all video; i.e. never produce any */
        bool _ignore_video;
+       bool _ignore_audio;
        /** true if the player should ignore all text; i.e. never produce any */
        bool _ignore_text;
        bool _always_burn_open_subtitles;