+ Mlt::Frame *frame = producer->get_frame();
+ if (frame && frame->is_valid()) {
+ filePropertyMap["frame_size"] = QString::number(frame->get_int("width")) + 'x' + QString::number(frame->get_int("height"));
+ filePropertyMap["frequency"] = QString::number(frame->get_int("frequency"));
+ filePropertyMap["channels"] = QString::number(frame->get_int("channels"));
+ filePropertyMap["aspect_ratio"] = frame->get("aspect_ratio");
+
+ if (frame->get_int("test_image") == 0) {
+ if (url.path().endsWith(".mlt") || url.path().endsWith(".westley") || url.path().endsWith(".kdenlive")) {
+ filePropertyMap["type"] = "playlist";
+ metadataPropertyMap["comment"] = QString::fromUtf8(producer->get("title"));
+ } else if (frame->get_int("test_audio") == 0)
+ filePropertyMap["type"] = "av";
+ else
+ filePropertyMap["type"] = "video";
+
+ int variance;
+ QImage img;
+ do {
+ variance = 100;
+ img = KThumb::getFrame(frame, imageWidth, fullWidth, info.imageHeight);
+ variance = KThumb::imageVariance(img);
+ if (frameNumber == -1 && variance< 6) {
+ // Thumbnail is not interesting (for example all black, seek to fetch better thumb
+ frameNumber = duration > 100 ? 100 : duration / 2 ;
+ producer->seek(frameNumber);
+ delete frame;
+ frame = producer->get_frame();
+ variance = -1;
+ }
+ } while (variance == -1);
+ delete frame;
+ if (frameNumber > -1) filePropertyMap["thumbnail"] = QString::number(frameNumber);
+ emit replyGetImage(info.clipId, img);
+ } else if (frame->get_int("test_audio") == 0) {
+ emit replyGetImage(info.clipId, "audio-x-generic", fullWidth, info.imageHeight);
+ filePropertyMap["type"] = "audio";
+ }
+ }
+ // Retrieve audio / video codec name
+ // If there is a
+
+ if (vindex > -1) {
+ /*if (context->duration == AV_NOPTS_VALUE) {
+ kDebug() << " / / / / / / / /ERROR / / / CLIP HAS UNKNOWN DURATION";
+ emit removeInvalidClip(clipId);
+ delete producer;
+ return;
+ }*/
+ // Get the video_index
+ int video_max = 0;
+ int default_audio = producer->get_int("audio_index");
+ int audio_max = 0;
+
+ int scan = producer->get_int("meta.media.progressive");
+ filePropertyMap["progressive"] = QString::number(scan);
+
+ // Find maximum stream index values
+ for (int ix = 0; ix < producer->get_int("meta.media.nb_streams"); ix++) {
+ snprintf(property, sizeof(property), "meta.media.%d.stream.type", ix);
+ QString type = producer->get(property);
+ if (type == "video")
+ video_max = ix;
+ else if (type == "audio")
+ audio_max = ix;
+ }
+ filePropertyMap["default_video"] = QString::number(vindex);
+ filePropertyMap["video_max"] = QString::number(video_max);
+ filePropertyMap["default_audio"] = QString::number(default_audio);
+ filePropertyMap["audio_max"] = QString::number(audio_max);
+
+ snprintf(property, sizeof(property), "meta.media.%d.codec.long_name", vindex);
+ if (producer->get(property)) {
+ filePropertyMap["videocodec"] = producer->get(property);
+ } else {
+ snprintf(property, sizeof(property), "meta.media.%d.codec.name", vindex);
+ if (producer->get(property))
+ filePropertyMap["videocodec"] = producer->get(property);
+ }
+ QString query;
+ query = QString("meta.media.%1.codec.pix_fmt").arg(vindex);
+ filePropertyMap["pix_fmt"] = producer->get(query.toUtf8().constData());
+ filePropertyMap["colorspace"] = producer->get("meta.media.colorspace");
+
+ } else kDebug() << " / / / / /WARNING, VIDEO CONTEXT IS NULL!!!!!!!!!!!!!!";
+ if (producer->get_int("audio_index") > -1) {
+ // Get the audio_index
+ int index = producer->get_int("audio_index");
+ snprintf(property, sizeof(property), "meta.media.%d.codec.long_name", index);
+ if (producer->get(property)) {