}
}
-void ClipManager::resetProducersList(const QList <Mlt::Producer *> prods, bool displayRatioChanged)
+void ClipManager::resetProducersList(const QList <Mlt::Producer *> prods, bool displayRatioChanged, bool fpsChanged)
{
for (int i = 0; i < m_clipList.count(); i++) {
- if (m_clipList.at(i)->numReferences() > 0) {
+ if (m_clipList.at(i)->numReferences() > 0 || displayRatioChanged || fpsChanged) {
m_clipList.at(i)->deleteProducers(true);
}
}
if (id.contains('_')) id = id.section('_', 0, 0);
DocClipBase *clip = getClipById(id);
if (clip) {
- clip->setProducer(prods.at(i));
+ clip->setProducer(prods.at(i), false, true);
}
}
- emit checkAllClips(displayRatioChanged);
+ emit checkAllClips(displayRatioChanged, fpsChanged);
}
void ClipManager::slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId)
void askForAudioThumb(const QString &id);
QString projectFolder() const;
void clearUnusedProducers();
- void resetProducersList(const QList <Mlt::Producer *> prods, bool displayRatioChanged);
+ void resetProducersList(const QList <Mlt::Producer *> prods, bool displayRatioChanged, bool fpsChanged);
void addFolder(const QString&, const QString&);
void deleteFolder(const QString&);
void clear();
void modifiedClip(const QString &);
void missingClip(const QString &);
void availableClip(const QString &);
- void checkAllClips(bool displayRatioChanged);
+ void checkAllClips(bool displayRatioChanged, bool fpsChanged);
};
#endif
m_placeHolder = false;
}
-void DocClipBase::setProducer(Mlt::Producer *producer, bool reset)
+void DocClipBase::setProducer(Mlt::Producer *producer, bool reset, bool readPropertiesFromProducer)
{
if (producer == NULL || (m_placeHolder && !reset)) return;
if (m_thumbProd && (reset || !m_thumbProd->hasProducer())) m_thumbProd->setProducer(producer);
deleteProducers(false);
}
QString id = producer->get("id");
+ bool updated = false;
if (id.contains('_')) {
// this is a subtrack producer, insert it at correct place
id = id.section('_', 1);
m_audioTrackProducers.append(NULL);
}
}
- if (m_audioTrackProducers.at(pos) == NULL) m_audioTrackProducers[pos] = producer;
+ if (m_audioTrackProducers.at(pos) == NULL) {
+ m_audioTrackProducers[pos] = producer;
+ updated = true;
+ }
return;
} else if (id.endsWith("video")) {
- m_videoOnlyProducer = producer;
+ if (m_videoOnlyProducer == NULL) {
+ m_videoOnlyProducer = producer;
+ updated = true;
+ }
return;
}
int pos = id.toInt();
m_baseTrackProducers.append(NULL);
}
}
- if (m_baseTrackProducers.at(pos) == NULL) m_baseTrackProducers[pos] = producer;
+ if (m_baseTrackProducers.at(pos) == NULL) {
+ m_baseTrackProducers[pos] = producer;
+ updated = true;
+ }
} else {
- if (m_baseTrackProducers.isEmpty()) m_baseTrackProducers.append(producer);
- else if (m_baseTrackProducers.at(0) == NULL) m_baseTrackProducers[0] = producer;
+ if (m_baseTrackProducers.isEmpty()) {
+ m_baseTrackProducers.append(producer);
+ updated = true;
+ }
+ else if (m_baseTrackProducers.at(0) == NULL) {
+ m_baseTrackProducers[0] = producer;
+ updated = true;
+ }
}
+ if (updated && readPropertiesFromProducer)
+ setDuration(GenTime(producer->get_length(), KdenliveSettings::project_fps()));
//m_clipProducer = producer;
//m_clipProducer->set("transparency", m_properties.value("transparency").toInt());
}
}
/** Sets producers for the current clip (one for each track due to a limitation in MLT's track mixing */
- void setProducer(Mlt::Producer *producer, bool reset = false);
+ void setProducer(Mlt::Producer *producer, bool reset = false, bool readPropertiesFromProducer = false);
/** Retrieve a producer for a track */
Mlt::Producer *producer(int track = -1);
/** Retrieve the producer that shows only video */
emit progressInfo(QString(), -1);
}*/
-void KdenliveDoc::checkProjectClips(bool displayRatioChanged)
+void KdenliveDoc::checkProjectClips(bool displayRatioChanged, bool fpsChanged)
{
if (m_render == NULL) return;
- m_clipManager->resetProducersList(m_render->producersList(), displayRatioChanged);
+ m_clipManager->resetProducersList(m_render->producersList(), displayRatioChanged, fpsChanged);
}
Render *KdenliveDoc::renderer()
/** @brief Sets the document as modified or up to date.
* @param mod (optional) true if the document has to be saved */
void setModified(bool mod = true);
- void checkProjectClips(bool displayRatioChanged = false);
+ void checkProjectClips(bool displayRatioChanged = false, bool fpsChanged = false);
private slots:
void slotAutoSave();
disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
disconnect(m_projectList, SIGNAL(updateProfile(const QString &)), this, SLOT(slotUpdateProjectProfile(const QString &)));
- disconnect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers(bool)), m_activeDocument, SLOT(checkProjectClips(bool)));
+ disconnect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers(bool, bool)), m_activeDocument, SLOT(checkProjectClips(bool, bool)));
disconnect(m_activeDocument, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
- connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers(bool)), doc, SLOT(checkProjectClips(bool)));
+ connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers(bool, bool)), doc, SLOT(checkProjectClips(bool, bool)));
connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
connect(doc, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
monitorItemEditing(true);
}
-void ProjectList::updateAllClips(bool displayRatioChanged)
+void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged)
{
m_listView->setSortingEnabled(false);
item = static_cast <ProjectItem *>(*it);
clip = item->referencedClip();
if (item->referencedClip()->producer() == NULL) {
- if (clip->isPlaceHolder() == false)
- requestClipInfo(clip->toXML(), clip->getId());
+ if (clip->isPlaceHolder() == false) {
+ QDomElement xml = clip->toXML();
+ if (fpsChanged) {
+ xml.removeAttribute("out");
+ xml.removeAttribute("file_hash");
+ xml.removeAttribute("proxy_out");
+ }
+ requestClipInfo(xml, clip->getId());
+ }
else {
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
if (item->data(0, Qt::DecorationRole).isNull()) {
connect(m_doc->clipManager(), SIGNAL(modifiedClip(const QString &)), this, SLOT(slotModifiedClip(const QString &)));
connect(m_doc->clipManager(), SIGNAL(missingClip(const QString &)), this, SLOT(slotMissingClip(const QString &)));
connect(m_doc->clipManager(), SIGNAL(availableClip(const QString &)), this, SLOT(slotAvailableClip(const QString &)));
- connect(m_doc->clipManager(), SIGNAL(checkAllClips(bool)), this, SLOT(updateAllClips(bool)));
+ connect(m_doc->clipManager(), SIGNAL(checkAllClips(bool, bool)), this, SLOT(updateAllClips(bool, bool)));
}
QList <DocClipBase*> ProjectList::documentClipList() const
public slots:
void setDocument(KdenliveDoc *doc);
- void updateAllClips(bool displayRatioChanged);
+ void updateAllClips(bool displayRatioChanged, bool fpsChanged);
void slotReplyGetImage(const QString &clipId, const QPixmap &pix);
void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata, bool replace, bool selectClip);
void slotAddClip(DocClipBase *clip, bool getProperties);
//kDebug() << "//RESET WITHSCENE: " << scene;
setSceneList(scene, pos);
// producers have changed (different profile), so reset them...
- emit refreshDocumentProducers(new_dar != current_dar);
+ emit refreshDocumentProducers(new_dar != current_dar, current_fps != new_fps);
/*Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile , "xml-string", scene.toUtf8().constData());
m_mltProducer = producer;
m_blackClip = new Mlt::Producer(*m_mltProfile , "colour", "black");
proxyProducer = false;
}
-
KUrl url = KUrl(path);
Mlt::Producer *producer = NULL;
CLIPTYPE type = (CLIPTYPE)xml.attribute("type").toInt();
tractor.removeChild(track);
//kDebug() << "/////////// RESULT SCENE: \n" << doc.toString();
setSceneList(doc.toString(), m_framePosition);
- emit refreshDocumentProducers(false);
+ emit refreshDocumentProducers(false, false);
}
* @param durationError Should be set to true if the proxy failed because it has not same length as original clip
*/
void removeInvalidProxy(const QString &id, bool durationError);
- void refreshDocumentProducers(bool displayRatioChanged);
+ void refreshDocumentProducers(bool displayRatioChanged, bool fpsChanged);
/** @brief A frame's image has to be shown.
*