Merge master.
[dcpomatic.git] / src / lib / matcher.cc
index 2b7a080fc91aea71f522570205cd5053246d7cce..77ed9b6515bbb3e40add4a89e3b4d6d6d81a0d52 100644 (file)
 #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> log, int sample_rate, float frames_per_second)
        : AudioVideoProcessor (log)
        , _sample_rate (sample_rate)
        , _frames_per_second (frames_per_second)
@@ -35,7 +37,7 @@ Matcher::Matcher (Log* log, int sample_rate, float frames_per_second)
 }
 
 void
-Matcher::process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr<Subtitle> s)
+Matcher::process_video (shared_ptr<Image> i, bool same, shared_ptr<Subtitle> s)
 {
        Video (i, same, s);
        _video_frames++;
@@ -45,7 +47,7 @@ Matcher::process_video (boost::shared_ptr<Image> i, bool same, boost::shared_ptr
 }
 
 void
-Matcher::process_audio (boost::shared_ptr<AudioBuffers> b)
+Matcher::process_audio (shared_ptr<AudioBuffers> b)
 {
        Audio (b);
        _audio_frames += b->frames ();
@@ -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,14 +76,14 @@ 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<Image> black (new SimpleImage (_pixel_format.get(), _size.get(), false));
+               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>());
@@ -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.