Allow loading of multiple films from the batch converter command line.
[dcpomatic.git] / src / lib / ffmpeg_decoder.cc
index a47cd405d38f47ae1ea1536b95a5d440bb989c77..f0500a6296965bec6a43816de589a49f999e0ed4 100644 (file)
@@ -137,7 +137,7 @@ FFmpegDecoder::pass (PassReason reason, bool accurate)
                        /* Maybe we should fail here, but for now we'll just finish off instead */
                        char buf[256];
                        av_strerror (r, buf, sizeof(buf));
-                       LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), buf, r);
+                       LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), &buf[0], r);
                }
 
                flush ();
@@ -421,7 +421,12 @@ FFmpegDecoder::decode_audio_packet ()
                                ct += ContentTime::from_frames (remove, (*stream)->frame_rate ());
                        }
 
-                       if (data->frames() > 0) {
+                       if (ct < ContentTime()) {
+                               LOG_WARNING ("Crazy timestamp %s", to_string (ct));
+                       }
+
+                       /* Give this data provided there is some, and its time is sane */
+                       if (ct >= ContentTime() && data->frames() > 0) {
                                audio->give (*stream, data, ct);
                        }
                }