X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Ftranscoder.cc;h=3002ef61c9c0f776d3b714bf326cb14ff7073d97;hb=2ee5d40d5ce7406ce4f1975c4fbf88f70dbe2106;hp=d4c5210dc5dfab2b48af067ebabbb8a959eeabbe;hpb=540aac0bc5ca6cbf393c650e97236a9677124a30;p=dcpomatic.git diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index d4c5210dc..3002ef61c 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -36,24 +36,39 @@ 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, Eyes eyes, bool same) +{ + shared_ptr e = encoder.lock (); + if (e) { + e->process_video (image, eyes, 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. * @param e Encoder to use. */ -Transcoder::Transcoder (shared_ptr f, shared_ptr j) +Transcoder::Transcoder (shared_ptr f, shared_ptr j) : _job (j) - , _player (f->player ()) + , _player (f->make_player ()) , _encoder (new Encoder (f, j)) { - if (!f->with_subtitles ()) { - _player->disable_subtitles (); - } - - _player->connect_video (_encoder); - _player->connect_audio (_encoder); + _player->Video.connect (bind (video_proxy, _encoder, _1, _2, _3)); + _player->Audio.connect (bind (audio_proxy, _encoder, _1)); } void