}
Render::Render(const QString & rendererName, int winid, QString profile, QWidget *parent) :
- QObject(parent),
+ AbstractRender(parent),
m_isBlocked(0),
analyseAudio(KdenliveSettings::monitor_audio()),
- sendFrameForAnalysis(false),
m_name(rendererName),
m_mltConsumer(NULL),
m_mltProducer(NULL),
return m_mltProfile->height();
}
-QImage Render::extractFrame(int frame_position, int width, int height)
+QImage Render::extractFrame(int frame_position, QString path, int width, int height)
{
if (width == -1) {
width = renderWidth();
height = renderHeight();
} else if (width % 2 == 1) width++;
- if (!m_mltProducer) {
+ if (!path.isEmpty()) {
+ Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile, path.toUtf8().constData());
+ if (producer) {
+ if (producer->is_valid()) {
+ QImage img = KThumb::getFrame(producer, frame_position, width, height);
+ delete producer;
+ return img;
+ }
+ else delete producer;
+ }
+ }
+
+ if (!m_mltProducer || !path.isEmpty()) {
QImage pix(width, height, QImage::Format_RGB32);
pix.fill(Qt::black);
return pix;
return;
}
- if (proxyProducer && xml.hasAttribute("proxy_out") && producer->get_out() != xml.attribute("proxy_out").toInt()) {
- // Proxy file length is different than original clip length, this will corrupt project so disable this proxy clip
- emit removeInvalidProxy(clipId, true);
+ if (proxyProducer && xml.hasAttribute("proxy_out")) {
+ producer->set("out", xml.attribute("proxy_out").toInt());
+ if (producer->get_out() != xml.attribute("proxy_out").toInt()) {
+ // Proxy file length is different than original clip length, this will corrupt project so disable this proxy clip
+ emit removeInvalidProxy(clipId, true);
+ delete producer;
+ return;
+ }
}
if (xml.hasAttribute("force_aspect_ratio")) {
if (m_mltProducer == NULL) return;
if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
kDebug() << "///////////// RENDER STOPPED: " << m_name;
- m_isBlocked = true;
//m_mltConsumer->set("refresh", 0);
m_mltConsumer->stop();
// delete m_mltConsumer;
if (strobe > 1) url.append("&strobe=" + QString::number(strobe));
Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
if (!slowprod || slowprod->get_producer() == NULL) {
- slowprod = new Mlt::Producer(*m_mltProfile, "framebuffer", url.toUtf8().constData());
+ slowprod = new Mlt::Producer(*m_mltProfile, 0, ("framebuffer:" + url).toUtf8().constData());
if (strobe > 1) slowprod->set("strobe", strobe);
QString id = prod->get("id");
if (id.contains('_')) id = id.section('_', 0, 0);
// create filter
QString tag = params.paramValue("tag");
kDebug() << " / / INSERTING EFFECT: " << tag << ", REGI: " << region;
- if (tag.startsWith("ladspa")) tag = "ladspa";
char *filterTag = qstrdup(tag.toUtf8().constData());
char *filterId = qstrdup(params.paramValue("id").toUtf8().constData());
QHash<QString, QString>::Iterator it;
}
}
+Mlt::Producer* Render::getProducer()
+{
+ return m_mltProducer;
+}
+
#include "renderer.moc"