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;
void Render::getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer, bool selectClip)
{
QString path;
- if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") path = xml.attribute("proxy");
- else path = xml.attribute("resource");
-
-
+ bool proxyProducer;
+ if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") {
+ path = xml.attribute("proxy");
+ proxyProducer = true;
+ }
+ else {
+ path = xml.attribute("resource");
+ proxyProducer = false;
+ }
+
+
KUrl url = KUrl(path);
Mlt::Producer *producer = NULL;
CLIPTYPE type = (CLIPTYPE)xml.attribute("type").toInt();
producer = new Mlt::Producer(*m_mltProfile, url.path().toUtf8().constData());
}
+
if (producer == NULL || producer->is_blank() || !producer->is_valid()) {
kDebug() << " / / / / / / / / ERROR / / / / // CANNOT LOAD PRODUCER: ";
- if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") {
+ if (proxyProducer) {
// Proxy file is corrupted
- emit removeInvalidProxy(clipId);
+ emit removeInvalidProxy(clipId, false);
}
else emit removeInvalidClip(clipId, replaceProducer);
delete producer;
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);
+ delete producer;
+ return;
+ }
+
if (xml.hasAttribute("force_aspect_ratio")) {
double aspect = xml.attribute("force_aspect_ratio").toDouble();
if (aspect > 0) producer->set("force_aspect_ratio", aspect);
int full_luma = xml.attribute("full_luma").toInt();
if (full_luma != 0) producer->set("set.force_full_luma", full_luma);
}
-
+
int clipOut = 0;
int duration = 0;
if (xml.hasAttribute("out")) clipOut = xml.attribute("out").toInt();
-
+
// setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) {
int length;
variance = KThumb::imageVariance(image);
} else
pix.fill(Qt::black);
-
+
if (frameNumber == 0 && variance < 6) {
// Thumbnail is not interesting (for example all black, seek to fetch better thumb
frameNumber = 100;
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);
if (!params.paramValue("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle" || params.hasParam("region")) {
// This is a keyframe effect, to edit it, we remove it and re-add it.
bool success = mltRemoveEffect(track, position, index, false);
- if (!success) kDebug() << "// ERROR Removing effect : " << index;
- if (position < GenTime()) success = mltAddTrackEffect(track, params);
- else success = mltAddEffect(track, position, params);
- if (!success) kDebug() << "// ERROR Adding effect : " << index;
+// if (!success) kDebug() << "// ERROR Removing effect : " << index;
+ if (position < GenTime())
+ success = mltAddTrackEffect(track, params);
+ else
+ success = mltAddEffect(track, position, params);
+// if (!success) kDebug() << "// ERROR Adding effect : " << index;
return success;
}
if (position < GenTime()) {
return false;
}
- Mlt::Service clipService(clip->get_service());
int duration = clip->get_playtime();
bool doRefresh = true;
// Check if clip is visible in monitor
int diff = trackPlaylist.clip_start(clipIndex) + duration - m_mltProducer->position();
- if (diff < 0 || diff > duration) doRefresh = false;
- delete clip;
+ if (diff < 0 || diff > duration)
+ doRefresh = false;
m_isBlocked = true;
int ct = 0;
- /* kDebug() << "EDITING FILTER: "<<index <<", "<<tag;
- kDebug() << "EFFect stack: ++++++++++++++++++++++++++";
- while (filter) {
- kDebug() << "Filter: "<< filter->get("kdenlive_id") <<", IX: "<<filter->get("kdenlive_ix");
- ct++;
- filter = clipService.filter(ct);
- }
- kDebug() << "++++++++++++++++++++++++++";
- ct = 0;
- filter = clipService.filter(ct); */
- Mlt::Filter *filter = clipService.filter(ct);
+ Mlt::Filter *filter = clip->filter(ct);
while (filter) {
if (filter->get_int("kdenlive_ix") == index.toInt()) {
break;
}
ct++;
- filter = clipService.filter(ct);
+ filter = clip->filter(ct);
}
if (!filter) {
for (int j = 0; j < params.count(); j++) {
filter->set((prefix + params.at(j).name()).toUtf8().constData(), params.at(j).value().toUtf8().constData());
}
+
+ if (params.paramValue("id") == "pan_zoom")
+ filter->set_in_and_out(clip->get_in(), clip->get_out() + 1);
+
+ delete clip;
mlt_service_unlock(service.get_service());
m_isBlocked = false;