X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fffmpeg_examiner.cc;h=4d10aabbb85daf819f127a6946888446e56121ec;hb=13b2b8f48f3f1a22277a760a7fada980b9f37677;hp=ceeaee112fdeba0d66680f9fa557a7833789d643;hpb=50ce388189f9c930ea0ba80cfb20237cfa464a3f;p=dcpomatic.git diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index ceeaee112..4d10aabbb 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -26,12 +26,13 @@ extern "C" { using std::string; using std::cout; +using std::max; using std::stringstream; using boost::shared_ptr; using boost::optional; FFmpegExaminer::FFmpegExaminer (shared_ptr c) - : FFmpeg (c) + : FFmpeg (c, true) { /* Find audio and subtitle streams */ @@ -135,7 +136,8 @@ FFmpegExaminer::video_size () const VideoContent::Frame FFmpegExaminer::video_length () const { - return (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate(); + VideoContent::Frame const length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate(); + return max (1, length); } string @@ -158,9 +160,11 @@ FFmpegExaminer::stream_name (AVStream* s) const } } - if (n.str().empty()) { - n << "unknown"; + if (!n.str().empty()) { + n << "; "; } + n << s->codec->channels << " channels"; + return n.str (); }