+ parameters.append(QString("real_time=-%1").arg(KdenliveSettings::mltthreads()));
+
+ //TODO: currently, when rendering an xml file through melt, the display ration is lost, so we enforce it manualy
+ double display_ratio = KdenliveDoc::getDisplayRatio(info.src);
+ parameters << "aspect=" + QString::number(display_ratio);
+
+ //kDebug()<<"TRANSCOD: "<<parameters;
+ QProcess myProcess;
+ myProcess.setProcessChannelMode(QProcess::MergedChannels);
+ myProcess.start(KdenliveSettings::rendererpath(), parameters);
+ myProcess.waitForStarted();
+ int result = -1;
+ int duration = 0;
+ while (myProcess.state() != QProcess::NotRunning) {
+ // building proxy file
+ if (m_abortProxy.contains(info.dest) || m_abortAllProxies) {
+ myProcess.close();
+ myProcess.waitForFinished();
+ QFile::remove(info.dest);
+ m_abortProxy.removeAll(info.dest);
+ m_processingProxy.removeAll(info.dest);
+ for (int i = 0; i < processingItems.count(); i++)
+ setProxyStatus(processingItems.at(i), NOPROXY);
+ result = -2;
+ }
+ else {
+ QString log = QString(myProcess.readAll());
+ processLogInfo(processingItems, &duration, log);
+ }
+ myProcess.waitForFinished(500);
+ }
+ myProcess.waitForFinished();
+ m_processingProxy.removeAll(info.dest);
+ if (result == -1) result = myProcess.exitStatus();
+ if (result == 0) {
+ // proxy successfully created
+ for (int i = 0; i < processingItems.count(); i++)
+ setProxyStatus(processingItems.at(i), PROXYDONE);
+ slotGotProxy(info.dest);
+ }
+ else if (result == 1) {
+ // Proxy process crashed
+ QFile::remove(info.dest);
+ for (int i = 0; i < processingItems.count(); i++)
+ setProxyStatus(processingItems.at(i), PROXYCRASHED);
+ }
+ continue;
+ }
+
+ if (info.type == IMAGE) {
+ // Image proxy
+ QImage i(info.src);
+ if (i.isNull()) {
+ // Cannot load image
+ for (int i = 0; i < processingItems.count(); i++)
+ setProxyStatus(processingItems.at(i), PROXYCRASHED);
+ continue;
+ }
+ QImage proxy;
+ // Images are scaled to profile size.
+ //TODO: Make it be configurable?
+ if (i.width() > i.height()) proxy = i.scaledToWidth(m_render->frameRenderWidth());
+ else proxy = i.scaledToHeight(m_render->renderHeight());
+ if (info.exif > 1) {
+ // Rotate image according to exif data
+ QImage processed;
+ QMatrix matrix;
+
+ switch ( info.exif ) {
+ case 2:
+ matrix.scale( -1, 1 );
+ break;
+ case 3:
+ matrix.rotate( 180 );
+ break;
+ case 4:
+ matrix.scale( 1, -1 );
+ break;
+ case 5:
+ matrix.rotate( 270 );
+ matrix.scale( -1, 1 );
+ break;
+ case 6:
+ matrix.rotate( 90 );
+ break;
+ case 7:
+ matrix.rotate( 90 );
+ matrix.scale( -1, 1 );
+ break;
+ case 8:
+ matrix.rotate( 270 );
+ break;
+ }
+ processed = proxy.transformed( matrix );
+ processed.save(info.dest);
+ }
+ else proxy.save(info.dest);
+ for (int i = 0; i < processingItems.count(); i++)
+ setProxyStatus(processingItems.at(i), PROXYDONE);
+ slotGotProxy(info.dest);
+ m_abortProxy.removeAll(info.dest);
+ m_processingProxy.removeAll(info.dest);
+ continue;
+ }