Commits

Jean-Baptiste Mardelle  committed f3bca80

Add reverse clip to clip actions: http://kdenlive.org/mantis/view.php?id=2933

  • Participants
  • Parent commits 08614d7

Comments (0)

Files changed (4)

File src/dvdwizardmenu.cpp

 	QString profileName = DvdWizardVob::getDvdProfile(m_format);
 	Mlt::Profile profile(profileName.toUtf8().constData());
 	profile.set_explicit(true);
-	Mlt::Producer *producer = new Mlt::Producer(profile, m_view.background_image->url().path().toUtf8().data());
+	Mlt::Producer *producer = new Mlt::Producer(profile, m_view.background_image->url().path().toUtf8().constData());
 	if (producer && producer->is_valid()) {
 	    pix = QPixmap::fromImage(KThumb::getFrame(producer, 0, m_finalSize.width(), m_width, m_height));
 	    m_movieLength = producer->get_length();

File src/mainwindow.cpp

 			    connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
 			}
 		}
+		if (KdenliveSettings::producerslist().contains("framebuffer")) {
+			QAction *action=actionMenu->addAction(i18n("Reverse clip"));
+			action->setData("framebuffer");
+			connect(action,SIGNAL(triggered()), this, SLOT(slotStartClipAction()));
+		}
 	}
 
 }

File src/projectlist.cpp

     else {
         destination = ids.values();
     }
+    if (filterName == "framebuffer") {
+	Mlt::Profile profile;
+	QStringList keys = ids.keys();
+	int ix = 0;
+	foreach(const QString &url, destination) {
+	    QString prodstring = QString("framebuffer:" + url + "?-1");
+	    Mlt::Producer *reversed = new Mlt::Producer(profile, prodstring.toUtf8().constData());
+	    if (!reversed || !reversed->is_valid()) {
+		emit displayMessage(i18n("Cannot reverse clip"), -2, ErrorMessage);
+		continue;
+	    }
+	    QString dest = url + ".mlt";
+	    if (QFile::exists(dest)) {
+		if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", dest)) == KMessageBox::No) continue;
+	    }
+	    Mlt::Consumer *cons = new Mlt::Consumer(profile, "xml", dest.toUtf8().constData());
+	    if (cons == NULL || !cons->is_valid()) {
+		emit displayMessage(i18n("Cannot render reversed clip"), -2, ErrorMessage);
+		continue;
+	    }
+	    Mlt::Playlist list;
+	    list.insert_at(0, reversed, 0);
+	    delete reversed;
+	    cons->connect(list);
+	    cons->run();
+	    delete cons;
+	    QString groupId;
+	    QString groupName;
+	    DocClipBase *base = m_doc->clipManager()->getClipById(keys.at(ix));
+	    if (base) {
+		groupId = base->getProperty("groupid");
+		groupName = base->getProperty("groupname");
+	    }
+	    emit addClip(dest, groupId, groupName);
+	    ix++;
+	}
+	return;
+    }
     
     if (filterName == "motion_est") {
 	// Show config dialog

File src/projectlist.h

 #else
 // Dummy KMessageWidget to allow compilation of MyMessageWidget class since Qt's moc doesn work inside #ifdef
 #include <QLabel>
+
 class KMessageWidget: public QLabel
 {
 public: