diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-10 21:28:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-10 21:28:26 +0100 |
| commit | 540aac0bc5ca6cbf393c650e97236a9677124a30 (patch) | |
| tree | c926d65d63a48f0096e84d333cd15f7f8212dddc /src | |
| parent | f6c5598ba6b18d5be753139ea5a8f30781468afc (diff) | |
Remove gain/delay_line/matcher/trimmer.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/ab_transcoder.cc | 35 | ||||
| -rw-r--r-- | src/lib/ab_transcoder.h | 8 | ||||
| -rw-r--r-- | src/lib/delay_line.cc | 57 | ||||
| -rw-r--r-- | src/lib/delay_line.h | 34 | ||||
| -rw-r--r-- | src/lib/gain.cc | 45 | ||||
| -rw-r--r-- | src/lib/gain.h | 31 | ||||
| -rw-r--r-- | src/lib/matcher.cc | 213 | ||||
| -rw-r--r-- | src/lib/matcher.h | 63 | ||||
| -rw-r--r-- | src/lib/transcoder.cc | 34 | ||||
| -rw-r--r-- | src/lib/transcoder.h | 8 | ||||
| -rw-r--r-- | src/lib/trimmer.cc | 115 | ||||
| -rw-r--r-- | src/lib/trimmer.h | 40 | ||||
| -rw-r--r-- | src/lib/wscript | 4 |
13 files changed, 4 insertions, 683 deletions
diff --git a/src/lib/ab_transcoder.cc b/src/lib/ab_transcoder.cc index f75491dce..91c4665a7 100644 --- a/src/lib/ab_transcoder.cc +++ b/src/lib/ab_transcoder.cc @@ -25,11 +25,7 @@ #include "job.h" #include "image.h" #include "player.h" -#include "matcher.h" -#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 @@ -54,44 +50,17 @@ ABTranscoder::ABTranscoder (shared_ptr<Film> film_a, shared_ptr<Film> film_b, sh , _encoder (new Encoder (film_a, j)) , _combiner (new Combiner (film_a->log())) { - _matcher.reset (new Matcher (film_a->log(), film_a->audio_frame_rate(), film_a->video_frame_rate())); - _delay_line.reset (new DelayLine (film_a->log(), film_a->audio_delay() * film_a->audio_frame_rate() / 1000)); - _gain.reset (new Gain (film_a->log(), film_a->audio_gain())); - _player_a->Video.connect (bind (&Combiner::process_video, _combiner, _1, _2, _3, _4)); _player_b->Video.connect (bind (&Combiner::process_video_b, _combiner, _1, _2, _3, _4)); - 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->content_length(), - film_a->audio_frame_rate(), film_a->video_frame_rate(), film_a->dcp_frame_rate() - )); - - - _combiner->connect_video (_delay_line); - _delay_line->connect_video (_matcher); - _matcher->connect_video (_trimmer); - _trimmer->connect_video (_encoder); - - _player_a->connect_audio (_delay_line); - _delay_line->connect_audio (_matcher); - _matcher->connect_audio (_gain); - _gain->connect_audio (_trimmer); - _trimmer->connect_audio (_encoder); + _combiner->connect_video (_encoder); + _player_a->connect_audio (_encoder); } void ABTranscoder::go () { _encoder->process_begin (); - while (!_player_a->pass () || !_player_b->pass ()) {} - - _delay_line->process_end (); - _matcher->process_end (); - _gain->process_end (); - _trimmer->process_end (); _encoder->process_end (); } - diff --git a/src/lib/ab_transcoder.h b/src/lib/ab_transcoder.h index 134bce3e4..54d7ed0be 100644 --- a/src/lib/ab_transcoder.h +++ b/src/lib/ab_transcoder.h @@ -31,12 +31,8 @@ class Encoder; class Image; class Log; class Film; -class Matcher; -class DelayLine; -class Gain; class Combiner; class Player; -class Trimmer; /** @class ABTranscoder * @brief A transcoder which uses one Film for the left half of the screen, and a different one @@ -59,9 +55,5 @@ private: boost::shared_ptr<Job> _job; boost::shared_ptr<Encoder> _encoder; boost::shared_ptr<Combiner> _combiner; - boost::shared_ptr<Matcher> _matcher; - boost::shared_ptr<DelayLine> _delay_line; - boost::shared_ptr<Gain> _gain; - boost::shared_ptr<Trimmer> _trimmer; boost::shared_ptr<Image> _image; }; diff --git a/src/lib/delay_line.cc b/src/lib/delay_line.cc deleted file mode 100644 index b0180800a..000000000 --- a/src/lib/delay_line.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <stdint.h> -#include <cstring> -#include <algorithm> -#include <iostream> -#include "delay_line.h" -#include "util.h" - -using std::min; -using boost::shared_ptr; - -/* @param seconds Delay in seconds, +ve to move audio later. - */ -DelayLine::DelayLine (shared_ptr<Log> log, double seconds) - : TimedAudioVideoProcessor (log) - , _seconds (seconds) -{ - -} - -void -DelayLine::process_audio (shared_ptr<const AudioBuffers> data, double t) -{ - if (_seconds > 0) { - t += _seconds; - } - - Audio (data, t); -} - -void -DelayLine::process_video (shared_ptr<const Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t) -{ - if (_seconds < 0) { - t += _seconds; - } - - Video (image, same, sub, t); -} diff --git a/src/lib/delay_line.h b/src/lib/delay_line.h deleted file mode 100644 index 781dce88a..000000000 --- a/src/lib/delay_line.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <boost/shared_ptr.hpp> -#include "processor.h" - -/** A delay line */ -class DelayLine : public TimedAudioVideoProcessor -{ -public: - DelayLine (boost::shared_ptr<Log> log, double); - - void process_video (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, double); - void process_audio (boost::shared_ptr<const AudioBuffers>, double); - -private: - double _seconds; -}; diff --git a/src/lib/gain.cc b/src/lib/gain.cc deleted file mode 100644 index ccd779d71..000000000 --- a/src/lib/gain.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "gain.h" - -using boost::shared_ptr; - -/** @param gain gain in dB */ -Gain::Gain (shared_ptr<Log> log, float gain) - : AudioProcessor (log) - , _gain (gain) -{ - -} - -void -Gain::process_audio (shared_ptr<const AudioBuffers> b) -{ - if (_gain != 0) { - float const linear_gain = pow (10, _gain / 20); - for (int i = 0; i < b->channels(); ++i) { - for (int j = 0; j < b->frames(); ++j) { - b->data(i)[j] *= linear_gain; - } - } - } - - Audio (b); -} diff --git a/src/lib/gain.h b/src/lib/gain.h deleted file mode 100644 index 61fef5e85..000000000 --- a/src/lib/gain.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "processor.h" - -class Gain : public AudioProcessor -{ -public: - Gain (boost::shared_ptr<Log> log, float gain); - - void process_audio (boost::shared_ptr<const AudioBuffers>); - -private: - float _gain; -}; diff --git a/src/lib/matcher.cc b/src/lib/matcher.cc deleted file mode 100644 index c56a56301..000000000 --- a/src/lib/matcher.cc +++ /dev/null @@ -1,213 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "matcher.h" -#include "image.h" -#include "log.h" - -#include "i18n.h" - -using std::min; -using std::cout; -using std::list; -using boost::shared_ptr; - -Matcher::Matcher (shared_ptr<Log> log, int sample_rate, float frames_per_second) - : Processor (log) - , _sample_rate (sample_rate) - , _frames_per_second (frames_per_second) - , _video_frames (0) - , _audio_frames (0) - , _had_first_video (false) - , _had_first_audio (false) -{ - -} - -void -Matcher::process_video (shared_ptr<const Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t) -{ - _pixel_format = image->pixel_format (); - _size = image->size (); - - _log->log(String::compose("Matcher video @ %1 [audio=%2, video=%3, pending_audio=%4]", t, _audio_frames, _video_frames, _pending_audio.size())); - - if (!_first_input) { - _first_input = t; - } - - bool const this_is_first_video = !_had_first_video; - _had_first_video = true; - - if (this_is_first_video && _had_first_audio) { - /* First video since we got audio */ - fix_start (t); - } - - /* Video before audio is fine, since we can make up an arbitrary difference - with audio samples (contrasting with video which is quantised to frames) - */ - - /* Difference between where this video is and where it should be */ - double const delta = t - _first_input.get() - _video_frames / _frames_per_second; - double const one_frame = 1 / _frames_per_second; - - if (delta > one_frame) { - /* Insert frames to make up the difference */ - int const extra = rint (delta / one_frame); - for (int i = 0; i < extra; ++i) { - repeat_last_video (); - _log->log (String::compose ("Extra video frame inserted at %1s", _video_frames / _frames_per_second)); - } - } - - if (delta > -one_frame) { - Video (image, same, sub); - ++_video_frames; - } else { - /* We are omitting a frame to keep things right */ - _log->log (String::compose ("Frame removed at %1s", t)); - } - - _last_image = image; - _last_subtitle = sub; -} - -void -Matcher::process_audio (shared_ptr<const AudioBuffers> b, double t) -{ - _channels = b->channels (); - - _log->log (String::compose ( - "Matcher audio (%1 frames) @ %2 [video=%3, audio=%4, pending_audio=%5]", - b->frames(), t, _video_frames, _audio_frames, _pending_audio.size() - ) - ); - - if (!_first_input) { - _first_input = t; - } - - bool const this_is_first_audio = _had_first_audio; - _had_first_audio = true; - - if (!_had_first_video) { - /* No video yet; we must postpone these data until we have some */ - _pending_audio.push_back (AudioRecord (b, t)); - } else if (this_is_first_audio && !_had_first_video) { - /* First audio since we got video */ - _pending_audio.push_back (AudioRecord (b, t)); - fix_start (_first_input.get ()); - } else { - /* Normal running. We assume audio time stamps are consecutive */ - Audio (b); - _audio_frames += b->frames (); - } -} - -void -Matcher::process_end () -{ - if (_audio_frames == 0 || !_pixel_format || !_size || !_channels) { - /* We won't do anything */ - return; - } - - _log->log (String::compose ("Matcher has seen %1 video frames (which equals %2 audio frames) and %3 audio frames", - _video_frames, video_frames_to_audio_frames (_video_frames, _sample_rate, _frames_per_second), _audio_frames)); - - match ((double (_audio_frames) / _sample_rate) - (double (_video_frames) / _frames_per_second)); -} - -void -Matcher::fix_start (double first_video) -{ - assert (!_pending_audio.empty ()); - - _log->log (String::compose ("Fixing start; video at %1, audio at %2", first_video, _pending_audio.front().time)); - - match (first_video - _pending_audio.front().time); - - for (list<AudioRecord>::iterator i = _pending_audio.begin(); i != _pending_audio.end(); ++i) { - process_audio (i->audio, i->time); - } - - _pending_audio.clear (); -} - -void -Matcher::match (double extra_video_needed) -{ - _log->log (String::compose ("Match %1", extra_video_needed)); - - if (extra_video_needed > 0) { - - /* Emit black video frames */ - - int const black_video_frames = ceil (extra_video_needed * _frames_per_second); - - _log->log (String::compose (N_("Emitting %1 frames of black video"), black_video_frames)); - - shared_ptr<Image> black (new SimpleImage (_pixel_format.get(), _size.get(), true)); - black->make_black (); - for (int i = 0; i < black_video_frames; ++i) { - Video (black, i != 0, shared_ptr<Subtitle>()); - ++_video_frames; - } - - extra_video_needed -= black_video_frames / _frames_per_second; - } - - if (extra_video_needed < 0) { - - /* Emit silence */ - - int64_t to_do = -extra_video_needed * _sample_rate; - _log->log (String::compose (N_("Emitting %1 frames of silence"), to_do)); - - /* Do things in half second blocks as I think there may be limits - to what FFmpeg (and in particular the resampler) can cope with. - */ - int64_t const block = _sample_rate / 2; - shared_ptr<AudioBuffers> b (new AudioBuffers (_channels.get(), block)); - b->make_silent (); - - while (to_do > 0) { - int64_t const this_time = min (to_do, block); - b->set_frames (this_time); - Audio (b); - _audio_frames += b->frames (); - to_do -= this_time; - } - } -} - -void -Matcher::repeat_last_video () -{ - if (!_last_image) { - shared_ptr<Image> im (new SimpleImage (_pixel_format.get(), _size.get(), true)); - im->make_black (); - _last_image = im; - } - - Video (_last_image, true, _last_subtitle); - ++_video_frames; -} - diff --git a/src/lib/matcher.h b/src/lib/matcher.h deleted file mode 100644 index 41aa373a4..000000000 --- a/src/lib/matcher.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <boost/optional.hpp> -#include "processor.h" -#include "ffmpeg_compatibility.h" - -class Matcher : public Processor, public TimedAudioSink, public TimedVideoSink, public AudioSource, public VideoSource -{ -public: - Matcher (boost::shared_ptr<Log> log, int sample_rate, float frames_per_second); - void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double); - void process_audio (boost::shared_ptr<const AudioBuffers>, double); - void process_end (); - -private: - void fix_start (double); - void match (double); - void repeat_last_video (); - - int _sample_rate; - float _frames_per_second; - int _video_frames; - int64_t _audio_frames; - boost::optional<AVPixelFormat> _pixel_format; - boost::optional<libdcp::Size> _size; - boost::optional<int> _channels; - - struct AudioRecord { - AudioRecord (boost::shared_ptr<const AudioBuffers> a, double t) - : audio (a) - , time (t) - {} - - boost::shared_ptr<const AudioBuffers> audio; - double time; - }; - - std::list<AudioRecord> _pending_audio; - - boost::optional<double> _first_input; - boost::shared_ptr<const Image> _last_image; - boost::shared_ptr<Subtitle> _last_subtitle; - - bool _had_first_video; - bool _had_first_audio; -}; diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index f8fe0c8d5..d4c5210dc 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -29,13 +29,9 @@ #include "transcoder.h" #include "encoder.h" #include "film.h" -#include "matcher.h" -#include "delay_line.h" -#include "gain.h" #include "video_decoder.h" #include "audio_decoder.h" #include "player.h" -#include "trimmer.h" #include "job.h" using std::string; @@ -52,45 +48,19 @@ Transcoder::Transcoder (shared_ptr<Film> f, shared_ptr<Job> j) , _player (f->player ()) , _encoder (new Encoder (f, j)) { - _matcher.reset (new Matcher (f->log(), f->audio_frame_rate(), f->video_frame_rate())); - _delay_line.reset (new DelayLine (f->log(), f->audio_delay() * f->audio_frame_rate() / 1000)); - _gain.reset (new Gain (f->log(), f->audio_gain())); - - int const trim_start = f->trim_type() == Film::ENCODE ? f->trim_start() : 0; - int const trim_end = f->trim_type() == Film::ENCODE ? f->trim_end() : 0; - _trimmer.reset (new Trimmer ( - f->log(), trim_start, trim_end, f->content_length(), - f->audio_frame_rate(), f->video_frame_rate(), f->dcp_frame_rate() - )); - if (!f->with_subtitles ()) { _player->disable_subtitles (); } - _player->connect_video (_delay_line); - _delay_line->connect_video (_matcher); - _matcher->connect_video (_trimmer); - _trimmer->connect_video (_encoder); - - _player->connect_audio (_delay_line); - _delay_line->connect_audio (_matcher); - _matcher->connect_audio (_gain); - _gain->connect_audio (_trimmer); - _trimmer->connect_audio (_encoder); + _player->connect_video (_encoder); + _player->connect_audio (_encoder); } void Transcoder::go () { _encoder->process_begin (); - while (!_player->pass ()) {} - - _delay_line->process_end (); - if (_matcher) { - _matcher->process_end (); - } - _gain->process_end (); _encoder->process_end (); } diff --git a/src/lib/transcoder.h b/src/lib/transcoder.h index 48b453fe4..f7da3bd01 100644 --- a/src/lib/transcoder.h +++ b/src/lib/transcoder.h @@ -28,12 +28,8 @@ class Film; class Job; class Encoder; -class Matcher; class VideoFilter; -class Gain; -class DelayLine; class Player; -class Trimmer; /** @class Transcoder * @@ -58,8 +54,4 @@ private: boost::shared_ptr<Job> _job; boost::shared_ptr<Player> _player; boost::shared_ptr<Encoder> _encoder; - boost::shared_ptr<Matcher> _matcher; - boost::shared_ptr<DelayLine> _delay_line; - boost::shared_ptr<Gain> _gain; - boost::shared_ptr<Trimmer> _trimmer; }; diff --git a/src/lib/trimmer.cc b/src/lib/trimmer.cc deleted file mode 100644 index b7afc9299..000000000 --- a/src/lib/trimmer.cc +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2013 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <boost/shared_ptr.hpp> -#include "trimmer.h" - -using std::cout; -using std::max; -using boost::shared_ptr; - -/** @param audio_sample_rate Audio sampling rate, or 0 if there is no audio */ -Trimmer::Trimmer ( - shared_ptr<Log> log, - int video_trim_start, - int video_trim_end, - int video_length, - int audio_sample_rate, - float frames_per_second, - int dcp_frames_per_second - ) - : AudioVideoProcessor (log) - , _video_start (video_trim_start) - , _video_end (video_length - video_trim_end) - , _video_in (0) - , _audio_in (0) -{ - FrameRateConversion frc (frames_per_second, dcp_frames_per_second); - - if (frc.skip) { - _video_start /= 2; - _video_end /= 2; - } else if (frc.repeat) { - _video_start *= 2; - _video_end *= 2; - } - - if (audio_sample_rate) { - _audio_start = video_frames_to_audio_frames (_video_start, audio_sample_rate, frames_per_second); - _audio_end = video_frames_to_audio_frames (_video_end, audio_sample_rate, frames_per_second); - } - - /* XXX: this is a hack; this flag means that no trim is happening at the end of the film, and I'm - using that to prevent audio trim being rounded to video trim, which breaks the current set - of regression tests. This could be removed if a) the regression tests are regenerated and b) - I can work out what DCP length should be. - */ - _no_trim = (_video_start == 0) && (_video_end == (video_length - video_trim_end)); -} - -void -Trimmer::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub) -{ - if (_no_trim || (_video_in >= _video_start && _video_in <= _video_end)) { - Video (image, same, sub); - } - - ++_video_in; -} - -void -Trimmer::process_audio (shared_ptr<const AudioBuffers> audio) -{ - if (_no_trim) { - Audio (audio); - return; - } - - int64_t offset = _audio_start - _audio_in; - if (offset > audio->frames()) { - _audio_in += audio->frames (); - return; - } - - if (offset < 0) { - offset = 0; - } - - int64_t length = _audio_end - max (_audio_in, _audio_start); - if (length < 0) { - _audio_in += audio->frames (); - return; - } - - if (length > (audio->frames() - offset)) { - length = audio->frames () - offset; - } - - _audio_in += audio->frames (); - - if (offset != 0 || length != audio->frames ()) { - shared_ptr<AudioBuffers> copy (new AudioBuffers (audio)); - copy->move (offset, 0, length); - copy->set_frames (length); - audio = copy; - } - - Audio (audio); -} - diff --git a/src/lib/trimmer.h b/src/lib/trimmer.h deleted file mode 100644 index 98a118fb2..000000000 --- a/src/lib/trimmer.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2013 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "processor.h" - -class Trimmer : public AudioVideoProcessor -{ -public: - Trimmer (boost::shared_ptr<Log>, int, int, int, int, float, int); - - void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s); - void process_audio (boost::shared_ptr<const AudioBuffers>); - -private: - friend class trimmer_test; - - int _video_start; - int _video_end; - int _video_in; - int64_t _audio_start; - int64_t _audio_end; - int64_t _audio_in; - bool _no_trim; -}; diff --git a/src/lib/wscript b/src/lib/wscript index e53ac5a84..bce6c644c 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -18,7 +18,6 @@ sources = """ dcp_content_type.cc dcp_video_frame.cc decoder.cc - delay_line.cc dolby_cp750.cc encoder.cc examine_content_job.cc @@ -30,7 +29,6 @@ sources = """ film.cc filter.cc format.cc - gain.cc image.cc imagemagick_content.cc imagemagick_decoder.cc @@ -38,7 +36,6 @@ sources = """ job_manager.cc log.cc lut.cc - matcher.cc player.cc playlist.cc scp_dcp_job.cc @@ -52,7 +49,6 @@ sources = """ transcode_job.cc transcoder.cc types.cc - trimmer.cc ui_signaller.cc util.cc video_content.cc |
