Merge 1.70.0-hotfix branch into master.
[dcpomatic.git] / src / lib / player.h
index 7cce7e7237fd204690c1d246263f06a36656bcd8..6e70ad707cf79052cd24a64cbc0c1344020a2e1c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -29,6 +29,8 @@
 #include "rect.h"
 #include "audio_merger.h"
 #include "audio_content.h"
+#include "piece.h"
+#include "subtitle.h"
 
 class Job;
 class Film;
@@ -37,11 +39,12 @@ class AudioContent;
 class Piece;
 class Image;
 class Resampler;
-
+class PlayerVideoFrame;
+class ImageProxy;
 /** @class Player
  *  @brief A class which can `play' a Playlist; emitting its audio and video.
  */
 class Player : public boost::enable_shared_from_this<Player>, public boost::noncopyable
 {
 public:
@@ -63,12 +66,10 @@ public:
 
        /** Emitted when a video frame is ready.
         *  First parameter is the video image.
-        *  Second parameter is the eye(s) that should see this image.
-        *  Third parameter is the colour conversion that should be used for this image.
-        *  Fourth parameter is true if the image is the same as the last one that was emitted.
-        *  Fifth parameter is the time.
+        *  Second parameter is true if the frame is the same as the last one that was emitted.
+        *  Third parameter is the time.
         */
-       boost::signals2::signal<void (boost::shared_ptr<const Image>, Eyes, ColourConversion, bool, Time)> Video;
+       boost::signals2::signal<void (boost::shared_ptr<PlayerVideoFrame>, bool, Time)> Video;
        
        /** Emitted when some audio data is ready */
        boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, Time)> Audio;
@@ -83,9 +84,10 @@ public:
 
 private:
        friend class PlayerWrapper;
+       friend class Piece;
 
-       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_video (boost::weak_ptr<Piece>, boost::shared_ptr<const ImageProxy>, Eyes, Part, bool, VideoContent::Frame, Time);
+       void process_audio (boost::weak_ptr<Piece>, boost::shared_ptr<const AudioBuffers>, AudioContent::Frame, bool);
        void process_subtitle (boost::weak_ptr<Piece>, boost::shared_ptr<Image>, dcpomatic::Rect<double>, Time, Time);
        void setup_pieces ();
        void playlist_changed ();
@@ -116,23 +118,10 @@ private:
        AudioMerger<Time, AudioContent::Frame> _audio_merger;
 
        libdcp::Size _video_container_size;
-       boost::shared_ptr<Image> _black_frame;
+       boost::shared_ptr<PlayerVideoFrame> _black_frame;
        std::map<boost::shared_ptr<AudioContent>, boost::shared_ptr<Resampler> > _resamplers;
 
-       struct {
-               boost::weak_ptr<Piece> piece;
-               boost::shared_ptr<Image> image;
-               dcpomatic::Rect<double> rect;
-               Time from;
-               Time to;
-       } _in_subtitle;
-
-       struct {
-               boost::shared_ptr<Image> image;
-               Position<int> position;
-               Time from;
-               Time to;
-       } _out_subtitle;
+       std::list<Subtitle> _subtitles;
 
 #ifdef DCPOMATIC_DEBUG
        boost::shared_ptr<Content> _last_video;
@@ -140,13 +129,7 @@ private:
 
        bool _last_emit_was_black;
 
-       struct {
-               boost::weak_ptr<Piece> weak_piece;
-               boost::shared_ptr<const Image> image;
-               Eyes eyes;
-               bool same;
-               VideoContent::Frame frame;
-       } _last_process_video;
+       IncomingVideo _last_incoming_video;
 
        boost::signals2::scoped_connection _playlist_changed_connection;
        boost::signals2::scoped_connection _playlist_content_changed_connection;