Use FileGroup in FFmpeg.
[dcpomatic.git] / src / lib / ffmpeg_examiner.cc
index ceeaee112fdeba0d66680f9fa557a7833789d643..4d10aabbb85daf819f127a6946888446e56121ec 100644 (file)
@@ -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<const FFmpegContent> 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 ();
 }