Merge master.
[dcpomatic.git] / src / lib / ffmpeg_examiner.cc
index df12830f819eb182c2c04db9838e71f550e236ff..949062f5bd5c3a9e5b1eace869ffc4474007560f 100644 (file)
@@ -73,7 +73,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c)
         * where we should look for subtitles (video and audio are always present,
         * so they are ok).
         */
-       while (1) {
+       while (true) {
                int r = av_read_frame (_format_context, &_packet);
                if (r < 0) {
                        break;
@@ -176,7 +176,7 @@ FFmpegExaminer::video_size () const
 ContentTime
 FFmpegExaminer::video_length () const
 {
-       ContentTime const length = ContentTime::from_seconds (double (_format_context->duration) / AV_TIME_BASE);
+       ContentTime const length = ContentTime::from_seconds (double (_format_context->duration - _format_context->start_time) / AV_TIME_BASE);
        return ContentTime (max (int64_t (1), length.get ()));
 }