Merge master.
authorCarl Hetherington <cth@carlh.net>
Mon, 15 Apr 2013 14:00:35 +0000 (15:00 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Apr 2013 14:00:35 +0000 (15:00 +0100)
1  2 
src/lib/ab_transcoder.cc
src/lib/delay_line.cc
src/lib/delay_line.h
src/lib/imagemagick_decoder.h
src/lib/job.cc
src/lib/matcher.cc
src/lib/matcher.h
src/lib/transcoder.cc
src/lib/video_decoder.h
test/test.cc

index 3af32f988f3b8e263549b6d372b215ae556b393d,3a1cd83d77473ccfed80da473c39244e50ff80c6..7db13afcc0c0ae491b5abf54b91890140d2f587b
@@@ -68,17 -72,22 +70,17 @@@ ABTranscoder::ABTranscoder 
        _db.video->set_subtitle_stream (_film_a->subtitle_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));
+       _da.video->Video.connect (bind (&Combiner::process_video, _combiner, _1, _2, _3));
+       _db.video->Video.connect (bind (&Combiner::process_video_b, _combiner, _1, _2, _3));
  
 -      if (_matcher) {
 -              _combiner->connect_video (_matcher);
 -              _matcher->connect_video (_encoder);
 -      } else {
 -              _combiner->connect_video (_encoder);
 -      }
 +      _combiner->connect_video (_delay_line);
 +      _delay_line->connect_video (_matcher);
 +      _matcher->connect_video (_encoder);
        
 -      if (_matcher && _delay_line) {
 -              _da.audio->connect_audio (_delay_line);
 -              _delay_line->connect_audio (_matcher);
 -              _matcher->connect_audio (_gain);
 -              _gain->connect_audio (_encoder);
 -      }
 +      _da.audio->connect_audio (_delay_line);
 +      _delay_line->connect_audio (_matcher);
 +      _matcher->connect_audio (_gain);
 +      _gain->connect_audio (_encoder);
  }
  
  void
index 924a1f082a7ccf2840a6163f693937307fbc26e6,53da9a41283a25c5dc9d6ebfa9a5b4a1d51cc4e4..c8e593a185c905bce974a9196b581beb0c5d6ea2
  using std::min;
  using boost::shared_ptr;
  
 -/** @param channels Number of channels of audio.
 - *  @param frames Delay in frames, +ve to move audio later.
 +/*  @param seconds Delay in seconds, +ve to move audio later.
   */
- DelayLine::DelayLine (Log* log, double seconds)
 -DelayLine::DelayLine (shared_ptr<Log> log, int channels, int frames)
 -      : AudioProcessor (log)
 -      , _negative_delay_remaining (0)
 -      , _frames (frames)
++DelayLine::DelayLine (shared_ptr<Log> log, double seconds)
 +      : Processor (log)
 +      , _seconds (seconds)
  {
 -      if (_frames > 0) {
 -              /* We need a buffer to keep some data in */
 -              _buffers.reset (new AudioBuffers (channels, _frames));
 -              _buffers->make_silent ();
 -      } else if (_frames < 0) {
 -              /* We can do -ve delays just by chopping off
 -                 the start, so no buffer needed.
 -              */
 -              _negative_delay_remaining = -_frames;
 -      }
 +      
  }
  
  void
- DelayLine::process_audio (shared_ptr<AudioBuffers> data, double t)
+ DelayLine::process_audio (shared_ptr<AudioBuffers> data)
  {
 -      if (_buffers) {
 -              /* We have some buffers, so we are moving the audio later */
 -
 -              /* Copy the input data */
 -              AudioBuffers input (*data.get ());
 -
 -              int to_do = data->frames ();
 -
 -              /* Write some of our buffer to the output */
 -              int const from_buffer = min (to_do, _buffers->frames());
 -              data->copy_from (_buffers.get(), from_buffer, 0, 0);
 -              to_do -= from_buffer;
 -
 -              /* Write some of the input to the output */
 -              int const from_input = to_do;
 -              data->copy_from (&input, from_input, 0, from_buffer);
 -
 -              int const left_in_buffer = _buffers->frames() - from_buffer;
 -
 -              /* Shuffle our buffer down */
 -              _buffers->move (from_buffer, 0, left_in_buffer);
 -
 -              /* Copy remaining input data to our buffer */
 -              _buffers->copy_from (&input, input.frames() - from_input, from_input, left_in_buffer);
 -
 -      } else {
 +      if (_seconds > 0) {
 +              t += _seconds;
 +      }
  
 -              /* Chop the initial data off until _negative_delay_remaining
 -                 is zero, then just pass data.
 -              */
 +      Audio (data, t);
 +}
  
 -              int const to_do = min (data->frames(), _negative_delay_remaining);
 -              if (to_do) {
 -                      data->move (to_do, 0, data->frames() - to_do);
 -                      data->set_frames (data->frames() - to_do);
 -                      _negative_delay_remaining -= to_do;
 -              }
 +void
 +DelayLine::process_video (boost::shared_ptr<Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t)
 +{
 +      if (_seconds < 0) {
 +              t += _seconds;
        }
  
 -      Audio (data);
 +      Video (image, same, sub, t);
  }
index a52fb981c7c251cf31363a35b5a3caaa00b3e42c,c51784f353ab7edbbdcd373f6bcb42da5957bf8c..7a8b11c690bf92cabf0d046594066dc0d809cfe1
  #include <boost/shared_ptr.hpp>
  #include "processor.h"
  
 -class AudioBuffers;
 -
  /** A delay line for audio */
 -class DelayLine : public AudioProcessor
 +class DelayLine : public Processor, public TimedAudioSink, public TimedAudioSource, public TimedVideoSink, public TimedVideoSource
  {
  public:
-       DelayLine (Log* log, double);
 -      DelayLine (boost::shared_ptr<Log> log, int channels, int frames);
++      DelayLine (boost::shared_ptr<Log> log, double);
        
 -      void process_audio (boost::shared_ptr<AudioBuffers>);
 +      void process_video (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>, double);
 +      void process_audio (boost::shared_ptr<AudioBuffers>, double);
  
  private:
 -      boost::shared_ptr<AudioBuffers> _buffers;
 -      int _negative_delay_remaining; ///< number of frames of negative delay that remain to emit
 -      int _frames;
 +      double _seconds;
  };
Simple merge
diff --cc src/lib/job.cc
Simple merge
index a74eeabbb7e1af142399eb275d36225c4eb22125,48f6ed9126dd980c13b79b6665a3a82ad203bf9b..69d12e2c4ebebf7d0c2d27b767e199bb8c615f5e
  #include "i18n.h"
  
  using std::min;
 +using std::cout;
 +using std::list;
  using boost::shared_ptr;
  
- Matcher::Matcher (Log* log, int sample_rate, float frames_per_second)
-       : Processor (log)
+ Matcher::Matcher (shared_ptr<Log> log, int sample_rate, float frames_per_second)
+       : AudioVideoProcessor (log)
        , _sample_rate (sample_rate)
        , _frames_per_second (frames_per_second)
        , _video_frames (0)
Simple merge
index 8e5e15e7f0a770c46376d96565ab6f333667c2a5,e0f3a03a2319c02de63918a6201647c48fe478cc..8046080dee7b984fb9b135e348f3d73478bea363
@@@ -62,16 -63,23 +61,25 @@@ Transcoder::Transcoder (shared_ptr<Film
  
        /* Set up the decoder to use the film's set streams */
        _decoders.video->set_subtitle_stream (f->subtitle_stream ());
 -      if (_decoders.audio) {
 -              _decoders.audio->set_audio_stream (f->audio_stream ());
 -      }
 +      _decoders.audio->set_audio_stream (f->audio_stream ());
  
++<<<<<<< HEAD
 +      _decoders.video->connect_video (_delay_line);
 +      _delay_line->connect_video (_matcher);
 +      _matcher->connect_video (_encoder);
++=======
+       if (_matcher) {
+               _decoders.video->connect_video (_matcher);
+               _matcher->connect_video (_encoder);
+       } else {
+               _decoders.video->connect_video (_encoder);
+       }
++>>>>>>> master
        
 -      if (_matcher && _delay_line && _decoders.audio) {
 -              _decoders.audio->connect_audio (_delay_line);
 -              _delay_line->connect_audio (_matcher);
 -              _matcher->connect_audio (_gain);
 -              _gain->connect_audio (_encoder);
 -      }
 +      _decoders.audio->connect_audio (_delay_line);
 +      _delay_line->connect_audio (_matcher);
 +      _matcher->connect_audio (_gain);
 +      _gain->connect_audio (_encoder);
  }
  
  /** Run the decoder, passing its output to the encoder, until the decoder
Simple merge
diff --cc test/test.cc
Simple merge