ProjectItem *item = getItemById(id);
if (item) {
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
+ int height = m_listView->iconSize().height();
+ int width = (int)(height * m_render->dar());
+ QPixmap pixmap = QPixmap(width, height);
+ pixmap.fill(Qt::transparent);
+ KIcon icon("dialog-close");
+ QPainter p(&pixmap);
+ p.drawPixmap(3, 3, icon.pixmap(width - 6, height - 6));
+ p.end();
+ item->setData(0, Qt::DecorationRole, pixmap);
if (item->referencedClip()) {
item->referencedClip()->setPlaceHolder(true);
if (m_render == NULL) kDebug() << "********* ERROR, NULL RENDR";
void ProjectList::adjustProxyActions(ProjectItem *clip) const
{
- if (clip == NULL || clip->type() != PROJECTCLIPTYPE || clip->clipType() == COLOR || clip->clipType() == TEXT || clip->clipType() == PLAYLIST || clip->clipType() == SLIDESHOW || clip->clipType() == AUDIO) {
+ if (clip == NULL || clip->type() != PROJECTCLIPTYPE || clip->clipType() == COLOR || clip->clipType() == TEXT || clip->clipType() == SLIDESHOW || clip->clipType() == AUDIO) {
m_proxyAction->setEnabled(false);
return;
}
DocClipBase *clip;
ProjectItem *item;
monitorItemEditing(false);
+ int height = m_listView->iconSize().height();
+ int width = (int)(height * m_render->dar());
+ QPixmap missingPixmap = QPixmap(width, height);
+ missingPixmap.fill(Qt::transparent);
+ KIcon icon("dialog-close");
+ QPainter p(&missingPixmap);
+ p.drawPixmap(3, 3, icon.pixmap(width - 6, height - 6));
+ p.end();
+
while (*it) {
if ((*it)->type() == PROJECTSUBCLIPTYPE) {
// subitem
if (item->referencedClip()->producer() == NULL) {
if (clip->isPlaceHolder() == false)
requestClipInfo(clip->toXML(), clip->getId());
- else if (!clip->isPlaceHolder())
+ else {
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
+ if (item->data(0, Qt::DecorationRole).isNull()) {
+ item->setData(0, Qt::DecorationRole, missingPixmap);
+ }
+ }
} else {
if (displayRatioChanged || item->data(0, Qt::DecorationRole).isNull())
requestClipThumbnail(clip->getId());
CLIPTYPE t = item->clipType();
if (t == IMAGE) maxSize = m_doc->getDocumentProperty("proxyimageminsize").toInt();
else maxSize = m_doc->getDocumentProperty("proxyminsize").toInt();
- if (((t == AV || t == VIDEO) && generateProxy() && size.section('x', 0, 0).toInt() > maxSize) || (t == IMAGE && generateImageProxy() && (size.section('x', 0, 0).toInt() > maxSize || size.section('x', 1, 1).toInt() > maxSize))) {
+ if ((size.section('x', 0, 0).toInt() > maxSize || size.section('x', 1, 1).toInt() > maxSize) && (((t == AV || t == VIDEO || t == PLAYLIST) && generateProxy()) || (t == IMAGE && generateImageProxy()))) {
if (clip->getProperty("proxy").isEmpty()) {
- QString proxydir = m_doc->projectFolder().path( KUrl::AddTrailingSlash) + "proxy/";
+ KUrl proxyPath = m_doc->projectFolder();
+ proxyPath.addPath("proxy/");
+ proxyPath.addPath(clip->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension")));
QMap <QString, QString> newProps;
- QString path = proxydir + clip->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension"));
- newProps.insert("proxy", path);
+ newProps.insert("proxy", proxyPath.path());
// insert required duration for proxy
if (t != IMAGE) newProps.insert("proxy_out", clip->producerProperty("out"));
QMap <QString, QString> oldProps = clip->properties();
return;
}
- QString url = item->clipUrl().path();
-
if (QFile::exists(path)) {
setProxyStatus(id, PROXYDONE);
slotGotProxy(id);
file.close();
QFile::remove(path);
}
+
+ QString url = item->clipUrl().path();
+
+ // Special case: playlist clips (.mlt or .kdenlive project files)
+ if (item->clipType() == PLAYLIST) {
+ // change FFmpeg params to MLT format
+ QStringList parameters;
+ parameters << url;
+ parameters << "-consumer" << "avformat:" + path;
+ QStringList params = m_doc->getDocumentProperty("proxyparams").simplified().split('-', QString::SkipEmptyParts);
+
+ foreach(QString s, params) {
+ s = s.simplified();
+ if (s.count(' ') == 0) {
+ s.append("=1");
+ }
+ else s.replace(' ', '=');
+ parameters << s;
+ }
+
+ // currently, when rendering an xml file through melt, the display ration is lost, so we enforce it manualy
+ double display_ratio = KdenliveDoc::getDisplayRatio(url);
+ parameters << "aspect=" + QString::number(display_ratio);
+
+ //kDebug()<<"TRANSCOD: "<<parameters;
+ QProcess myProcess;
+ myProcess.start(KdenliveSettings::rendererpath(), parameters);
+ myProcess.waitForStarted();
+ int result = -1;
+ while (myProcess.state() != QProcess::NotRunning) {
+ // building proxy file
+ if (m_abortProxyId.contains(id)) {
+ myProcess.close();
+ myProcess.waitForFinished();
+ m_abortProxyId.removeAll(id);
+ QFile::remove(path);
+ setProxyStatus(id, NOPROXY);
+ result = -2;
+
+ }
+ myProcess.waitForFinished(500);
+ }
+ myProcess.waitForFinished();
+ if (result == -1) result = myProcess.exitStatus();
+ if (result == 0) {
+ // proxy successfully created
+ setProxyStatus(id, PROXYDONE);
+ slotGotProxy(id);
+ }
+ else if (result == 1) {
+ // Proxy process crashed
+ QFile::remove(path);
+ setProxyStatus(id, PROXYCRASHED);
+ }
+
+ }
+
if (item->clipType() == IMAGE) {
// Image proxy
QImage i(url);
if (listItem->type() == PROJECTCLIPTYPE) {
ProjectItem *item = static_cast <ProjectItem*>(listItem);
CLIPTYPE t = item->clipType();
- if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE) && item->referencedClip()) {
+ if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE || t == PLAYLIST) && item->referencedClip()) {
oldProps = item->referencedClip()->properties();
if (doProxy) {
newProps.clear();