From 09a9ac376db005a40a351736bcff4077f098825d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 26 Jun 2013 01:21:21 +0100 Subject: Another try at sorting out the thorny question of timing. --- src/lib/transcoder.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/lib/transcoder.cc') diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index f4637a05c..f4a52639a 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -36,8 +36,27 @@ using std::string; using boost::shared_ptr; +using boost::weak_ptr; using boost::dynamic_pointer_cast; +static void +video_proxy (weak_ptr encoder, shared_ptr image, bool same) +{ + shared_ptr e = encoder.lock (); + if (e) { + e->process_video (image, same); + } +} + +static void +audio_proxy (weak_ptr encoder, shared_ptr audio) +{ + shared_ptr e = encoder.lock (); + if (e) { + e->process_audio (audio); + } +} + /** Construct a transcoder using a Decoder that we create and a supplied Encoder. * @param f Film that we are transcoding. * @param j Job that we are running under, or 0. @@ -48,8 +67,8 @@ Transcoder::Transcoder (shared_ptr f, shared_ptr j) , _player (f->player ()) , _encoder (new Encoder (f, j)) { - _player->connect_video (_encoder); - _player->connect_audio (_encoder); + _player->Video.connect (bind (video_proxy, _encoder, _1, _2)); + _player->Audio.connect (bind (audio_proxy, _encoder, _1)); } void -- cgit v1.2.3