Move resampling back into AudioDecoder and fix various screw-ups with audio in the...
[dcpomatic.git] / src / lib / player.h
index 5a4ee97becdc561b72cad6e59a36f97e77f02a80..5b1b6936bc95a41ca548fef98f32cc146da9a628 100644 (file)
@@ -35,13 +35,12 @@ class Playlist;
 class AudioContent;
 class Piece;
 class Image;
-class Resampler;
 
 /** @class Player
  *  @brief A class which can `play' a Playlist; emitting its audio and video.
  */
  
-class Player : public boost::enable_shared_from_this<Player>
+class Player : public boost::enable_shared_from_this<Player>, public boost::noncopyable
 {
 public:
        Player (boost::shared_ptr<const Film>, boost::shared_ptr<const Playlist>);
@@ -60,10 +59,11 @@ public:
 
        /** Emitted when a video frame is ready.
         *  First parameter is the video image.
-        *  Second parameter is true if the image is the same as the last one that was emitted.
-        *  Third parameter is the time.
+        *  Second parameter is the eye(s) that should see this image.
+        *  Third parameter is true if the image is the same as the last one that was emitted.
+        *  Fourth parameter is the time.
         */
-       boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, Time)> Video;
+       boost::signals2::signal<void (boost::shared_ptr<const Image>, Eyes, bool, Time)> Video;
        
        /** Emitted when some audio data is ready */
        boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, Time)> Audio;
@@ -71,22 +71,24 @@ public:
        /** 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.
+        *
+        *  The parameter is true if these signals are currently likely to be frequent.
         */
-       boost::signals2::signal<void ()> Changed;
+       boost::signals2::signal<void (bool)> Changed;
 
 private:
+       friend class PlayerWrapper;
 
-       void process_video (boost::weak_ptr<Piece>, boost::shared_ptr<const Image>, bool, VideoContent::Frame);
+       void process_video (boost::weak_ptr<Piece>, boost::shared_ptr<const Image>, Eyes, bool, VideoContent::Frame);
        void process_audio (boost::weak_ptr<Piece>, boost::shared_ptr<const AudioBuffers>, AudioContent::Frame);
        void process_subtitle (boost::weak_ptr<Piece>, boost::shared_ptr<Image>, dcpomatic::Rect<double>, Time, Time);
        void setup_pieces ();
        void playlist_changed ();
-       void content_changed (boost::weak_ptr<Content>, int);
+       void content_changed (boost::weak_ptr<Content>, int, bool);
        void do_seek (Time, bool);
        void flush ();
        void emit_black ();
        void emit_silence (OutputAudioFrame);
-       boost::shared_ptr<Resampler> resampler (boost::shared_ptr<AudioContent>);
        void film_changed (Film::Property);
        void update_subtitle ();
 
@@ -109,7 +111,6 @@ private:
 
        libdcp::Size _video_container_size;
        boost::shared_ptr<Image> _black_frame;
-       std::map<boost::shared_ptr<AudioContent>, boost::shared_ptr<Resampler> > _resamplers;
 
        struct {
                boost::weak_ptr<Piece> piece;
@@ -125,6 +126,10 @@ private:
                Time from;
                Time to;
        } _out_subtitle;
+
+#ifdef DCPOMATIC_DEBUG
+       boost::shared_ptr<Content> _last_video;
+#endif 
 };
 
 #endif