diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-10 23:31:25 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-10 23:31:25 +0100 |
| commit | 0db016f90ae722fc8b72d465e21d9f153f72b340 (patch) | |
| tree | 71aa0a91550c7456daf41b5a74455c2cc1b12f82 /src/lib | |
| parent | d683883c4dc25cb612f6d5feb1e772016182e722 (diff) | |
Remove Timed*Sink and Timed*Source>
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/audio_decoder.h | 2 | ||||
| -rw-r--r-- | src/lib/audio_sink.h | 9 | ||||
| -rw-r--r-- | src/lib/audio_source.cc | 26 | ||||
| -rw-r--r-- | src/lib/audio_source.h | 16 | ||||
| -rw-r--r-- | src/lib/combiner.cc | 2 | ||||
| -rw-r--r-- | src/lib/combiner.h | 6 | ||||
| -rw-r--r-- | src/lib/encoder.cc | 4 | ||||
| -rw-r--r-- | src/lib/encoder.h | 4 | ||||
| -rw-r--r-- | src/lib/player.h | 2 | ||||
| -rw-r--r-- | src/lib/processor.h | 17 | ||||
| -rw-r--r-- | src/lib/video_decoder.h | 2 | ||||
| -rw-r--r-- | src/lib/video_sink.h | 14 | ||||
| -rw-r--r-- | src/lib/video_source.cc | 26 | ||||
| -rw-r--r-- | src/lib/video_source.h | 22 |
14 files changed, 22 insertions, 130 deletions
diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h index 8db16e369..1c7287a55 100644 --- a/src/lib/audio_decoder.h +++ b/src/lib/audio_decoder.h @@ -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>); diff --git a/src/lib/audio_sink.h b/src/lib/audio_sink.h index ee39f9ee7..2e3ead005 100644 --- a/src/lib/audio_sink.h +++ b/src/lib/audio_sink.h @@ -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 diff --git a/src/lib/audio_source.cc b/src/lib/audio_source.cc index 2867bcc24..e61721646 100644 --- a/src/lib/audio_source.cc +++ b/src/lib/audio_source.cc @@ -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)); -} diff --git a/src/lib/audio_source.h b/src/lib/audio_source.h index c7f0a09ed..ef47e969b 100644 --- a/src/lib/audio_source.h +++ b/src/lib/audio_source.h @@ -25,31 +25,19 @@ #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 diff --git a/src/lib/combiner.cc b/src/lib/combiner.cc index 367cefa7f..9f9461ec2 100644 --- a/src/lib/combiner.cc +++ b/src/lib/combiner.cc @@ -23,7 +23,7 @@ using boost::shared_ptr; Combiner::Combiner (shared_ptr<Log> log) - : TimedVideoProcessor (log) + : VideoProcessor (log) { } diff --git a/src/lib/combiner.h b/src/lib/combiner.h index 7ed316e26..062297f0d 100644 --- a/src/lib/combiner.h +++ b/src/lib/combiner.h @@ -28,13 +28,13 @@ * 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 */ diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index f91a2c4e2..6cb384e20 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -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); } diff --git a/src/lib/encoder.h b/src/lib/encoder.h index cce26efc8..b6d3663fd 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -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 (); diff --git a/src/lib/player.h b/src/lib/player.h index b6fb41f6e..b1be2f456 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -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>); diff --git a/src/lib/processor.h b/src/lib/processor.h index 7b7735faa..5dbafab7f 100644 --- a/src/lib/processor.h +++ b/src/lib/processor.h @@ -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 diff --git a/src/lib/video_decoder.h b/src/lib/video_decoder.h index 0b05b2f71..88730f518 100644 --- a/src/lib/video_decoder.h +++ b/src/lib/video_decoder.h @@ -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>); diff --git a/src/lib/video_sink.h b/src/lib/video_sink.h index 6239bc557..2da42528c 100644 --- a/src/lib/video_sink.h +++ b/src/lib/video_sink.h @@ -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 diff --git a/src/lib/video_source.cc b/src/lib/video_source.cc index 4d505f9fe..39043c860 100644 --- a/src/lib/video_source.cc +++ b/src/lib/video_source.cc @@ -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)); -} diff --git a/src/lib/video_source.h b/src/lib/video_source.h index 9b4c9b4a2..7ad554480 100644 --- a/src/lib/video_source.h +++ b/src/lib/video_source.h @@ -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 |
