+ if (producer.is_blank()) {
+ return;
+ }
+ int frameNumber = xml.attribute("frame_thumbnail", 0).toInt();
+ if (frameNumber != 0) producer.seek(frameNumber);
+ mlt_properties properties = MLT_PRODUCER_PROPERTIES(producer.get_producer());
+
+ QMap < QString, QString > filePropertyMap;
+ QMap < QString, QString > metadataPropertyMap;
+
+ KUrl url = xml.attribute("resource", QString::null);
+ filePropertyMap["filename"] = url.path();
+ filePropertyMap["duration"] = QString::number(producer.get_playtime());
+ kDebug() << "/////// PRODUCER: " << url.path() << " IS: " << producer.get_playtime();
+ Mlt::Filter m_convert(*m_mltProfile, "avcolour_space");
+ m_convert.set("forced", mlt_image_rgb24a);
+ producer.attach(m_convert);
+ Mlt::Frame * frame = producer.get_frame();
+
+ filePropertyMap["fps"] =
+ QString::number(mlt_producer_get_fps(producer.get_producer()));
+
+ if (frame && frame->is_valid()) {
+ filePropertyMap["width"] =
+ QString::number(frame->get_int("width"));
+ filePropertyMap["height"] =
+ QString::number(frame->get_int("height"));
+ filePropertyMap["frequency"] =
+ QString::number(frame->get_int("frequency"));
+ filePropertyMap["channels"] =
+ QString::number(frame->get_int("channels"));
+
+ if (frame->get_int("test_image") == 0) {
+ if (url.path().endsWith(".westley") || url.path().endsWith(".kdenlive")) {
+ filePropertyMap["type"] = "playlist";
+ metadataPropertyMap["comment"] = QString::fromUtf8(mlt_properties_get(MLT_SERVICE_PROPERTIES(producer.get_service()), "title"));
+ } else if (frame->get_int("test_audio") == 0)
+ filePropertyMap["type"] = "av";
+ else
+ filePropertyMap["type"] = "video";
+
+ // Generate thumbnail for this frame
+ QPixmap pixmap = frameThumbnail(frame, width, height, true);
+
+ emit replyGetImage(clipId, 0, pixmap, width, height);
+
+ } else if (frame->get_int("test_audio") == 0) {
+ QPixmap pixmap(KStandardDirs::locate("appdata", "graphics/music.png"));
+ emit replyGetImage(clipId, 0, pixmap, width, height);
+ filePropertyMap["type"] = "audio";
+ }
+ }
+
+ // Retrieve audio / video codec name
+
+ // Fetch the video_context
+#if 0 //until the reason for the chrashs is found
+ AVFormatContext *context = (AVFormatContext *) mlt_properties_get_data(properties, "video_context", NULL);
+ if (context != NULL) {
+ // Get the video_index
+ int index = mlt_properties_get_int(properties, "video_index");
+ if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name)
+ filePropertyMap["videocodec"] = context->streams[ index ]->codec->codec->name;
+ }
+ context = (AVFormatContext *) mlt_properties_get_data(properties, "audio_context", NULL);
+ if (context != NULL) {
+ // Get the video_index
+ int index = mlt_properties_get_int(properties, "audio_index");
+ if (context->streams && context->streams [index] && context->streams[ index ]->codec && context->streams[ index ]->codec->codec->name)
+ filePropertyMap["audiocodec"] = context->streams[ index ]->codec->codec->name;
+ }
+#endif
+
+
+ // metadata
+
+ mlt_properties metadata = mlt_properties_new();
+ mlt_properties_pass(metadata, properties, "meta.attr.");
+ int count = mlt_properties_count(metadata);
+ for (int i = 0; i < count; i ++) {
+ QString name = mlt_properties_get_name(metadata, i);
+ QString value = QString::fromUtf8(mlt_properties_get_value(metadata, i));
+ if (name.endsWith("markup") && !value.isEmpty())
+ metadataPropertyMap[ name.section(".", 0, -2)] = value;
+ }
+
+ emit replyGetFileProperties(clipId, filePropertyMap, metadataPropertyMap);
+ kDebug() << "REquested fuile info for: " << url.path();
+ if (frame) delete frame;