connect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
- connect(m_projectList, SIGNAL(getFileProperties(const KUrl &, uint)), m_clipMonitor->render, SLOT(getFileProperties(const KUrl &, uint)));
+ connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, int)), m_clipMonitor->render, SLOT(getFileProperties(const QDomElement &, int)));
- connect(m_clipMonitor->render, SIGNAL(replyGetImage(const KUrl &, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(const KUrl &, int, const QPixmap &, int, int)));
+ //connect(m_projectList, SIGNAL(getFileProperties(const KUrl &, uint)), m_clipMonitor->render, SLOT(getFileProperties(const KUrl &, uint)));
- connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(const QMap < QString, QString > &, const QMap < QString, QString > &)));
+ connect(m_clipMonitor->render, SIGNAL(replyGetImage(int, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(int, int, const QPixmap &, int, int)));
+
+ connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)));
}
if (m_element.isNull()) {
QDomDocument doc;
m_element = doc.createElement("producer");
- m_element.setAttribute("resource", attributes["filename"]);
- m_element.setAttribute("type", (int) m_clipType);
- }
+ }
+ m_element.setAttribute("resource", attributes["filename"]);
+ m_element.setAttribute("type", (int) m_clipType);
/*
if (attributes.contains("height")) {
m_height = attributes["height"].toInt();
ProjectItem *item = new ProjectItem(listView, name, elem, clipId);
if (!url.isEmpty()) {
item->setData(1, FullPathRole, url.path());
- emit getFileProperties(url, elem.attribute("frame_thumbnail", 0).toInt());
}
+ if (elem.isNull() ) {
+ QDomDocument doc;
+ QDomElement element = doc.createElement("producer");
+ element.setAttribute("resource", url.path());
+ emit getFileProperties(element, clipId);
+ }
+ else emit getFileProperties(elem, clipId);
}
void ProjectList::deleteClip(const int clipId)
return prods;
}
-void ProjectList::slotReplyGetFileProperties(const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata)
+
+void ProjectList::slotReplyGetFileProperties(int clipId, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata)
{
QTreeWidgetItem *parent = 0;
int count =
QTreeWidgetItem *item =
parent ? parent->child(i) : listView->topLevelItem(i);
- if (item->data(1, FullPathRole).toString() == properties["filename"]) {
+ if (((ProjectItem *)item)->clipId() == clipId) {
((ProjectItem *) item)->setProperties(properties, metadata);
break;
}
}
-void ProjectList::slotReplyGetImage(const KUrl &url, int pos, const QPixmap &pix, int w, int h)
+
+void ProjectList::slotReplyGetImage(int clipId, int pos, const QPixmap &pix, int w, int h)
{
QTreeWidgetItem *parent = 0;
int count =
QTreeWidgetItem *item =
parent ? parent->child(i) : listView->topLevelItem(i);
- if (item->data(1, FullPathRole).toString() == url.path()) {
- item->setIcon(0, pix);
+ if (((ProjectItem *)item)->clipId() == clipId) {
+ item->setIcon(0, pix);
break;
}
}
-
}
public slots:
void setDocument(KdenliveDoc *doc);
void addProducer(QDomElement producer);
- void slotReplyGetImage(const KUrl &url, int pos, const QPixmap &pix, int w, int h);
- void slotReplyGetFileProperties(const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata);
+ void slotReplyGetImage(int clipId, int pos, const QPixmap &pix, int w, int h);
+ void slotReplyGetFileProperties(int clipId, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata);
private:
signals:
void clipSelected(const QDomElement &);
- void getFileProperties(const KUrl &, uint);
+ void getFileProperties(const QDomElement&, int);
};
#endif
return pix;
}
-
+/*
void Render::getImage(KUrl url, int frame_position, QPoint size)
{
char *tmp = decodedString(url.path());
delete frame;
emit replyGetImage(url, frame_position, pix, size.x(), size.y());
}
-}
+}*/
/* Create thumbnail for color */
-void Render::getImage(int id, QString color, QPoint size)
+/*void Render::getImage(int id, QString color, QPoint size)
{
QPixmap pixmap(size.x() - 2, size.y() - 2);
color = color.replace(0, 2, "#");
//copyBlt(&result, 1, 1, &pixmap, 0, 0, size.x() - 2, size.y() - 2);
emit replyGetImage(id, result, size.x(), size.y());
-}
+}*/
/* Create thumbnail for image */
-void Render::getImage(KUrl url, QPoint size)
+/*void Render::getImage(KUrl url, QPoint size)
{
QImage im;
QPixmap pixmap;
result.fill(Qt::black);
//copyBlt(&result, 1, 1, &pixmap, 0, 0, size.x() - 2, size.y() - 2);
emit replyGetImage(url, 1, result, size.x(), size.y());
-}
+}*/
double Render::consumerRatio() const
return true;
}
-
-void Render::getFileProperties(const KUrl &url, uint framenb)
+void Render::getFileProperties(const QDomElement &xml, int clipId)
{
int height = 40;
int width = height * 16/9.0; //KdenliveSettings::displayratio();
- char *tmp = decodedString(url.path());
- Mlt::Producer producer(tmp);
+ QDomDocument doc;
+ QDomElement westley = doc.createElement("westley");
+ doc.appendChild(westley);
+ westley.appendChild(doc.importNode(xml, true));
+ kDebug()<<"////////////\n"<<doc.toString()<<"////////////////\n";
+ char *tmp = decodedString(doc.toString());
+
+ Mlt::Producer producer("westley-xml", tmp);
delete[] tmp;
+
if (producer.is_blank()) {
return;
}
- producer.seek( framenb );
+ 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());
-
+
Mlt::Filter m_convert("avcolour_space");
m_convert.set("forced", mlt_image_rgb24a);
producer.attach(m_convert);
// Generate thumbnail for this frame
QPixmap pixmap = frameThumbnail(frame, width, height, true);
- emit replyGetImage(url, 0, pixmap, width, height);
+ 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(url, 0, pixmap, width, height);
+ emit replyGetImage(clipId, 0, pixmap, width, height);
filePropertyMap["type"] = "audio";
}
}
- emit replyGetFileProperties(filePropertyMap, metadataPropertyMap);
+ emit replyGetFileProperties(clipId, filePropertyMap, metadataPropertyMap);
kDebug()<<"REquested fuile info for: "<<url.path();
delete frame;
}
QPixmap getImageThumbnail(KUrl url, int width, int height);
/** Return thumbnail for color clip */
- void getImage(int id, QString color, QPoint size);
+ //void getImage(int id, QString color, QPoint size);
static QPixmap frameThumbnail(Mlt::Frame *frame, int width, int height, bool border = false);
/** Return thumbnail for image clip */
- void getImage(KUrl url, QPoint size);
+ //void getImage(KUrl url, QPoint size);
/** Requests a particular frame from the given file.
*
* The pixmap will be returned by emitting the replyGetImage() signal.
* */
- void getImage(KUrl url, int frame, QPoint size);
+ //void getImage(KUrl url, int frame, QPoint size);
+
/** Wraps the VEML command of the same name. Sets the current scene list to
be list. */
/** This signal is emitted once a reply to createVideoXWidow() has been recieved. */
void replyCreateVideoXWindow(WId);
/** emitted when the renderer recieves a reply to a getFileProperties request. */
- void replyGetFileProperties(const QMap < QString, QString > &, const QMap < QString, QString > &);
+ void replyGetFileProperties(int clipId, const QMap < QString, QString > &, const QMap < QString, QString > &);
/** emitted when the renderer recieves a reply to a getImage request. */
- void replyGetImage(const KUrl &, int, const QPixmap &, int, int);
+ void replyGetImage(int , int, const QPixmap &, int, int);
void replyGetImage(int, const QPixmap &, int, int);
/** Emitted when the renderer stops, either playing or rendering. */
/** Wraps the VEML command of the same name. Requests the file properties
for the specified url from the renderer. Upon return, the result will be emitted
via replyGetFileProperties(). */
- void getFileProperties(const KUrl &url, uint framenb = 0);
+ void getFileProperties(const QDomElement &xml, int clipId);
void exportFileToFirewire(QString srcFileName, int port, GenTime startTime, GenTime endTime);
static char *decodedString(QString str);