}
}
}
- m_document->renderer()->unlockService(tractor);
for (int i = 0; i < clipList.count(); i++)
clipList.at(i)->refreshClip(true, true);
- if (baseClip) {
- baseClip->cleanupProducers();
- }
+ m_document->renderer()->unlockService(tractor);
}
ClipItem *CustomTrackView::getClipItemAtEnd(GenTime pos, int track)
return m_videoOnlyProducer;
}
+Mlt::Producer *DocClipBase::getCloneProducer(Mlt::Producer *source)
+{
+ QMutexLocker locker(&m_producerMutex);
+ if (source == NULL) {
+ for (int i = 0; i < m_baseTrackProducers.count(); i++) {
+ if (m_baseTrackProducers.at(i) != NULL) {
+ source = m_baseTrackProducers.at(i);
+ break;
+ }
+ }
+ }
+ if (source) {
+ Mlt::Producer *prod = cloneProducer(source);
+ adjustProducerProperties(prod, getId() + "_monitor", false, false);
+ return prod;
+ }
+ return NULL;
+}
+
Mlt::Producer *DocClipBase::getProducer(int track)
{
QMutexLocker locker(&m_producerMutex);
void setProducer(Mlt::Producer *producer, bool reset = false, bool readPropertiesFromProducer = false);
/** Retrieve a producer for a track */
Mlt::Producer *getProducer(int track = -1);
+ /** Get a copy of the producer, for use in the clip monitor */
+ Mlt::Producer *getCloneProducer(Mlt::Producer *source = NULL);
/** Retrieve the producer that shows only video */
Mlt::Producer *videoProducer();
/** Retrieve the producer that shows only audio */
int ow = frameWidth;
int oh = height;
mlt_image_format format = mlt_image_rgb24a;
- uint8_t *data = frame->get_image(format, ow, oh, 0);
- QImage image((uchar *)data, ow, oh, QImage::Format_ARGB32_Premultiplied);
+
+ const uchar* imagedata = frame->get_image(format, ow, oh);
+ QImage image(imagedata, ow, oh, QImage::Format_ARGB32_Premultiplied);
+
if (!image.isNull()) {
if (ow > (2 * displayWidth)) {
// there was a scaling problem, do it manually
- QImage scaled = image.scaled(displayWidth, height);
- image = scaled.rgbSwapped();
+ image = image.scaled(displayWidth, height).rgbSwapped();
} else {
image = image.scaled(displayWidth, height, Qt::IgnoreAspectRatio).rgbSwapped();
}
m_clipMonitorDock->setObjectName("clip_monitor");
m_clipMonitor = new Monitor("clip", m_monitorManager, QString(), m_timelineArea);
m_clipMonitorDock->setWidget(m_clipMonitor);
- connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint)));
+ connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint)));
+ connect(m_projectList, SIGNAL(raiseClipMonitor()), m_clipMonitor, SLOT(activateMonitor()));
m_projectMonitorDock = new QDockWidget(i18n("Project Monitor"), this);
m_projectMonitorDock->setObjectName("project_monitor");
void MainWindow::slotUpdateClip(const QString &id)
{
if (!m_activeDocument) return;
- m_activeTimeline->projectView()->slotUpdateClip(id);
+ DocClipBase *clip = m_activeDocument->clipManager()->getClipById(id);
+ if (clip->numReferences() > 0) m_activeTimeline->projectView()->slotUpdateClip(id);
+ if (m_clipMonitor->activeClip() && m_clipMonitor->activeClip()->getId() == id) {
+ if (clip) m_clipMonitor->updateClipProducer(clip->getCloneProducer());
+ }
+ if (clip) {
+ clip->cleanupProducers();
+ }
}
void MainWindow::slotConnectMonitors()
{
m_projectList->setRenderer(m_projectMonitor->render);
- //connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
connect(m_projectList, SIGNAL(deleteProjectClips(QStringList, QMap<QString, QString>)), this, SLOT(slotDeleteProjectClips(QStringList, QMap<QString, QString>)));
connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
connect(m_projectList, SIGNAL(showClipProperties(QList <DocClipBase *>, QMap<QString, QString>)), this, SLOT(slotShowClipProperties(QList <DocClipBase *>, QMap<QString, QString>)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QString &, int, int)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QString &, int, int)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QImage &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QImage &)));
- connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool, bool)));
+ connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool, bool)), this, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const stringMap &, const stringMap &, bool, bool)));
connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &, bool)));
- connect(m_projectMonitor->render, SIGNAL(blockClipMonitor(const QString)), this, SLOT(slotBlockClipMonitor(const QString)));
connect(m_projectMonitor->render, SIGNAL(removeInvalidProxy(const QString &, bool)), m_projectList, SLOT(slotRemoveInvalidProxy(const QString &, bool)));
connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(const QString &, bool)), m_projectList, SLOT(slotRefreshClipThumbnail(const QString &, bool)));
break;
}
}
- m_clipMonitor->slotSetXml(NULL);
+ m_clipMonitor->slotSetClipProducer(NULL);
m_timelineArea->removeTab(m_timelineArea->indexOf(w));
if (m_timelineArea->count() == 1) {
m_timelineArea->setTabBarHidden(true);
// Deselect current effect / transition
m_effectStack->slotClipItemSelected(NULL, 0);
m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
- m_clipMonitor->slotSetXml(NULL);
+ m_clipMonitor->slotSetClipProducer(NULL);
bool updateFps = m_activeDocument->setProfilePath(profile);
KdenliveSettings::setCurrent_profile(profile);
KdenliveSettings::setProject_fps(m_activeDocument->fps());
disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_projectMonitor, SLOT(slotSetSelectedClip(Transition*)));
disconnect(m_activeTimeline->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
- disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
+ disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint, const int)));
disconnect(m_activeTimeline, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
disconnect(m_projectList, SIGNAL(loadingIsOver()), m_activeTimeline->projectView(), SLOT(slotUpdateAllThumbs()));
disconnect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
disconnect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
- disconnect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), m_activeTimeline->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
+ disconnect(m_projectList, SIGNAL(clipNeedsReload(const QString&)), this, SLOT(slotUpdateClip(const QString &)));
disconnect(m_projectList, SIGNAL(refreshClip(const QString &)), m_activeTimeline->projectView(), SLOT(slotRefreshThumbs(const QString &)));
m_effectStack->clear();
}
m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
connect(m_projectList, SIGNAL(refreshClip(const QString &, bool)), m_monitorManager, SLOT(slotRefreshCurrentMonitor()));
connect(m_projectList, SIGNAL(refreshClip(const QString &, bool)), trackView->projectView(), SLOT(slotRefreshThumbs(const QString &, bool)));
- connect(m_projectList, SIGNAL(clipNeedsReload(const QString&, bool)), trackView->projectView(), SLOT(slotUpdateClip(const QString &, bool)));
+ connect(m_projectList, SIGNAL(clipNeedsReload(const QString&)),this, SLOT(slotUpdateClip(const QString &)));
connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
connect(m_projectList, SIGNAL(updateProfile(const QString &)), this, SLOT(slotUpdateProjectProfile(const QString &)));
connect(trackView, SIGNAL(setZoom(int)), this, SLOT(slotSetZoom(int)));
connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
- connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
+ connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase *, QPoint, const int)));
connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int, bool)), m_projectMonitor, SLOT(slotSetSelectedClip(ClipItem*)));
delete dia;
}
-void MainWindow::slotBlockClipMonitor(const QString id)
+void MainWindow::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace, bool refreshThumbnail)
{
- if (m_clipMonitor->activeClip() && m_clipMonitor->activeClip()->getId() == id) m_clipMonitor->slotSetXml(NULL);
+ m_projectList->slotReplyGetFileProperties(clipId, producer, properties, metadata, replace, refreshThumbnail);
}
void slotInsertNotesTimecode();
/** @brief Open the project's backupdialog. */
void slotOpenBackupDialog(const KUrl url = KUrl());
- /** @brief Make sure to block clip monitor before deleting a clip's producer. */
- void slotBlockClipMonitor(const QString id);
+ /** @brief Make sure to update clip monitor before deleting a clip's producer. */
+ void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const stringMap &properties, const stringMap &metadata, bool replace, bool refreshThumbnail);
/** @brief Disable proxies for this project. */
void slotDisableProxies();
m_selectedClip(NULL),
m_loopClipTransition(true),
m_editMarker(NULL)
-
{
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
m_playAction->setIcon(m_pauseIcon);
}
-void Monitor::slotSetXml(DocClipBase *clip, QPoint zone, const int position)
+void Monitor::updateClipProducer(Mlt::Producer *prod)
+{
+ if (render == NULL) return;
+ render->setProducer(prod, render->seekFramePosition());
+}
+
+void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, int position)
{
if (render == NULL) return;
if (clip == NULL && m_currentClip != NULL) {
+ kDebug()<<"// SETTING NULL CLIP MONITOR";
m_currentClip = NULL;
m_length = -1;
render->setProducer(NULL, -1);
m_currentClip = clip;
if (m_currentClip) activateMonitor();
updateMarkers(clip);
- if (render->setProducer(clip->getProducer(), position) == -1) {
+ Mlt::Producer *prod = NULL;
+ if (clip) prod = clip->getCloneProducer();
+ if (render->setProducer(prod, position) == -1) {
// MLT CONSUMER is broken
kDebug(QtWarningMsg) << "ERROR, Cannot start monitor";
}
} else {
- if (m_currentClip) activateMonitor();
- if (position != -1) render->seek(position);
+ if (m_currentClip) {
+ activateMonitor();
+ if (position == -1) position = render->seekFramePosition();
+ render->seek(position);
+ }
}
if (!zone.isNull()) {
m_ruler->setZone(zone.x(), zone.y());
/** true if selected clip is transition, false = selected clip is clip.
* Necessary because sometimes we get two signals, e.g. we get a clip and we get selected transition = NULL. */
bool m_loopClipTransition;
+
#if defined(Q_WS_MAC) || defined(USE_OPEN_GL)
VideoGLWidget *m_glWidget;
bool createOpenGlWidget(QWidget *parent, const QString profile);
public slots:
void slotOpenFile(const QString &);
- void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
+ void slotSetClipProducer(DocClipBase *clip, QPoint zone = QPoint(), int position = -1);
+ void updateClipProducer(Mlt::Producer *prod);
void refreshMonitor(bool visible);
void refreshMonitor();
void slotSeek(int pos);
connect(this, SIGNAL(processNextThumbnail()), this, SLOT(slotProcessNextThumbnail()));
connect(m_listView, SIGNAL(projectModified()), this, SIGNAL(projectModified()));
connect(m_listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
- connect(m_listView, SIGNAL(focusMonitor()), this, SLOT(slotClipSelected()));
+ connect(m_listView, SIGNAL(focusMonitor()), this, SIGNAL(raiseClipMonitor()));
connect(m_listView, SIGNAL(pauseMonitor()), this, SLOT(slotPauseMonitor()));
connect(m_listView, SIGNAL(requestMenu(const QPoint &, QTreeWidgetItem *)), this, SLOT(slotContextMenu(const QPoint &, QTreeWidgetItem *)));
connect(m_listView, SIGNAL(addClip()), this, SLOT(slotAddClip()));
item = static_cast <ProjectItem *>(selected.at(i));
if (item && !item->isProxyRunning()) {
DocClipBase *clip = item->referencedClip();
- if (!clip->isClean()) {
- // The clip is currently under processing (replacement in timeline), we cannot reload it now.
+ if (!clip || !clip->isClean() || m_render->isProcessing(item->clipId())) {
+ kDebug()<<"//// TRYING TO RELOAD: "<<item->clipId()<<", but it is busy";
continue;
}
CLIPTYPE t = item->clipType();
e.setAttribute("length", length);
}
}
- if (clip) {
- clip->clearThumbProducer();
- }
m_render->getFileProperties(e, item->clipId(), m_listView->iconSize().height(), true);
+ resetThumbsProducer(clip);
}
}
}
}
item->referencedClip()->setProducer(newProd, true);
item->slotSetToolTip();
- emit clipNeedsReload(id, true);
+ emit clipNeedsReload(id);
}
}
update();
m_listView->processLayout();
QDomElement e = clip->toXML().cloneNode().toElement();
e.removeAttribute("file_hash");
- clip->clearThumbProducer();
m_render->getFileProperties(e, clip->getId(), m_listView->iconSize().height(), true);
+ resetThumbsProducer(clip);
}
else if (item->hasProxy() && !item->isProxyRunning()) {
slotCreateProxy(clip->getId());
{
if (item == NULL || !m_refreshed) return;
DocClipBase *clip = item->referencedClip();
- if (!clip->isClean()) {
- //WARNING: might result in clip said marked as proxy but not using proxy?
- // The clip is currently under processing (replacement in timeline), we cannot reload it now.
- return;
- }
// Proxy clip successfully created
QDomElement e = clip->toXML().cloneNode().toElement();
e.setAttribute("length", length);
}
}
- clip->clearThumbProducer();
m_render->getFileProperties(e, clip->getId(), m_listView->iconSize().height(), true);
}
xml.removeAttribute("proxy_out");
}
bool replace = xml.attribute("replace") == "1";
- if (replace) clip->clearThumbProducer();
m_render->getFileProperties(xml, clip->getId(), m_listView->iconSize().height(), replace);
+ if (replace) resetThumbsProducer(clip);
}
else {
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
slotProcessNextThumbnail();
}
+void ProjectList::resetThumbsProducer(DocClipBase *clip)
+{
+ if (!clip) return;
+ clip->clearThumbProducer();
+ m_thumbnailQueue.removeAll(clip->getId());
+}
+
void ProjectList::slotProcessNextThumbnail()
{
if (m_render->processingItems() > 0) {
if (m_listView->currentItem() && m_listView->currentItem()->type() != PROJECTFOLDERTYPE) {
ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
DocClipBase *clip = item->referencedClip();
- if (clip && clip->isClean()) emit clipSelected(clip);
+ if (clip && clip->isClean() && !m_render->isProcessing(item->clipId())) emit clipSelected(clip);
}
}
}
}
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDropEnabled);
}
- clip->setProducer(producer, replace);
item->setProperties(properties, metadata);
+ clip->setProducer(producer, replace);
clip->askForAudioThumbs();
if (refreshThumbnail) getCachedThumbnail(item);
// Proxy stuff
processNextThumbnail();
}
if (replace && item) {
- if (item->numReferences() > 0) toReload = clipId;
- else item->referencedClip()->cleanupProducers();
+ toReload = clipId;
// update clip in clip monitor
- if (queue == 0 && item->isSelected() && m_listView->selectedItems().count() == 1)
- m_refreshMonitorTimer.start();
+ /*if (queue == 0 && item->isSelected() && m_listView->selectedItems().count() == 1)
+ m_refreshMonitorTimer.start();*/
}
if (!item) {
// no item for producer, delete it
delete producer;
}
if (!toReload.isEmpty())
- emit clipNeedsReload(toReload, true);
+ emit clipNeedsReload(toReload);
}
bool ProjectList::adjustProjectProfileToItem(ProjectItem *item)
CLIPTYPE t = item->clipType();
if ((t == VIDEO || t == AV || t == UNKNOWN || t == IMAGE || t == PLAYLIST) && item->referencedClip()) {
if ((doProxy && item->hasProxy()) || (!doProxy && !item->hasProxy())) continue;
- oldProps = item->referencedClip()->properties();
+ DocClipBase *clip = item->referencedClip();
+ if (!clip->isClean() || m_render->isProcessing(item->clipId())) continue;
+ resetThumbsProducer(clip);
+ oldProps = clip->properties();
if (doProxy) {
newProps.clear();
- QString path = proxydir + item->referencedClip()->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension"));
+ QString path = proxydir + clip->getClipHash() + "." + (t == IMAGE ? "png" : m_doc->getDocumentProperty("proxyextension"));
// insert required duration for proxy
- newProps.insert("proxy_out", item->referencedClip()->producerProperty("out"));
+ newProps.insert("proxy_out", clip->producerProperty("out"));
newProps.insert("proxy", path);
// We need to insert empty proxy so that undo will work
oldProps.insert("proxy", QString());
void setThumbnail(const QString &clipId, const QPixmap &pix);
/** @brief Get cached thumbnail for a project's clip or create it if no cache. */
void getCachedThumbnail(ProjectItem *item);
+ /** @brief The clip is about to be reloaded, cancel thumbnail requests. */
+ void resetThumbsProducer(DocClipBase *clip);
private slots:
void slotClipSelected();
void loadingIsOver();
void displayMessage(const QString, int progress);
void clipNameChanged(const QString, const QString);
- void clipNeedsReload(const QString&, bool);
+ void clipNeedsReload(const QString&);
/** @brief A property affecting display was changed, so we need to update monitors and thumbnails
* @param id: The clip's id string
* @param resetThumbs Should we recreate the timeline thumbnails. */
/** @brief Request a profile change for current document. */
void updateProfile(const QString &);
void processNextThumbnail();
+ /** @brief Activate the clip monitor. */
+ void raiseClipMonitor();
};
#endif
info.imageHeight = imageHeight;
info.replaceProducer = replaceProducer;
// Make sure we don't request the info for same clip twice
+ m_infoMutex.lock();
m_requestList.removeAll(info);
m_requestList.append(info);
+ m_infoMutex.unlock();
if (!m_infoThread.isRunning())
m_infoThread = QtConcurrent::run(this, &Render::processFileProperties);
}
return count;
}
+bool Render::isProcessing(const QString &id)
+{
+ if (m_processingClipId == id) return true;
+ m_infoMutex.lock();
+ for (int i = 0; i < m_requestList.count(); i++) {
+ requestClipInfo info = m_requestList.at(i);
+ if (info.clipId == id) {
+ m_infoMutex.unlock();
+ return true;
+ }
+ }
+ m_infoMutex.unlock();
+ return false;
+}
+
void Render::processFileProperties()
{
requestClipInfo info;
m_infoMutex.lock();
info = m_requestList.takeFirst();
m_infoMutex.unlock();
- if (info.replaceProducer) emit blockClipMonitor(info.clipId);
+ m_processingClipId = info.clipId;
QString path;
bool proxyProducer;
if (info.xml.hasAttribute("proxy") && info.xml.attribute("proxy") != "-") {
}
else emit removeInvalidClip(info.clipId, info.replaceProducer);
delete producer;
+ m_processingClipId.clear();
continue;
}
// Proxy file length is different than original clip length, this will corrupt project so disable this proxy clip
emit removeInvalidProxy(info.clipId, true);
delete producer;
+ m_processingClipId.clear();
continue;
}
}
if ((!info.replaceProducer && info.xml.hasAttribute("file_hash")) || proxyProducer) {
// Clip already has all properties
emit replyGetFileProperties(info.clipId, producer, stringMap(), stringMap(), info.replaceProducer, true);
+ m_processingClipId.clear();
continue;
}
variance = -1;
}
} while (variance == -1);
+ delete frame;
if (frameNumber > -1) filePropertyMap["thumbnail"] = frameNumber;
emit replyGetImage(info.clipId, img);
} else if (frame->get_int("test_audio") == 0) {
filePropertyMap["type"] = "audio";
}
}
- delete frame;
// Retrieve audio / video codec name
// If there is a
producer->seek(0);
emit replyGetFileProperties(info.clipId, producer, filePropertyMap, metadataPropertyMap, info.replaceProducer);
}
+ m_processingClipId.clear();
}
int Render::setProducer(Mlt::Producer *producer, int position)
{
- kDebug()<<"//////////\n SET CLIP PRODUCER \n//////////";
QMutexLocker locker(&m_mutex);
+ QString currentId;
+ int consumerPosition = 0;
if (m_winid == -1) return -1;
if (m_mltConsumer) {
+ consumerPosition = m_mltConsumer->position();
if (!m_mltConsumer->is_stopped()) {
m_mltConsumer->stop();
m_mltConsumer->purge();
}
if (m_mltProducer) {
+ currentId = m_mltProducer->get("id");
m_mltProducer->set_speed(0);
delete m_mltProducer;
m_mltProducer = NULL;
}
blockSignals(true);
if (producer && producer->is_valid()) {
- m_mltProducer = new Mlt::Producer(producer->get_producer());
+ m_mltProducer = producer;
} else m_mltProducer = m_blackClip->cut(0, 1);
if (!m_mltProducer || !m_mltProducer->is_valid()) {
kDebug() << " WARNING - - - - -INVALID PLAYLIST: ";
return -1;
}
+ if (position == -1 && m_mltProducer->get("id") == currentId) position = consumerPosition;
+ if (position != -1) m_mltProducer->seek(position);
int volume = KdenliveSettings::volume();
m_mltProducer->set("meta.volume", (double)volume / 100);
m_fps = m_mltProducer->get_fps();
return error;
}
- if (position != -1) {
- m_mltProducer->seek(position);
- emit rendererPosition(position);
- } else emit rendererPosition((int) m_mltProducer->position());
+ emit rendererPosition((int) m_mltProducer->position());
return error;
}
kDebug() << "----- BROKEN MONITOR: " << m_name << ", RESTART";
return;
}
+
if (m_mltConsumer && m_mltConsumer->is_stopped()) {
if (m_mltConsumer->start() == -1) {
//KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
m_mltProducer->set_speed(1.0);
} else if (!play) {
m_mltConsumer->set("refresh", 0);
- stop();
m_mltProducer->seek(m_mltConsumer->position());
+ stop();
//emitConsumerStopped();
/*m_mltConsumer->set("refresh", 0);
m_mltConsumer->stop();
int Render::seekFramePosition() const
{
- if (m_mltProducer) return (int) m_mltProducer->position();
+ //if (m_mltProducer) return (int) m_mltProducer->position();
+ if (m_mltConsumer) return (int) m_mltConsumer->position();
return 0;
}
void Render::unlockService(Mlt::Tractor *tractor)
{
- if (tractor) delete tractor;
+ if (tractor) {
+ delete tractor;
+ }
if (!m_mltProducer) return;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) {
void seek(GenTime time);
void seek(int time);
void seekToFrameDiff(int diff);
- int m_isBlocked;
QPixmap getImageThumbnail(KUrl url, int width, int height);
int processingItems() const;
/** @brief Force processing of clip with selected id. */
void forceProcessing(const QString &id);
+ /** @brief Are we currently processing clip with selected id. */
+ bool isProcessing(const QString &id);
/** @brief Requests the file properties for the specified URL (will be put in a queue list)
@param xml The xml parameters for the clip
void mltPasteEffects(Mlt::Producer *source, Mlt::Producer *dest);
QMap<QString, QString> mltGetTransitionParamsFromXml(QDomElement xml);
QMap<QString, Mlt::Producer *> m_slowmotionProducers;
+ /** @brief The id of the clip that is currently being loaded for info query */
+ QString m_processingClipId;
/** @brief Build the MLT Consumer object with initial settings.
* @param profileName The MLT profile to use for the consumer */
*/
void removeInvalidProxy(const QString &id, bool durationError);
void refreshDocumentProducers(bool displayRatioChanged, bool fpsChanged);
-
- /** @brief If we will delete the producer, make sure to pause the monitor */
- void blockClipMonitor(const QString &);
/** @brief A frame's image has to be shown.
*