X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmatcher.cc;h=48f6ed9126dd980c13b79b6665a3a82ad203bf9b;hb=ba0a895137b630f5d308b123ef886d68090f855d;hp=7b443453922bf537e6e2694929f50c0363ba7579;hpb=454478fa52d97a5590a05ae0222d582a3ec2f1dc;p=dcpomatic.git diff --git a/src/lib/matcher.cc b/src/lib/matcher.cc index 7b4434539..48f6ed912 100644 --- a/src/lib/matcher.cc +++ b/src/lib/matcher.cc @@ -21,10 +21,12 @@ #include "image.h" #include "log.h" +#include "i18n.h" + using std::min; using boost::shared_ptr; -Matcher::Matcher (Log* log, int sample_rate, float frames_per_second) +Matcher::Matcher (shared_ptr log, int sample_rate, float frames_per_second) : AudioVideoProcessor (log) , _sample_rate (sample_rate) , _frames_per_second (frames_per_second) @@ -35,9 +37,9 @@ Matcher::Matcher (Log* log, int sample_rate, float frames_per_second) } void -Matcher::process_video (boost::shared_ptr i, boost::shared_ptr s) +Matcher::process_video (boost::shared_ptr i, bool same, boost::shared_ptr s) { - Video (i, s); + Video (i, same, s); _video_frames++; _pixel_format = i->pixel_format (); @@ -65,7 +67,7 @@ Matcher::process_end () _log->log ( String::compose ( - "Matching processor has seen %1 video frames (which equals %2 audio frames) and %3 audio frames", + N_("Matching processor 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 @@ -74,17 +76,17 @@ Matcher::process_end () if (audio_short_by_frames < 0) { - _log->log (String::compose ("%1 too many audio frames", -audio_short_by_frames)); + _log->log (String::compose (N_("%1 too many audio frames"), -audio_short_by_frames)); /* We have seen more audio than video. Emit enough black video frames so that we reverse this */ int const black_video_frames = ceil (-audio_short_by_frames * _frames_per_second / _sample_rate); - _log->log (String::compose ("Emitting %1 frames of black video", black_video_frames)); + _log->log (String::compose (N_("Emitting %1 frames of black video"), black_video_frames)); - shared_ptr black (new CompactImage (_pixel_format.get(), _size.get())); + shared_ptr black (new SimpleImage (_pixel_format.get(), _size.get(), true)); black->make_black (); for (int i = 0; i < black_video_frames; ++i) { - Video (black, shared_ptr()); + Video (black, i != 0, shared_ptr()); } /* Now recompute our check value */ @@ -92,7 +94,7 @@ Matcher::process_end () } if (audio_short_by_frames > 0) { - _log->log (String::compose ("Emitted %1 too few audio frames", audio_short_by_frames)); + _log->log (String::compose (N_("Emitted %1 too few audio frames"), audio_short_by_frames)); /* Do things in half second blocks as I think there may be limits to what FFmpeg (and in particular the resampler) can cope with.