diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-04-26 23:41:02 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-04-26 23:41:02 +0100 |
| commit | f861018389acd9d277fe34d7621182b9b54f977f (patch) | |
| tree | 499bae7640ce99a13c31ea9c870d426084480aec /src/lib | |
| parent | f09c6b53f155de601900afa90045059b20310c0d (diff) | |
| parent | 86011ad6b4ea0004a51c59b0563cf89c0947546d (diff) | |
Merge master; fix crash on new film.
Diffstat (limited to 'src/lib')
34 files changed, 300 insertions, 179 deletions
diff --git a/src/lib/ab_transcoder.cc b/src/lib/ab_transcoder.cc index c6ccfdc67..2e0d41e7d 100644 --- a/src/lib/ab_transcoder.cc +++ b/src/lib/ab_transcoder.cc @@ -29,6 +29,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 @@ -62,14 +63,24 @@ ABTranscoder::ABTranscoder (shared_ptr<Film> a, shared_ptr<Film> b, shared_ptr<J _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 (_encoder); + _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 (_encoder); + _gain->connect_audio (_trimmer); + _trimmer->connect_audio (_encoder); } void @@ -91,16 +102,11 @@ ABTranscoder::go () break; } } - - if (_delay_line) { - _delay_line->process_end (); - } - if (_matcher) { - _matcher->process_end (); - } - if (_gain) { - _gain->process_end (); - } + + _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 b1b01d724..1fef66b88 100644 --- a/src/lib/ab_transcoder.h +++ b/src/lib/ab_transcoder.h @@ -36,6 +36,7 @@ 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 @@ -63,5 +64,6 @@ private: 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/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 50096d7c1..f3c55b208 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -71,7 +71,7 @@ AnalyseAudioJob::run () } void -AnalyseAudioJob::audio (shared_ptr<AudioBuffers> b) +AnalyseAudioJob::audio (shared_ptr<const AudioBuffers> b) { for (int i = 0; i < b->frames(); ++i) { for (int j = 0; j < b->channels(); ++j) { diff --git a/src/lib/analyse_audio_job.h b/src/lib/analyse_audio_job.h index dc1e073ee..5435e0a7c 100644 --- a/src/lib/analyse_audio_job.h +++ b/src/lib/analyse_audio_job.h @@ -31,7 +31,7 @@ public: void run (); private: - void audio (boost::shared_ptr<AudioBuffers>); + void audio (boost::shared_ptr<const AudioBuffers>); int64_t _done; int64_t _samples_per_point; diff --git a/src/lib/audio_sink.h b/src/lib/audio_sink.h index ba4b772c8..ee39f9ee7 100644 --- a/src/lib/audio_sink.h +++ b/src/lib/audio_sink.h @@ -24,14 +24,14 @@ class AudioSink { public: /** Call with some audio data */ - virtual void process_audio (boost::shared_ptr<AudioBuffers>) = 0; + virtual void process_audio (boost::shared_ptr<const AudioBuffers>) = 0; }; class TimedAudioSink { public: /** Call with some audio data */ - virtual void process_audio (boost::shared_ptr<AudioBuffers>, double t) = 0; + virtual void process_audio (boost::shared_ptr<const AudioBuffers>, double t) = 0; }; #endif diff --git a/src/lib/audio_source.cc b/src/lib/audio_source.cc index 3dd3027ab..32b3deccf 100644 --- a/src/lib/audio_source.cc +++ b/src/lib/audio_source.cc @@ -25,7 +25,7 @@ using boost::weak_ptr; using boost::bind; static void -process_audio_proxy (weak_ptr<AudioSink> sink, shared_ptr<AudioBuffers> audio) +process_audio_proxy (weak_ptr<AudioSink> sink, shared_ptr<const AudioBuffers> audio) { shared_ptr<AudioSink> p = sink.lock (); if (p) { @@ -44,3 +44,9 @@ TimedAudioSource::connect_audio (shared_ptr<TimedAudioSink> s) { Audio.connect (bind (&TimedAudioSink::process_audio, s, _1, _2)); } + +void +TimedAudioSource::connect_audio (shared_ptr<AudioSink> s) +{ + Audio.connect (bind (&AudioSink::process_audio, s, _1)); +} diff --git a/src/lib/audio_source.h b/src/lib/audio_source.h index dd2480716..c7f0a09ed 100644 --- a/src/lib/audio_source.h +++ b/src/lib/audio_source.h @@ -35,7 +35,7 @@ class AudioSource { public: /** Emitted when some audio data is ready */ - boost::signals2::signal<void (boost::shared_ptr<AudioBuffers>)> Audio; + boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>)> Audio; void connect_audio (boost::shared_ptr<AudioSink>); }; @@ -46,8 +46,9 @@ class TimedAudioSource { public: /** Emitted when some audio data is ready */ - boost::signals2::signal<void (boost::shared_ptr<AudioBuffers>, double)> Audio; + boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, double)> Audio; + void connect_audio (boost::shared_ptr<AudioSink>); void connect_audio (boost::shared_ptr<TimedAudioSink>); }; diff --git a/src/lib/combiner.cc b/src/lib/combiner.cc index 0a9eaf6b6..367cefa7f 100644 --- a/src/lib/combiner.cc +++ b/src/lib/combiner.cc @@ -33,9 +33,9 @@ Combiner::Combiner (shared_ptr<Log> log) * @param image Frame image. */ void -Combiner::process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle>, double) +Combiner::process_video (shared_ptr<const Image> image, bool, shared_ptr<Subtitle>, double) { - _image = image; + _image.reset (new SimpleImage (image)); } /** Process video for the right half of the frame. @@ -43,22 +43,21 @@ Combiner::process_video (shared_ptr<Image> image, bool, shared_ptr<Subtitle>, do * @param sub Subtitle (which will be put onto the whole frame) */ void -Combiner::process_video_b (shared_ptr<Image> image, bool, shared_ptr<Subtitle> sub, double t) +Combiner::process_video_b (shared_ptr<const Image> image, bool, shared_ptr<Subtitle> sub, double t) { /* Copy the right half of this image into our _image */ /* XXX: this should probably be in the Image class */ for (int i = 0; i < image->components(); ++i) { int const line_size = image->line_size()[i]; int const half_line_size = line_size / 2; - int const stride = image->stride()[i]; uint8_t* p = _image->data()[i]; uint8_t* q = image->data()[i]; for (int j = 0; j < image->lines (i); ++j) { memcpy (p + half_line_size, q + half_line_size, half_line_size); - p += stride; - q += stride; + p += _image->stride()[i]; + q += image->stride()[i]; } } diff --git a/src/lib/combiner.h b/src/lib/combiner.h index a8f1fa804..7ed316e26 100644 --- a/src/lib/combiner.h +++ b/src/lib/combiner.h @@ -33,8 +33,8 @@ class Combiner : public TimedVideoProcessor public: Combiner (boost::shared_ptr<Log> log); - void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s, double); - void process_video_b (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s, double); + void process_video (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double); + void process_video_b (boost::shared_ptr<const Image> i, bool, boost::shared_ptr<Subtitle> s, double); private: /** The image that we are currently working on */ diff --git a/src/lib/delay_line.cc b/src/lib/delay_line.cc index 9e6baeba8..b0180800a 100644 --- a/src/lib/delay_line.cc +++ b/src/lib/delay_line.cc @@ -37,7 +37,7 @@ DelayLine::DelayLine (shared_ptr<Log> log, double seconds) } void -DelayLine::process_audio (shared_ptr<AudioBuffers> data, double t) +DelayLine::process_audio (shared_ptr<const AudioBuffers> data, double t) { if (_seconds > 0) { t += _seconds; @@ -47,7 +47,7 @@ DelayLine::process_audio (shared_ptr<AudioBuffers> data, double t) } void -DelayLine::process_video (boost::shared_ptr<Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t) +DelayLine::process_video (shared_ptr<const Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t) { if (_seconds < 0) { t += _seconds; diff --git a/src/lib/delay_line.h b/src/lib/delay_line.h index 90f1dcfa7..781dce88a 100644 --- a/src/lib/delay_line.h +++ b/src/lib/delay_line.h @@ -26,8 +26,8 @@ class DelayLine : public TimedAudioVideoProcessor public: DelayLine (boost::shared_ptr<Log> log, double); - void process_video (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>, double); - void process_audio (boost::shared_ptr<AudioBuffers>, 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/encoder.cc b/src/lib/encoder.cc index f56440dd7..c1d1041ae 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -240,7 +240,7 @@ Encoder::frame_done () } void -Encoder::process_video (shared_ptr<Image> image, bool same, shared_ptr<Subtitle> sub) +Encoder::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub) { FrameRateConversion frc (_film->video_frame_rate(), _film->dcp_frame_rate()); @@ -303,7 +303,7 @@ Encoder::process_video (shared_ptr<Image> image, bool same, shared_ptr<Subtitle> } void -Encoder::process_audio (shared_ptr<AudioBuffers> data) +Encoder::process_audio (shared_ptr<const AudioBuffers> data) { #if HAVE_SWRESAMPLE /* Maybe sample-rate convert */ @@ -342,7 +342,9 @@ Encoder::terminate_threads () lock.unlock (); for (list<boost::thread *>::iterator i = _threads.begin(); i != _threads.end(); ++i) { - (*i)->join (); + if ((*i)->joinable ()) { + (*i)->join (); + } delete *i; } } diff --git a/src/lib/encoder.h b/src/lib/encoder.h index 56007fd48..f95d42661 100644 --- a/src/lib/encoder.h +++ b/src/lib/encoder.h @@ -73,10 +73,10 @@ public: * @param same true if i is the same as the last time we were called. * @param s A subtitle that should be on this frame, or 0. */ - void process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s); + void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s); /** Call with some audio data */ - void process_audio (boost::shared_ptr<AudioBuffers>); + void process_audio (boost::shared_ptr<const AudioBuffers>); /** Called when a processing run has finished */ virtual void process_end (); diff --git a/src/lib/gain.cc b/src/lib/gain.cc index df7011d2e..ccd779d71 100644 --- a/src/lib/gain.cc +++ b/src/lib/gain.cc @@ -30,7 +30,7 @@ Gain::Gain (shared_ptr<Log> log, float gain) } void -Gain::process_audio (shared_ptr<AudioBuffers> b) +Gain::process_audio (shared_ptr<const AudioBuffers> b) { if (_gain != 0) { float const linear_gain = pow (10, _gain / 20); diff --git a/src/lib/gain.h b/src/lib/gain.h index d462e5aee..61fef5e85 100644 --- a/src/lib/gain.h +++ b/src/lib/gain.h @@ -24,7 +24,7 @@ class Gain : public AudioProcessor public: Gain (boost::shared_ptr<Log> log, float gain); - void process_audio (boost::shared_ptr<AudioBuffers>); + void process_audio (boost::shared_ptr<const AudioBuffers>); private: float _gain; diff --git a/src/lib/image.cc b/src/lib/image.cc index 2355d22e5..1be41fecf 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -509,7 +509,33 @@ SimpleImage::SimpleImage (SimpleImage const & other) allocate (); for (int i = 0; i < components(); ++i) { - memcpy (_data[i], other._data[i], _line_size[i] * lines(i)); + uint8_t* p = _data[i]; + uint8_t* q = other._data[i]; + for (int j = 0; j < lines(i); ++j) { + memcpy (p, q, _line_size[i]); + p += stride()[i]; + q += other.stride()[i]; + } + } +} + +SimpleImage::SimpleImage (shared_ptr<const Image> other) + : Image (*other.get()) +{ + _size = other->size (); + _aligned = true; + + allocate (); + + for (int i = 0; i < components(); ++i) { + assert(line_size()[i] == other->line_size()[i]); + uint8_t* p = _data[i]; + uint8_t* q = other->data()[i]; + for (int j = 0; j < lines(i); ++j) { + memcpy (p, q, line_size()[i]); + p += stride()[i]; + q += other->stride()[i]; + } } } diff --git a/src/lib/image.h b/src/lib/image.h index 1d7d75dfc..de03d0e3f 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -131,6 +131,7 @@ class SimpleImage : public Image public: SimpleImage (AVPixelFormat, libdcp::Size, bool); SimpleImage (SimpleImage const &); + SimpleImage (boost::shared_ptr<const Image>); SimpleImage& operator= (SimpleImage const &); ~SimpleImage (); diff --git a/src/lib/matcher.cc b/src/lib/matcher.cc index edbb084de..c56a56301 100644 --- a/src/lib/matcher.cc +++ b/src/lib/matcher.cc @@ -41,7 +41,7 @@ Matcher::Matcher (shared_ptr<Log> log, int sample_rate, float frames_per_second) } void -Matcher::process_video (shared_ptr<Image> image, bool same, boost::shared_ptr<Subtitle> sub, double t) +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 (); @@ -90,11 +90,15 @@ Matcher::process_video (shared_ptr<Image> image, bool same, boost::shared_ptr<Su } void -Matcher::process_audio (shared_ptr<AudioBuffers> b, double t) +Matcher::process_audio (shared_ptr<const AudioBuffers> b, double t) { _channels = b->channels (); - _log->log (String::compose ("Matcher audio @ %1 [video=%2, audio=%3, pending_audio=%4]", t, _video_frames, _audio_frames, _pending_audio.size())); + _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; @@ -198,8 +202,9 @@ void Matcher::repeat_last_video () { if (!_last_image) { - _last_image.reset (new SimpleImage (_pixel_format.get(), _size.get(), true)); - _last_image->make_black (); + shared_ptr<Image> im (new SimpleImage (_pixel_format.get(), _size.get(), true)); + im->make_black (); + _last_image = im; } Video (_last_image, true, _last_subtitle); diff --git a/src/lib/matcher.h b/src/lib/matcher.h index f54aa4b6a..41aa373a4 100644 --- a/src/lib/matcher.h +++ b/src/lib/matcher.h @@ -25,8 +25,8 @@ class Matcher : public Processor, public TimedAudioSink, public TimedVideoSink, { public: Matcher (boost::shared_ptr<Log> log, int sample_rate, float frames_per_second); - void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s, double); - void process_audio (boost::shared_ptr<AudioBuffers>, double); + 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: @@ -43,19 +43,19 @@ private: boost::optional<int> _channels; struct AudioRecord { - AudioRecord (boost::shared_ptr<AudioBuffers> a, double t) + AudioRecord (boost::shared_ptr<const AudioBuffers> a, double t) : audio (a) , time (t) {} - boost::shared_ptr<AudioBuffers> audio; + boost::shared_ptr<const AudioBuffers> audio; double time; }; std::list<AudioRecord> _pending_audio; boost::optional<double> _first_input; - boost::shared_ptr<Image> _last_image; + boost::shared_ptr<const Image> _last_image; boost::shared_ptr<Subtitle> _last_subtitle; bool _had_first_video; diff --git a/src/lib/player.cc b/src/lib/player.cc index 7c75597ea..09f1f55a3 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -134,13 +134,13 @@ Player::set_progress (shared_ptr<Job> job) } void -Player::process_video (shared_ptr<Image> i, bool same, shared_ptr<Subtitle> s, double t) +Player::process_video (shared_ptr<const Image> i, bool same, shared_ptr<Subtitle> s, double t) { Video (i, same, s, _video_start[_video_decoder] + t); } void -Player::process_audio (weak_ptr<const AudioContent> c, shared_ptr<AudioBuffers> b, double t) +Player::process_audio (weak_ptr<const AudioContent> c, shared_ptr<const AudioBuffers> b, double t) { AudioMapping mapping = _film->audio_mapping (); if (!_audio_buffers) { @@ -176,6 +176,10 @@ Player::seek (double t) _have_valid_decoders = true; } + if (_video_decoders.empty ()) { + return true; + } + /* Find the decoder that contains this position */ _video_decoder = 0; while (1) { diff --git a/src/lib/player.h b/src/lib/player.h index 2069064d7..20b83bfdb 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -57,8 +57,8 @@ public: double last_video_time () const; private: - void process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s, double); - void process_audio (boost::weak_ptr<const AudioContent>, boost::shared_ptr<AudioBuffers>, double); + void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s, double); + void process_audio (boost::weak_ptr<const AudioContent>, boost::shared_ptr<const AudioBuffers>, double); void setup_decoders (); void playlist_changed (); void content_changed (boost::weak_ptr<Content>, int); diff --git a/src/lib/po/es_ES.po b/src/lib/po/es_ES.po index 5c8d642e3..7d2f8511e 100644 --- a/src/lib/po/es_ES.po +++ b/src/lib/po/es_ES.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: LIBDCPOMATIC\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-04-09 11:14+0100\n" +"POT-Creation-Date: 2013-04-22 15:06+0100\n" "PO-Revision-Date: 2013-04-02 19:10-0500\n" "Last-Translator: Manuel AC <manuel.acevedo@civantos.>\n" "Language-Team: Manuel AC <manuel.acevedo@civantos.com>\n" @@ -25,10 +25,6 @@ msgstr "0%" msgid "1.19" msgstr "1.19" -#: src/lib/format.cc:79 -msgid "1.33" -msgstr "1.33" - #: src/lib/format.cc:83 msgid "1.375" msgstr "1.375" @@ -58,6 +54,10 @@ msgstr "16:9 en Flat" msgid "3D denoiser" msgstr "reducción de ruido 3D" +#: src/lib/format.cc:79 +msgid "4:3" +msgstr "" + #: src/lib/format.cc:87 msgid "4:3 within Flat" msgstr "4:3 en Flat" @@ -94,7 +94,7 @@ msgstr "Bicúbico" msgid "Bilinear" msgstr "Bilineal" -#: src/lib/job.cc:302 +#: src/lib/job.cc:306 msgid "Cancelled" msgstr "" @@ -175,7 +175,7 @@ msgstr "Dolby CP750" msgid "Each source frame will be doubled in the DCP.\n" msgstr "Se doblará cada fotograma de la fuente en el DCP.\n" -#: src/lib/job.cc:300 +#: src/lib/job.cc:304 msgid "Error (%1)" msgstr "Error (%1)" @@ -247,7 +247,7 @@ msgstr "Horizontal deblocking filter" msgid "Horizontal deblocking filter A" msgstr "Horizontal deblocking filter A" -#: src/lib/job.cc:92 src/lib/job.cc:101 +#: src/lib/job.cc:96 src/lib/job.cc:105 msgid "" "It is not known what caused this error. The best idea is to report the " "problem to the DCP-o-matic mailing list (dcpomatic@carlh.net)" @@ -301,7 +301,7 @@ msgstr "Motion compensating deinterlacer" msgid "Noise reduction" msgstr "Reducción de ruido" -#: src/lib/job.cc:298 +#: src/lib/job.cc:302 msgid "OK (ran for %1)" msgstr "OK (ejecución %1)" @@ -373,7 +373,7 @@ msgstr "Temporal noise reducer" msgid "Test" msgstr "Test" -#: src/lib/job.cc:77 +#: src/lib/job.cc:78 msgid "" "The drive that the film is stored on is low in disc space. Free some more " "space and try again." @@ -393,11 +393,11 @@ msgstr "Codificar %1" msgid "Transitional" msgstr "Transitional" -#: src/lib/job.cc:100 +#: src/lib/job.cc:104 msgid "Unknown error" msgstr "Error desconocido" -#: src/lib/ffmpeg_decoder.cc:396 +#: src/lib/ffmpeg_decoder.cc:388 msgid "Unrecognised audio sample format (%1)" msgstr "Formato de audio desconocido (%1)" @@ -425,7 +425,7 @@ msgstr "X" msgid "Yet Another Deinterlacing Filter" msgstr "Yet Another Deinterlacing Filter" -#: src/lib/film.cc:263 +#: src/lib/film.cc:296 msgid "cannot contain slashes" msgstr "no puede contener barras" @@ -437,11 +437,11 @@ msgstr "tiempo de conexión agotado" msgid "connecting" msgstr "conectando" -#: src/lib/film.cc:300 +#: src/lib/film.cc:333 msgid "content" msgstr "contenido" -#: src/lib/film.cc:304 +#: src/lib/film.cc:337 msgid "content type" msgstr "tipo de contenido" @@ -454,19 +454,19 @@ msgstr "copiando %1" msgid "could not create file %1" msgstr "No se pudo escribir el fichero remoto (%1)" -#: src/lib/ffmpeg_decoder.cc:191 +#: src/lib/ffmpeg_decoder.cc:187 msgid "could not find audio decoder" msgstr "no se encontró el decodificador de audio" -#: src/lib/ffmpeg_decoder.cc:118 +#: src/lib/ffmpeg_decoder.cc:114 msgid "could not find stream information" msgstr "no se pudo encontrar información del flujo" -#: src/lib/ffmpeg_decoder.cc:210 +#: src/lib/ffmpeg_decoder.cc:206 msgid "could not find subtitle decoder" msgstr "no se pudo encontrar decodificador de subtítutlos" -#: src/lib/ffmpeg_decoder.cc:169 +#: src/lib/ffmpeg_decoder.cc:165 msgid "could not find video decoder" msgstr "no se pudo encontrar decodificador de vídeo" @@ -513,7 +513,7 @@ msgstr "los ficheros externos de sonido tienen duraciones diferentes" msgid "external audio files must be mono" msgstr "los ficheros externos de sonido deben ser mono" -#: src/lib/film.cc:296 +#: src/lib/film.cc:329 msgid "format" msgstr "formato" @@ -549,7 +549,7 @@ msgstr "" msgid "multi-part subtitles not yet supported" msgstr "todavía no se soportan subtítulos en múltiples partes" -#: src/lib/film.cc:263 src/lib/film.cc:308 +#: src/lib/film.cc:296 src/lib/film.cc:341 msgid "name" msgstr "nombre" @@ -563,7 +563,7 @@ msgstr "todavía no se soportan subtítulos que no son en mapas de bits" #. / TRANSLATORS: remaining here follows an amount of time that is remaining #. / on an operation. -#: src/lib/job.cc:295 +#: src/lib/job.cc:299 msgid "remaining" msgstr "pendiente" @@ -575,14 +575,17 @@ msgstr "sRGB" msgid "seconds" msgstr "segundos" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "still" msgstr "imagen fija" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "video" msgstr "vídeo" +#~ msgid "1.33" +#~ msgstr "1.33" + #~ msgid "Source scaled to 1.19:1" #~ msgstr "Fuente escalada a 1.19:1" diff --git a/src/lib/po/fr_FR.po b/src/lib/po/fr_FR.po index af6890d97..7f3da788b 100644 --- a/src/lib/po/fr_FR.po +++ b/src/lib/po/fr_FR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: DCP-o-matic FRENCH\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-04-09 11:14+0100\n" +"POT-Creation-Date: 2013-04-22 15:06+0100\n" "PO-Revision-Date: 2013-03-20 00:39+0100\n" "Last-Translator: FreeDCP.net <freedcp.net@gmail.com>\n" "Language-Team: \n" @@ -24,10 +24,6 @@ msgstr "0%" msgid "1.19" msgstr "1.19" -#: src/lib/format.cc:79 -msgid "1.33" -msgstr "1.33" - #: src/lib/format.cc:83 msgid "1.375" msgstr "1.375" @@ -51,12 +47,16 @@ msgstr "16:9 dans Flat" #: src/lib/format.cc:115 #, fuzzy msgid "16:9 within Scope" -msgstr "16:9 dans Flat" +msgstr "16:9 dans Scope" #: src/lib/filter.cc:88 msgid "3D denoiser" msgstr "Débruitage 3D" +#: src/lib/format.cc:79 +msgid "4:3" +msgstr "" + #: src/lib/format.cc:87 msgid "4:3 within Flat" msgstr "4:3 dans Flat" @@ -93,7 +93,7 @@ msgstr "Bicubique" msgid "Bilinear" msgstr "Bilinéaire" -#: src/lib/job.cc:302 +#: src/lib/job.cc:306 msgid "Cancelled" msgstr "" @@ -173,7 +173,7 @@ msgstr "Dolby CP750" msgid "Each source frame will be doubled in the DCP.\n" msgstr "Chaque image source sera dupliquée dans le DCP.\n" -#: src/lib/job.cc:300 +#: src/lib/job.cc:304 msgid "Error (%1)" msgstr "Erreur (%1)" @@ -245,7 +245,7 @@ msgstr "Filtre dé-bloc horizontal" msgid "Horizontal deblocking filter A" msgstr "Filtre dé-bloc horizontal" -#: src/lib/job.cc:92 src/lib/job.cc:101 +#: src/lib/job.cc:96 src/lib/job.cc:105 msgid "" "It is not known what caused this error. The best idea is to report the " "problem to the DCP-o-matic mailing list (dcpomatic@carlh.net)" @@ -299,7 +299,7 @@ msgstr "Désentrelaceur par compensation de mouvement" msgid "Noise reduction" msgstr "Réduction de bruit" -#: src/lib/job.cc:298 +#: src/lib/job.cc:302 msgid "OK (ran for %1)" msgstr "OK (processus %1)" @@ -371,7 +371,7 @@ msgstr "Réduction de bruit temporel" msgid "Test" msgstr "Test" -#: src/lib/job.cc:77 +#: src/lib/job.cc:78 msgid "" "The drive that the film is stored on is low in disc space. Free some more " "space and try again." @@ -391,11 +391,11 @@ msgstr "Transcodage %1" msgid "Transitional" msgstr "Transitional" -#: src/lib/job.cc:100 +#: src/lib/job.cc:104 msgid "Unknown error" msgstr "Erreur inconnue" -#: src/lib/ffmpeg_decoder.cc:396 +#: src/lib/ffmpeg_decoder.cc:388 msgid "Unrecognised audio sample format (%1)" msgstr "Échantillonnage audio (%1) inconnu" @@ -423,7 +423,7 @@ msgstr "X" msgid "Yet Another Deinterlacing Filter" msgstr "Un autre filtre de désentrelacement" -#: src/lib/film.cc:263 +#: src/lib/film.cc:296 msgid "cannot contain slashes" msgstr "slash interdit" @@ -435,11 +435,11 @@ msgstr "temps de connexion expiré" msgid "connecting" msgstr "connexion" -#: src/lib/film.cc:300 +#: src/lib/film.cc:333 msgid "content" msgstr "contenu" -#: src/lib/film.cc:304 +#: src/lib/film.cc:337 msgid "content type" msgstr "type de contenu" @@ -451,19 +451,19 @@ msgstr "copie de %1" msgid "could not create file %1" msgstr "Écriture vers fichier distant (%1) impossible" -#: src/lib/ffmpeg_decoder.cc:191 +#: src/lib/ffmpeg_decoder.cc:187 msgid "could not find audio decoder" msgstr "décodeur audio introuvable" -#: src/lib/ffmpeg_decoder.cc:118 +#: src/lib/ffmpeg_decoder.cc:114 msgid "could not find stream information" msgstr "information du flux introuvable" -#: src/lib/ffmpeg_decoder.cc:210 +#: src/lib/ffmpeg_decoder.cc:206 msgid "could not find subtitle decoder" msgstr "décodeur de sous-titre introuvable" -#: src/lib/ffmpeg_decoder.cc:169 +#: src/lib/ffmpeg_decoder.cc:165 msgid "could not find video decoder" msgstr "décodeur vidéo introuvable" @@ -507,7 +507,7 @@ msgstr "Les fichiers audio externes ont des durées différentes" msgid "external audio files must be mono" msgstr "les fichiers audio externes doivent être en mono" -#: src/lib/film.cc:296 +#: src/lib/film.cc:329 msgid "format" msgstr "format" @@ -543,7 +543,7 @@ msgstr "" msgid "multi-part subtitles not yet supported" msgstr "sous-titres en plusieurs parties non supportés" -#: src/lib/film.cc:263 src/lib/film.cc:308 +#: src/lib/film.cc:296 src/lib/film.cc:341 msgid "name" msgstr "nom" @@ -557,7 +557,7 @@ msgstr "sous-titres non-bitmap non supportés actuellement" #. / TRANSLATORS: remaining here follows an amount of time that is remaining #. / on an operation. -#: src/lib/job.cc:295 +#: src/lib/job.cc:299 msgid "remaining" msgstr "restant" @@ -569,14 +569,17 @@ msgstr "sRGB" msgid "seconds" msgstr "secondes" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "still" msgstr "fixe" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "video" msgstr "vidéo" +#~ msgid "1.33" +#~ msgstr "1.33" + #~ msgid "Source scaled to 1.19:1" #~ msgstr "Source mise à l'échelle en 1.19:1" diff --git a/src/lib/po/it_IT.po b/src/lib/po/it_IT.po index c1ca26ea3..1d7f57536 100644 --- a/src/lib/po/it_IT.po +++ b/src/lib/po/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: IT VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-04-09 11:14+0100\n" +"POT-Creation-Date: 2013-04-22 15:06+0100\n" "PO-Revision-Date: 2013-04-03 15:04+0100\n" "Last-Translator: Maci <macibro@gmail.com>\n" "Language-Team: \n" @@ -25,10 +25,6 @@ msgstr "0%" msgid "1.19" msgstr "1.19" -#: src/lib/format.cc:79 -msgid "1.33" -msgstr "1.33" - #: src/lib/format.cc:83 msgid "1.375" msgstr "1.375" @@ -58,6 +54,10 @@ msgstr "16:9 all'interno di Flat" msgid "3D denoiser" msgstr "Riduttore di rumore 3D" +#: src/lib/format.cc:79 +msgid "4:3" +msgstr "" + #: src/lib/format.cc:87 msgid "4:3 within Flat" msgstr "4:3 all'interno di Flat" @@ -94,7 +94,7 @@ msgstr "Bicubica" msgid "Bilinear" msgstr "Bilineare" -#: src/lib/job.cc:302 +#: src/lib/job.cc:306 msgid "Cancelled" msgstr "Cancellato" @@ -173,7 +173,7 @@ msgstr "Dolby CP750" msgid "Each source frame will be doubled in the DCP.\n" msgstr "Ogni fotogramma del sorgente sarà raddoppiato nel DCP.\n" -#: src/lib/job.cc:300 +#: src/lib/job.cc:304 msgid "Error (%1)" msgstr "Errore (%1)" @@ -245,7 +245,7 @@ msgstr "Filtro sblocco orizzontale" msgid "Horizontal deblocking filter A" msgstr "Filtro A sblocco orizzontale" -#: src/lib/job.cc:92 src/lib/job.cc:101 +#: src/lib/job.cc:96 src/lib/job.cc:105 msgid "" "It is not known what caused this error. The best idea is to report the " "problem to the DCP-o-matic mailing list (dcpomatic@carlh.net)" @@ -299,7 +299,7 @@ msgstr "Dinterlacciatore compensativo di movimento" msgid "Noise reduction" msgstr "Riduzione del rumore" -#: src/lib/job.cc:298 +#: src/lib/job.cc:302 msgid "OK (ran for %1)" msgstr "OK (procede al %1)" @@ -371,7 +371,7 @@ msgstr "Riduttore temporale di rumore" msgid "Test" msgstr "Prova" -#: src/lib/job.cc:77 +#: src/lib/job.cc:78 msgid "" "The drive that the film is stored on is low in disc space. Free some more " "space and try again." @@ -391,11 +391,11 @@ msgstr "Transcodifica %1" msgid "Transitional" msgstr "Di transizione" -#: src/lib/job.cc:100 +#: src/lib/job.cc:104 msgid "Unknown error" msgstr "Errore sconosciuto" -#: src/lib/ffmpeg_decoder.cc:396 +#: src/lib/ffmpeg_decoder.cc:388 msgid "Unrecognised audio sample format (%1)" msgstr "Formato di campionamento audio non riconosciuto (%1)" @@ -423,7 +423,7 @@ msgstr "X" msgid "Yet Another Deinterlacing Filter" msgstr "Altro filtro di deinterlacciamento" -#: src/lib/film.cc:263 +#: src/lib/film.cc:296 msgid "cannot contain slashes" msgstr "non può contenere barre" @@ -435,11 +435,11 @@ msgstr "connessione scaduta" msgid "connecting" msgstr "mi sto connettendo" -#: src/lib/film.cc:300 +#: src/lib/film.cc:333 msgid "content" msgstr "contenuto" -#: src/lib/film.cc:304 +#: src/lib/film.cc:337 msgid "content type" msgstr "tipo di contenuto" @@ -451,19 +451,19 @@ msgstr "copia %1" msgid "could not create file %1" msgstr "Non posso scrivere il file remoto (%1)" -#: src/lib/ffmpeg_decoder.cc:191 +#: src/lib/ffmpeg_decoder.cc:187 msgid "could not find audio decoder" msgstr "non riesco a trovare il decoder audio" -#: src/lib/ffmpeg_decoder.cc:118 +#: src/lib/ffmpeg_decoder.cc:114 msgid "could not find stream information" msgstr "non riesco a trovare informazioni sullo streaming" -#: src/lib/ffmpeg_decoder.cc:210 +#: src/lib/ffmpeg_decoder.cc:206 msgid "could not find subtitle decoder" msgstr "non riesco a trovare il decoder dei sottotitoli" -#: src/lib/ffmpeg_decoder.cc:169 +#: src/lib/ffmpeg_decoder.cc:165 msgid "could not find video decoder" msgstr "non riesco a trovare il decoder video" @@ -507,7 +507,7 @@ msgstr "i files dell'audio esterno hanno durata diversa" msgid "external audio files must be mono" msgstr "i files dell'audio esterno devono essere mono" -#: src/lib/film.cc:296 +#: src/lib/film.cc:329 msgid "format" msgstr "formato" @@ -543,7 +543,7 @@ msgstr "persa la regolazione richiesta %1" msgid "multi-part subtitles not yet supported" msgstr "sottotitoli multi-part non ancora supportati" -#: src/lib/film.cc:263 src/lib/film.cc:308 +#: src/lib/film.cc:296 src/lib/film.cc:341 msgid "name" msgstr "nome" @@ -557,7 +557,7 @@ msgstr "sottotitoli non-bitmap non ancora supportati" #. / TRANSLATORS: remaining here follows an amount of time that is remaining #. / on an operation. -#: src/lib/job.cc:295 +#: src/lib/job.cc:299 msgid "remaining" msgstr "restano" @@ -569,14 +569,17 @@ msgstr "sRGB" msgid "seconds" msgstr "secondi" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "still" msgstr "ancora" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "video" msgstr "video" +#~ msgid "1.33" +#~ msgstr "1.33" + #~ msgid "Source scaled to 1.19:1" #~ msgstr "Sorgente scalato a 1.19:1" diff --git a/src/lib/po/sv_SE.po b/src/lib/po/sv_SE.po index f89874e35..ff86e23af 100644 --- a/src/lib/po/sv_SE.po +++ b/src/lib/po/sv_SE.po @@ -7,10 +7,11 @@ msgid "" msgstr "" "Project-Id-Version: DCP-o-matic\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-04-09 11:14+0100\n" +"POT-Creation-Date: 2013-04-22 15:06+0100\n" "PO-Revision-Date: 2013-04-10 15:35+0100\n" "Last-Translator: Adam Klotblixt <adam.klotblixt@gmail.com>\n" "Language-Team: \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -24,10 +25,6 @@ msgstr "0%" msgid "1.19" msgstr "1,19" -#: src/lib/format.cc:79 -msgid "1.33" -msgstr "1,33" - #: src/lib/format.cc:83 msgid "1.375" msgstr "1,375" @@ -56,6 +53,10 @@ msgstr "16:9 innanför Scope" msgid "3D denoiser" msgstr "3D brusreducering" +#: src/lib/format.cc:79 +msgid "4:3" +msgstr "" + #: src/lib/format.cc:87 msgid "4:3 within Flat" msgstr "4:3 innanför Flat" @@ -92,7 +93,7 @@ msgstr "Bikubisk" msgid "Bilinear" msgstr "Bilinjär" -#: src/lib/job.cc:302 +#: src/lib/job.cc:306 msgid "Cancelled" msgstr "Avbruten" @@ -172,7 +173,7 @@ msgstr "Dolby CP750" msgid "Each source frame will be doubled in the DCP.\n" msgstr "Varje bild från källan kommer att användas två gånger i DCPn.\n" -#: src/lib/job.cc:300 +#: src/lib/job.cc:304 msgid "Error (%1)" msgstr "Fel (%1)" @@ -244,7 +245,7 @@ msgstr "Filter för horisontal kantighetsutjämning" msgid "Horizontal deblocking filter A" msgstr "Filter för horisontal kantighetsutjämning A" -#: src/lib/job.cc:92 src/lib/job.cc:101 +#: src/lib/job.cc:96 src/lib/job.cc:105 msgid "" "It is not known what caused this error. The best idea is to report the " "problem to the DCP-o-matic mailing list (dcpomatic@carlh.net)" @@ -298,7 +299,7 @@ msgstr "Rörelsekompenserande avflätare" msgid "Noise reduction" msgstr "Brusreducering" -#: src/lib/job.cc:298 +#: src/lib/job.cc:302 msgid "OK (ran for %1)" msgstr "OK (kördes %1)" @@ -370,7 +371,7 @@ msgstr "Temporal brusreducering" msgid "Test" msgstr "Test" -#: src/lib/job.cc:77 +#: src/lib/job.cc:78 msgid "" "The drive that the film is stored on is low in disc space. Free some more " "space and try again." @@ -390,12 +391,12 @@ msgstr "Konvertera %1" msgid "Transitional" msgstr "Övergångsklipp" -#: src/lib/job.cc:100 +#: src/lib/job.cc:104 msgid "Unknown error" msgstr "Okänt fel" # Svengelska -#: src/lib/ffmpeg_decoder.cc:396 +#: src/lib/ffmpeg_decoder.cc:388 #, fuzzy msgid "Unrecognised audio sample format (%1)" msgstr "Okänt audio-sampelformat (%1)" @@ -425,7 +426,7 @@ msgstr "X" msgid "Yet Another Deinterlacing Filter" msgstr "Yet Another Deinterlacing Filter" -#: src/lib/film.cc:263 +#: src/lib/film.cc:296 msgid "cannot contain slashes" msgstr "får inte innehålla snedstreck" @@ -439,11 +440,11 @@ msgstr "uppkopplingen tajmade ur" msgid "connecting" msgstr "kopplar upp" -#: src/lib/film.cc:300 +#: src/lib/film.cc:333 msgid "content" msgstr "innehåll" -#: src/lib/film.cc:304 +#: src/lib/film.cc:337 msgid "content type" msgstr "innehållstyp" @@ -455,19 +456,19 @@ msgstr "kopierar %1" msgid "could not create file %1" msgstr "kunde inte skapa fil %1" -#: src/lib/ffmpeg_decoder.cc:191 +#: src/lib/ffmpeg_decoder.cc:187 msgid "could not find audio decoder" msgstr "kunde inte hitta audio-avkodare" -#: src/lib/ffmpeg_decoder.cc:118 +#: src/lib/ffmpeg_decoder.cc:114 msgid "could not find stream information" msgstr "kunde inte hitta information om strömmen" -#: src/lib/ffmpeg_decoder.cc:210 +#: src/lib/ffmpeg_decoder.cc:206 msgid "could not find subtitle decoder" msgstr "kunde inte hitta undertext-avkodare" -#: src/lib/ffmpeg_decoder.cc:169 +#: src/lib/ffmpeg_decoder.cc:165 msgid "could not find video decoder" msgstr "kunde inte hitta video-avkodare" @@ -511,7 +512,7 @@ msgstr "externa audio-filer har olika längder" msgid "external audio files must be mono" msgstr "externa audio-filer måste vara mono" -#: src/lib/film.cc:296 +#: src/lib/film.cc:329 msgid "format" msgstr "format" @@ -547,7 +548,7 @@ msgstr "saknad nödvändig inställning %1" msgid "multi-part subtitles not yet supported" msgstr "undertexter i flera delar stöds inte ännu" -#: src/lib/film.cc:263 src/lib/film.cc:308 +#: src/lib/film.cc:296 src/lib/film.cc:341 msgid "name" msgstr "namn" @@ -561,7 +562,7 @@ msgstr "icke-rastergrafiska undertexter stöds inte ännu" #. / TRANSLATORS: remaining here follows an amount of time that is remaining #. / on an operation. -#: src/lib/job.cc:295 +#: src/lib/job.cc:299 msgid "remaining" msgstr "återstående tid" @@ -573,14 +574,17 @@ msgstr "sRGB" msgid "seconds" msgstr "sekunder" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "still" msgstr "stillbild" -#: src/lib/film.cc:274 +#: src/lib/film.cc:307 msgid "video" msgstr "video" +#~ msgid "1.33" +#~ msgstr "1,33" + #~ msgid "Source scaled to 1.19:1" #~ msgstr "Källan skalad till 1,19:1" diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index ea3f27ad8..2e33931bd 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -35,6 +35,7 @@ #include "video_decoder.h" #include "audio_decoder.h" #include "player.h" +#include "trimmer.h" using std::string; using boost::shared_ptr; @@ -54,18 +55,27 @@ Transcoder::Transcoder (shared_ptr<Film> f, shared_ptr<Job> j) _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 (_encoder); + _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 (_encoder); + _gain->connect_audio (_trimmer); + _trimmer->connect_audio (_encoder); } void @@ -80,7 +90,9 @@ Transcoder::go () } _delay_line->process_end (); - _matcher->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 ecc8ebf62..97ecaabfc 100644 --- a/src/lib/transcoder.h +++ b/src/lib/transcoder.h @@ -31,6 +31,7 @@ class VideoFilter; class Gain; class DelayLine; class Player; +class Trimmer; /** @class Transcoder * @@ -58,4 +59,5 @@ protected: 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 index 68364e50a..b7afc9299 100644 --- a/src/lib/trimmer.cc +++ b/src/lib/trimmer.cc @@ -28,7 +28,8 @@ using boost::shared_ptr; Trimmer::Trimmer ( shared_ptr<Log> log, int video_trim_start, - int video_trim_end, int video_length, + int video_trim_end, + int video_length, int audio_sample_rate, float frames_per_second, int dcp_frames_per_second @@ -53,12 +54,19 @@ Trimmer::Trimmer ( _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<Image> image, bool same, shared_ptr<Subtitle> sub) +Trimmer::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Subtitle> sub) { - if (_video_in >= _video_start && _video_in <= _video_end) { + if (_no_trim || (_video_in >= _video_start && _video_in <= _video_end)) { Video (image, same, sub); } @@ -66,8 +74,13 @@ Trimmer::process_video (shared_ptr<Image> image, bool same, shared_ptr<Subtitle> } void -Trimmer::process_audio (shared_ptr<AudioBuffers> audio) +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 (); @@ -91,8 +104,10 @@ Trimmer::process_audio (shared_ptr<AudioBuffers> audio) _audio_in += audio->frames (); if (offset != 0 || length != audio->frames ()) { - audio->move (offset, 0, length); - audio->set_frames (length); + 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 index ff7e9514d..98a118fb2 100644 --- a/src/lib/trimmer.h +++ b/src/lib/trimmer.h @@ -24,8 +24,8 @@ class Trimmer : public AudioVideoProcessor public: Trimmer (boost::shared_ptr<Log>, int, int, int, int, float, int); - void process_video (boost::shared_ptr<Image> i, bool, boost::shared_ptr<Subtitle> s); - void process_audio (boost::shared_ptr<AudioBuffers>); + 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; @@ -36,4 +36,5 @@ private: int64_t _audio_start; int64_t _audio_end; int64_t _audio_in; + bool _no_trim; }; diff --git a/src/lib/util.cc b/src/lib/util.cc index 56932720c..ec1fd47bd 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -83,9 +83,10 @@ using std::pair; using boost::shared_ptr; using boost::thread; using boost::lexical_cast; +using boost::optional; using libdcp::Size; -thread::id ui_thread; +boost::thread::id ui_thread; /** Convert some number of seconds to a string representation * in hours, minutes and seconds. @@ -105,9 +106,9 @@ seconds_to_hms (int s) stringstream hms; hms << h << N_(":"); hms.width (2); - hms << setfill ('0') << m << N_(":"); + hms << std::setfill ('0') << m << N_(":"); hms.width (2); - hms << setfill ('0') << s; + hms << std::setfill ('0') << s; return hms.str (); } @@ -203,7 +204,7 @@ stacktrace (ostream& out, int levels) if (strings) { for (i = 0; i < size && (levels == 0 || i < size_t(levels)); i++) { - out << N_(" ") << demangle (strings[i]) << endl; + out << N_(" ") << demangle (strings[i]) << "\n"; } free (strings); @@ -356,7 +357,7 @@ md5_digest (void const * data, int size) stringstream s; for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) { - s << hex << setfill('0') << setw(2) << ((int) digest[i]); + s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]); } return s.str (); @@ -368,14 +369,14 @@ md5_digest (void const * data, int size) string md5_digest (boost::filesystem::path file) { - ifstream f (file.string().c_str(), ios::binary); + ifstream f (file.string().c_str(), std::ios::binary); if (!f.good ()) { throw OpenFileError (file.string()); } - f.seekg (0, ios::end); + f.seekg (0, std::ios::end); int bytes = f.tellg (); - f.seekg (0, ios::beg); + f.seekg (0, std::ios::beg); int const buffer_size = 64 * 1024; char buffer[buffer_size]; @@ -394,7 +395,7 @@ md5_digest (boost::filesystem::path file) stringstream s; for (int i = 0; i < MD5_DIGEST_LENGTH; ++i) { - s << hex << setfill('0') << setw(2) << ((int) digest[i]); + s << std::hex << std::setfill('0') << std::setw(2) << ((int) digest[i]); } return s.str (); @@ -459,8 +460,8 @@ best_dcp_frame_rate (float source_fps) } /* Pick the best one, bailing early if we hit an exact match */ - float error = numeric_limits<float>::max (); - boost::optional<FrameRateCandidate> best; + float error = std::numeric_limits<float>::max (); + optional<FrameRateCandidate> best; list<FrameRateCandidate>::iterator i = candidates.begin(); while (i != candidates.end()) { @@ -769,6 +770,21 @@ AudioBuffers::AudioBuffers (AudioBuffers const & other) } } +/* XXX: it's a shame that this is a copy-and-paste of the above; + probably fixable with c++0x. +*/ +AudioBuffers::AudioBuffers (boost::shared_ptr<const AudioBuffers> other) + : _channels (other->_channels) + , _frames (other->_frames) + , _allocated_frames (other->_frames) +{ + _data = new float*[_channels]; + for (int i = 0; i < _channels; ++i) { + _data[i] = new float[_frames]; + memcpy (_data[i], other->_data[i], _frames * sizeof (float)); + } +} + /** AudioBuffers destructor */ AudioBuffers::~AudioBuffers () { @@ -871,7 +887,7 @@ AudioBuffers::move (int from, int to, int frames) /** Add data from from `from', `from_channel' to our channel `to_channel' */ void -AudioBuffers::accumulate (shared_ptr<AudioBuffers> from, int from_channel, int to_channel) +AudioBuffers::accumulate (shared_ptr<const AudioBuffers> from, int from_channel, int to_channel) { int const N = frames (); assert (from->frames() == N); diff --git a/src/lib/util.h b/src/lib/util.h index 02cc742aa..0edfe2076 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -159,6 +159,7 @@ class AudioBuffers public: AudioBuffers (int channels, int frames); AudioBuffers (AudioBuffers const &); + AudioBuffers (boost::shared_ptr<const AudioBuffers>); ~AudioBuffers (); float** data () const { @@ -182,7 +183,7 @@ public: void copy_from (AudioBuffers* from, int frames_to_copy, int read_offset, int write_offset); void move (int from, int to, int frames); - void accumulate (boost::shared_ptr<AudioBuffers>, int, int); + void accumulate (boost::shared_ptr<const AudioBuffers>, int, int); private: /** Number of channels */ diff --git a/src/lib/video_sink.h b/src/lib/video_sink.h index 167d3980e..6239bc557 100644 --- a/src/lib/video_sink.h +++ b/src/lib/video_sink.h @@ -34,7 +34,7 @@ public: * @param same true if i is the same as last time we were called. * @param s A subtitle that should be on this frame, or 0. */ - virtual void process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s) = 0; + virtual void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s) = 0; }; class TimedVideoSink @@ -46,7 +46,7 @@ public: * @param s A subtitle that should be on this frame, or 0. * @param t Source timestamp. */ - virtual void process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s, double t) = 0; + virtual void process_video (boost::shared_ptr<const Image> i, bool same, boost::shared_ptr<Subtitle> s, double t) = 0; }; #endif diff --git a/src/lib/video_source.cc b/src/lib/video_source.cc index ccb76f020..2de4db68d 100644 --- a/src/lib/video_source.cc +++ b/src/lib/video_source.cc @@ -25,7 +25,7 @@ using boost::weak_ptr; using boost::bind; static void -process_video_proxy (weak_ptr<VideoSink> sink, shared_ptr<Image> i, bool same, shared_ptr<Subtitle> s) +process_video_proxy (weak_ptr<VideoSink> sink, shared_ptr<const Image> i, bool same, shared_ptr<Subtitle> s) { shared_ptr<VideoSink> p = sink.lock (); if (p) { @@ -47,3 +47,11 @@ TimedVideoSource::connect_video (shared_ptr<TimedVideoSink> s) { Video.connect (bind (&TimedVideoSink::process_video, s, _1, _2, _3, _4)); } + +void +TimedVideoSource::connect_video (shared_ptr<VideoSink> s) +{ + Video.connect (bind (&VideoSink::process_video, s, _1, _2, _3)); +} + + diff --git a/src/lib/video_source.h b/src/lib/video_source.h index d2aa045a7..9b4c9b4a2 100644 --- a/src/lib/video_source.h +++ b/src/lib/video_source.h @@ -45,7 +45,7 @@ public: * Second parameter is true if the image is the same as the last one that was emitted. * Third parameter is either 0 or a subtitle that should be on this frame. */ - boost::signals2::signal<void (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>)> Video; + boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>)> Video; void connect_video (boost::shared_ptr<VideoSink>); }; @@ -63,8 +63,9 @@ public: * Third parameter is either 0 or a subtitle that should be on this frame. * Fourth parameter is the source timestamp of this frame. */ - boost::signals2::signal<void (boost::shared_ptr<Image>, bool, boost::shared_ptr<Subtitle>, double)> Video; + boost::signals2::signal<void (boost::shared_ptr<const Image>, bool, boost::shared_ptr<Subtitle>, double)> Video; + void connect_video (boost::shared_ptr<VideoSink>); void connect_video (boost::shared_ptr<TimedVideoSink>); }; |
