summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-04-24 01:18:49 +0100
committerCarl Hetherington <cth@carlh.net>2013-04-24 01:18:49 +0100
commit9c591cc25317fa7f8eac7bd7ca36a741a519e5d0 (patch)
treeb3f08f3af4c9eb30bbd06d0840fec4e925f7077d
parent8dd9ea3086b4934f2719648ffa6333c0d106ff36 (diff)
Hack around no-trim altering the ends of encodes.
-rw-r--r--src/lib/trimmer.cc14
-rw-r--r--src/lib/trimmer.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/trimmer.cc b/src/lib/trimmer.cc
index 39ec44fcb..0746b7410 100644
--- a/src/lib/trimmer.cc
+++ b/src/lib/trimmer.cc
@@ -53,12 +53,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<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);
}
@@ -68,6 +75,11 @@ Trimmer::process_video (shared_ptr<const Image> image, bool same, shared_ptr<Sub
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 ();
diff --git a/src/lib/trimmer.h b/src/lib/trimmer.h
index 45b3f149a..98a118fb2 100644
--- a/src/lib/trimmer.h
+++ b/src/lib/trimmer.h
@@ -36,4 +36,5 @@ private:
int64_t _audio_start;
int64_t _audio_end;
int64_t _audio_in;
+ bool _no_trim;
};