/** @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>);
{
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
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));
-}
#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
using boost::shared_ptr;
Combiner::Combiner (shared_ptr<Log> log)
- : TimedVideoProcessor (log)
+ : VideoProcessor (log)
{
}
* 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 */
}
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());
}
void
-Encoder::process_audio (shared_ptr<const AudioBuffers> data)
+Encoder::process_audio (shared_ptr<const AudioBuffers> data, Time)
{
_writer->write (data);
}
* @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 ();
* @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>);
{}
};
-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.
*/
{}
};
-class TimedVideoProcessor : public Processor, public TimedVideoSource, public TimedVideoSink
-{
-public:
- TimedVideoProcessor (boost::shared_ptr<Log> log)
- : Processor (log)
- {}
-};
-
#endif
class VideoContent;
-class VideoDecoder : public TimedVideoSource, public virtual Decoder
+class VideoDecoder : public VideoSource, public virtual Decoder
{
public:
VideoDecoder (boost::shared_ptr<const Film>);
* @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
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);
}
}
/* 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));
-}
#include "util.h"
class VideoSink;
-class TimedVideoSink;
class Subtitle;
class 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.
*/
- 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