+ int default_video = -1;
+ int video_max = 0;
+ int default_audio = -1;
+ int audio_max = 0;
+ // Find default audio stream (borrowed from MLT)
+ for (int ix = 0; ix < context->nb_streams; ix++) {
+ // Get the codec context
+ AVCodecContext *codec_context = context->streams[ ix ]->codec;
+
+ if (avcodec_find_decoder(codec_context->codec_id) == NULL)
+ continue;
+ // Determine the type and obtain the first index of each type
+ switch (codec_context->codec_type) {
+ case CODEC_TYPE_VIDEO:
+ if (default_video < 0) default_video = ix;
+ video_max = ix;
+ break;
+ case CODEC_TYPE_AUDIO:
+ if (default_audio < 0) default_audio = ix;
+ audio_max = ix;
+ break;
+ default:
+ break;
+ }
+ }
+ filePropertyMap["default_video"] = QString::number(default_video);
+ filePropertyMap["video_max"] = QString::number(video_max);
+ filePropertyMap["default_audio"] = QString::number(default_audio);
+ filePropertyMap["audio_max"] = QString::number(audio_max);
+