summaryrefslogtreecommitdiff
path: root/src/lib/ab_transcoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-23 16:17:20 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-23 16:17:20 +0100
commit425ef773dbf91d2fecd8e2fbdc20becbfbda46f8 (patch)
treef9047287c2e950f8cbfdcfbce9e60bdca87d1faf /src/lib/ab_transcoder.cc
parent8805ae23ce2c3a19fc6a1fd341cff899bfb61128 (diff)
Connect Trimmer clsas.
Diffstat (limited to 'src/lib/ab_transcoder.cc')
-rw-r--r--src/lib/ab_transcoder.cc37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/lib/ab_transcoder.cc b/src/lib/ab_transcoder.cc
index 6eef397c2..26643b50e 100644
--- a/src/lib/ab_transcoder.cc
+++ b/src/lib/ab_transcoder.cc
@@ -32,6 +32,7 @@
#include "delay_line.h"
#include "gain.h"
#include "combiner.h"
+#include "trimmer.h"
/** @file src/ab_transcoder.cc
* @brief A transcoder which uses one Film for the left half of the screen, and a different one
@@ -61,26 +62,48 @@ ABTranscoder::ABTranscoder (
_db = decoder_factory (_film_b, o);
shared_ptr<AudioStream> st = _film_a->audio_stream();
- _matcher.reset (new Matcher (_film_a->log(), st->sample_rate(), _film_a->source_frame_rate()));
+ if (st) {
+ _matcher.reset (new Matcher (_film_a->log(), st->sample_rate(), _film_a->source_frame_rate()));
+ }
_delay_line.reset (new DelayLine (_film_a->log(), _film_a->audio_delay() / 1000.0f));
_gain.reset (new Gain (_film_a->log(), _film_a->audio_gain()));
+ int const sr = st ? st->sample_rate() : 0;
+ int const trim_start = _film_a->trim_type() == Film::ENCODE ? _film_a->trim_start() : 0;
+ int const trim_end = _film_a->trim_type() == Film::ENCODE ? _film_a->trim_end() : 0;
+ _trimmer.reset (new Trimmer (
+ _film_a->log(), trim_start, trim_end, _film_a->length().get(),
+ sr, _film_a->source_frame_rate(), _film_a->dcp_frame_rate()
+ ));
+
/* Set up the decoder to use the film's set streams */
_da.video->set_subtitle_stream (_film_a->subtitle_stream ());
_db.video->set_subtitle_stream (_film_a->subtitle_stream ());
- _da.audio->set_audio_stream (_film_a->audio_stream ());
+ if (_film_a->audio_stream ()) {
+ _da.audio->set_audio_stream (_film_a->audio_stream ());
+ }
_da.video->Video.connect (bind (&Combiner::process_video, _combiner, _1, _2, _3, _4));
_db.video->Video.connect (bind (&Combiner::process_video_b, _combiner, _1, _2, _3, _4));
_combiner->connect_video (_delay_line);
- _delay_line->connect_video (_matcher);
- _matcher->connect_video (_encoder);
+ if (_matcher) {
+ _delay_line->connect_video (_matcher);
+ _matcher->connect_video (_trimmer);
+ } else {
+ _delay_line->connect_video (_trimmer);
+ }
+ _trimmer->connect_video (_encoder);
_da.audio->connect_audio (_delay_line);
- _delay_line->connect_audio (_matcher);
- _matcher->connect_audio (_gain);
- _gain->connect_audio (_encoder);
+ if (_matcher) {
+ _delay_line->connect_audio (_matcher);
+ _matcher->connect_audio (_gain);
+ } else {
+ _delay_line->connect_audio (_gain);
+ }
+ _gain->connect_audio (_trimmer);
+ _trimmer->connect_audio (_encoder);
}
void