Remove Timed*Sink and Timed*Source>
authorCarl Hetherington <cth@carlh.net>
Fri, 10 May 2013 22:31:25 +0000 (23:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 10 May 2013 22:31:25 +0000 (23:31 +0100)
14 files changed:
src/lib/audio_decoder.h
src/lib/audio_sink.h
src/lib/audio_source.cc
src/lib/audio_source.h
src/lib/combiner.cc
src/lib/combiner.h
src/lib/encoder.cc
src/lib/encoder.h
src/lib/player.h
src/lib/processor.h
src/lib/video_decoder.h
src/lib/video_sink.h
src/lib/video_source.cc
src/lib/video_source.h

index 8db16e3694b540f3bdb0c700ff02d97a645de220..1c7287a55434ea1cdbbfefb709935def12a60658 100644 (file)
@@ -35,7 +35,7 @@ class AudioContent;
 /** @class AudioDecoder.
  *  @brief Parent class for audio decoders.
  */
-class AudioDecoder : public TimedAudioSource, public virtual Decoder
+class AudioDecoder : public AudioSource, public virtual Decoder
 {
 public:
        AudioDecoder (boost::shared_ptr<const Film>, boost::shared_ptr<const AudioContent>);
index ee39f9ee749bcdd90ff00c2954d1d79c6baf6336..2e3ead005b869bbba41ff0aec5182229ef3eb8a6 100644 (file)
@@ -24,14 +24,7 @@ class AudioSink
 {
 public:
        /** Call with some audio data */
-       virtual void process_audio (boost::shared_ptr<const AudioBuffers>) = 0;
-};
-
-class TimedAudioSink
-{
-public:
-        /** Call with some audio data */
-        virtual void process_audio (boost::shared_ptr<const AudioBuffers>, double t) = 0;
+       virtual void process_audio (boost::shared_ptr<const AudioBuffers>, Time) = 0;
 };
 
 #endif
index 2867bcc244795216412446481b7ea790def7652d..e61721646b8a4480419aa3ed3b5ca1cc0ddadc70 100644 (file)
@@ -25,38 +25,18 @@ using boost::weak_ptr;
 using boost::bind;
 
 static void
-process_audio_proxy (weak_ptr<AudioSink> sink, shared_ptr<const AudioBuffers> audio)
+process_audio_proxy (weak_ptr<AudioSink> sink, shared_ptr<const AudioBuffers> audio, Time time)
 {
        shared_ptr<AudioSink> p = sink.lock ();
        if (p) {
-               p->process_audio (audio);
+               p->process_audio (audio, time);
        }
 }
 
 void
 AudioSource::connect_audio (shared_ptr<AudioSink> s)
 {
-       Audio.connect (bind (process_audio_proxy, weak_ptr<AudioSink> (s), _1));
+       Audio.connect (bind (process_audio_proxy, weak_ptr<AudioSink> (s), _1, _2));
 }
 
-void
-TimedAudioSource::connect_audio (shared_ptr<AudioSink> s)
-{
-       Audio.connect (bind (process_audio_proxy, weak_ptr<AudioSink> (s), _1));
-}
-
-static void
-timed_process_audio_proxy (weak_ptr<TimedAudioSink> sink, shared_ptr<const AudioBuffers> audio, double t)
-{
-       shared_ptr<TimedAudioSink> p = sink.lock ();
-       if (p) {
-               p->process_audio (audio, t);
-       }
-}
-
-void
-TimedAudioSource::connect_audio (shared_ptr<TimedAudioSink> s)
-{
-       Audio.connect (bind (timed_process_audio_proxy, weak_ptr<TimedAudioSink> (s), _1, _2));
-}
 
index c7f0a09ed762c438250e67394dc50ab33dcb0892..ef47e969b16cb45cc643db7fb525c5d021fef703 100644 (file)
 #define DCPOMATIC_AUDIO_SOURCE_H
 
 #include <boost/signals2.hpp>
+#include "types.h"
 
 class AudioBuffers;
 class AudioSink;
-class TimedAudioSink;
 
 /** A class that emits audio data */
 class AudioSource
 {
 public:
        /** Emitted when some audio data is ready */
-       boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>)> Audio;
+       boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, Time)> Audio;
 
        void connect_audio (boost::shared_ptr<AudioSink>);
 };
 
-
-/** A class that emits audio data with timestamps */
-class TimedAudioSource
-{
-public:
-       /** Emitted when some audio data is ready */
-       boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, double)> Audio;
-
-       void connect_audio (boost::shared_ptr<AudioSink>);
-       void connect_audio (boost::shared_ptr<TimedAudioSink>);
-};
-
 #endif
index 367cefa7f49fead4aa824798143fbf237dbeed74..9f9461ec2b540aa44901e220146335b8c7f2d78b 100644 (file)
@@ -23,7 +23,7 @@
 using boost::shared_ptr;
 
 Combiner::Combiner (shared_ptr<Log> log)
-       : TimedVideoProcessor (log)
+       : VideoProcessor (log)
 {
 
 }
index 7ed316e26934cd663a0ab9ae92aa64d4ddca8952..062297f0dca31824f2ff262c2d7cf9a9fc318c24 100644 (file)
  *  one image used for the left half of the screen and the other for
  *  the right.
  */
-class Combiner : public TimedVideoProcessor
+class Combiner : public VideoProcessor
 {
 public:
        Combiner (boost::shared_ptr<Log> log);
 
-       void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double);
-       void process_video_b (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double);
+       void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, Time);
+       void process_video_b (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, Time);
 
 private:
        /** The image that we are currently working on */
index f91a2c4e20e3929867428c265fa139ad5b8e62c0..6cb384e20661bd3f4e7db09e9494325a2eb4ce89 100644 (file)
@@ -178,7 +178,7 @@ Encoder::frame_done ()
 }
 
 void
-Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub)
+Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub, Time)
 {
        FrameRateConversion frc (_film->video_frame_rate(), _film->dcp_frame_rate());
        
@@ -241,7 +241,7 @@ Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Sub
 }
 
 void
-Encoder::process_audio (shared_ptr<const AudioBuffers> data)
+Encoder::process_audio (shared_ptr<const AudioBuffers> data, Time)
 {
        _writer->write (data);
 }
index cce26efc8f06689fb6fb88f56c27e0eafc34a98f..b6d3663fd835e4ce77469a12b4adf7c1fcbeba3a 100644 (file)
@@ -70,10 +70,10 @@ public:
         *  @param same true if i is the same as the last time we were called.
         *  @param s A subtitle that should be on this frame, or 0.
         */
-       void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s);
+       void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s, Time);
 
        /** Call with some audio data */
-       void process_audio (boost::shared_ptr<const AudioBuffers>);
+       void process_audio (boost::shared_ptr<const AudioBuffers>, Time);
 
        /** Called when a processing run has finished */
        void process_end ();
index b6fb41f6e9eae15f04e58720ec4e9b2a5ace6847..b1be2f456ccb98998ef97785c3dd2209cfdd895e 100644 (file)
@@ -39,7 +39,7 @@ class AudioContent;
  *  @brief A class which can `play' a Playlist; emitting its audio and video.
  */
  
-class Player : public TimedVideoSource, public TimedAudioSource, public TimedVideoSink, public boost::enable_shared_from_this<Player>
+class Player : public VideoSource, public AudioSource, public VideoSink, public boost::enable_shared_from_this<Player>
 {
 public:
        Player (boost::shared_ptr<const Film>, boost::shared_ptr<const Playlist>);
index 7b7735faafa139a43b60f69f1796387edf79e413..5dbafab7f9d6d7c518e0a98e15383bd385640e64 100644 (file)
@@ -67,15 +67,6 @@ public:
        {}
 };
 
-class TimedAudioVideoProcessor : public Processor, public TimedVideoSource, public TimedVideoSink, public TimedAudioSource, public TimedAudioSink
-{
-public:
-       TimedAudioVideoProcessor (boost::shared_ptr<Log> log)
-               : Processor (log)
-       {}
-};
-                               
-
 /** @class AudioProcessor
  *  @brief A processor which handles just audio data.
  */
@@ -104,12 +95,4 @@ public:
        {}
 };
 
-class TimedVideoProcessor : public Processor, public TimedVideoSource, public TimedVideoSink
-{
-public:
-       TimedVideoProcessor (boost::shared_ptr<Log> log)
-               : Processor (log)
-       {}
-};     
-
 #endif
index 0b05b2f7143690237754d810d8557d8e80cb9d77..88730f5183c92407f9c3d8b68ff166a50e2f6ab6 100644 (file)
@@ -25,7 +25,7 @@
 
 class VideoContent;
 
-class VideoDecoder : public TimedVideoSource, public virtual Decoder
+class VideoDecoder : public VideoSource, public virtual Decoder
 {
 public:
        VideoDecoder (boost::shared_ptr<const Film>);
index 6239bc557ab68ac43b28f356372404a21566109b..2da42528c22ff93ee3d1ea59f9e9356cb46036c0 100644 (file)
@@ -34,19 +34,7 @@ public:
         *  @param same true if i is the same as last time we were called.
         *  @param s A subtitle that should be on this frame, or 0.
         */
-       virtual void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s) = 0;
-};
-
-class TimedVideoSink
-{
-public:
-       /** Call with a frame of video.
-        *  @param i Video frame image.
-        *  @param same true if i is the same as last time we were called.
-        *  @param s A subtitle that should be on this frame, or 0.
-        *  @param t Source timestamp.
-        */
-       virtual void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s, double t) = 0;
+       virtual void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s, Time) = 0;
 };
 
 #endif
index 4d505f9fea647687c48396235b1bc0dae520a86c..39043c8601ff35a141b5903013405bf3e7da91d7 100644 (file)
@@ -25,11 +25,11 @@ using boost::weak_ptr;
 using boost::bind;
 
 static void
-process_video_proxy (weak_ptr<VideoSink> sink, shared_ptr<const Image> i, bool same, shared_ptr<Subtitle> s)
+process_video_proxy (weak_ptr<VideoSink> sink, shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub, Time time)
 {
        shared_ptr<VideoSink> p = sink.lock ();
        if (p) {
-               p->process_video (i, same, s);
+               p->process_video (image, same, sub, time);
        }
 }
 
@@ -39,26 +39,6 @@ VideoSource::connect_video (shared_ptr<VideoSink> s)
        /* If we bind, say, a Player (as the VideoSink) to a Decoder (which is owned
           by the Player) we create a cycle.  Use a weak_ptr to break it.
        */
-       Video.connect (bind (process_video_proxy, weak_ptr<VideoSink> (s), _1, _2, _3));
+       Video.connect (bind (process_video_proxy, weak_ptr<VideoSink> (s), _1, _2, _3, _4));
 }
 
-void
-TimedVideoSource::connect_video (shared_ptr<VideoSink> s)
-{
-       Video.connect (bind (process_video_proxy, weak_ptr<VideoSink> (s), _1, _2, _3));
-}
-
-static void
-timed_process_video_proxy (weak_ptr<TimedVideoSink> sink, shared_ptr<const Image> i, bool same, shared_ptr<Subtitle> s, double t)
-{
-       shared_ptr<TimedVideoSink> p = sink.lock ();
-       if (p) {
-               p->process_video (i, same, s, t);
-       }
-}
-
-void
-TimedVideoSource::connect_video (shared_ptr<TimedVideoSink> s)
-{
-       Video.connect (bind (timed_process_video_proxy, weak_ptr<TimedVideoSink> (s), _1, _2, _3, _4));
-}
index 9b4c9b4a2040db794a94b179da4e2c46dcdb7dc8..7ad5544804d5840267df3e33a52f009c27eaf51f 100644 (file)
@@ -29,7 +29,6 @@
 #include "util.h"
 
 class VideoSink;
-class TimedVideoSink;
 class Subtitle;
 class Image;
 
@@ -45,28 +44,9 @@ public:
         *  Second parameter is true if the image is the same as the last one that was emitted.
         *  Third parameter is either 0 or a subtitle that should be on this frame.
         */
-       boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>)> Video;
+       boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, Time)> Video;
 
        void connect_video (boost::shared_ptr<VideoSink>);
 };
 
-/** @class TimedVideoSource
- *  @param A class that emits video data with timestamps.
- */
-class TimedVideoSource
-{
-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 either 0 or a subtitle that should be on this frame.
-        *  Fourth parameter is the source timestamp of this frame.
-        */
-       boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, double)> Video;
-
-       void connect_video (boost::shared_ptr<VideoSink>);
-       void connect_video (boost::shared_ptr<TimedVideoSink>);
-};
-
 #endif