Commit 033fd5b4 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Refactoring step 1 part 3:

Remove almost all calls to DocClipBase (now replaced by ProjectClip and ClipController)
Fix most timeline crashes
parent ba65793f
......@@ -35,8 +35,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
ProjectClip::ProjectClip(const QString &id, ClipController *controller, ProjectFolder* parent) :
AbstractProjectItem(AbstractProjectItem::ClipItem, id, parent),
m_controller(controller)
AbstractProjectItem(AbstractProjectItem::ClipItem, id, parent)
, m_controller(controller)
, audioFrameCache()
, m_audioThumbCreated(false)
{
m_properties = QMap <QString, QString> ();
m_name = m_controller->clipName();
......@@ -49,6 +51,8 @@ ProjectClip::ProjectClip(const QString &id, ClipController *controller, ProjectF
ProjectClip::ProjectClip(const QDomElement& description, ProjectFolder* parent) :
AbstractProjectItem(AbstractProjectItem::ClipItem, description, parent)
, m_controller(NULL)
, audioFrameCache()
, m_audioThumbCreated(false)
{
Q_ASSERT(description.hasAttribute("id"));
m_properties = QMap <QString, QString> ();
......@@ -78,6 +82,25 @@ QString ProjectClip::getXmlProperty(const QDomElement &producer, const QString &
return value;
}
void ProjectClip::updateAudioThumbnail(const audioByteArray& data)
{
////qDebug() << "CLIPBASE RECIEDVED AUDIO DATA*********************************************";
audioFrameCache = data;
m_audioThumbCreated = true;
emit gotAudioData();
}
QList < CommentedTime > ProjectClip::commentedSnapMarkers() const
{
if (m_controller) return m_controller->commentedSnapMarkers();
return QList < CommentedTime > ();
}
bool ProjectClip::audioThumbCreated() const
{
return m_audioThumbCreated;
}
ClipType ProjectClip::clipType() const
{
if (m_controller == NULL) return Unknown;
......@@ -121,12 +144,12 @@ bool ProjectClip::hasLimitedDuration() const
return m_hasLimitedDuration;
}
int ProjectClip::duration() const
GenTime ProjectClip::duration() const
{
if (m_controller) {
return m_controller->getPlaytime();
}
return -1;
return GenTime();
}
QString ProjectClip::serializeClip()
......@@ -224,7 +247,7 @@ Mlt::Producer *ProjectClip::producer()
return m_controller->masterProducer();
}
bool ProjectClip::hasProducer() const
bool ProjectClip::isReady() const
{
return m_controller!= NULL;
}
......@@ -292,8 +315,16 @@ void ProjectClip::setProducerProperty(const char *name, const char *data)
}
}
int ProjectClip::getProducerIntProperty(const QString &key) const
{
int value = 0;
if (m_controller) {
value = m_controller->int_property(key);
}
return value;
}
QString ProjectClip::getProducerProperty(const QString &key)
QString ProjectClip::getProducerProperty(const QString &key) const
{
QString value;
if (m_controller) {
......@@ -304,19 +335,23 @@ QString ProjectClip::getProducerProperty(const QString &key)
const QString ProjectClip::hash()
{
if (!m_properties.contains("file_hash")) getFileHash();
return m_properties.value("file_hash");
if (!m_controller) return QString();
QString clipHash = m_controller->property("file_hash");
if (clipHash.isEmpty()) {
return getFileHash();
}
return clipHash;
}
void ProjectClip::getFileHash()
const QString ProjectClip::getFileHash() const
{
if (clipType() == SlideShow) return;
if (clipType() == SlideShow) return QString();
QFile file(m_controller->clipUrl().toLocalFile());
if (file.open(QIODevice::ReadOnly)) { // write size and hash only if resource points to a file
QByteArray fileData;
QByteArray fileHash;
////qDebug() << "SETTING HASH of" << value;
m_properties.insert("file_size", QString::number(file.size()));
//m_properties.insert("file_size", QString::number(file.size()));
/*
* 1 MB = 1 second per 450 files (or faster)
* 10 MB = 9 seconds per 450 files (or faster)
......@@ -329,8 +364,11 @@ void ProjectClip::getFileHash()
fileData = file.readAll();
file.close();
fileHash = QCryptographicHash::hash(fileData, QCryptographicHash::Md5);
m_properties.insert("file_hash", QString(fileHash.toHex()));
QString result = fileHash.toHex();
m_controller->setProperty("file_hash", result);
return result;
}
return QString();
}
const QString ProjectClip::getProperty(const QString &key) const
......
......@@ -101,7 +101,7 @@ public:
virtual bool hasLimitedDuration() const;
/** @brief Returns the clip's duration. */
virtual int duration() const;
GenTime duration() const;
/** @brief Calls AbstractProjectItem::setCurrent and sets the bin monitor to use the clip's producer. */
virtual void setCurrent(bool current, bool notify = true);
......@@ -125,7 +125,7 @@ public:
void setProducer(ClipController *controller, bool replaceProducer);
/** @brief Returns true if this clip already has a producer. */
bool hasProducer() const;
bool isReady() const;
/** @brief Returns this clip's producer. */
Mlt::Producer *producer();
......@@ -153,14 +153,23 @@ public:
void setProducerProperty(const char *name, const char *data);
/** @brief Get a property from the MLT producer. */
QString getProducerProperty(const QString &key);
QString getProducerProperty(const QString &key) const;
int getProducerIntProperty(const QString &key) const;
QList < CommentedTime > commentedSnapMarkers() const;
/** @brief Returns true if we are using a proxy for this clip. */
bool hasProxy() const;
/** Cache for every audio Frame with 10 Bytes */
/** format is frame -> channel ->bytes */
QMap<int, QMap<int, QByteArray> > audioFrameCache;
bool audioThumbCreated() const;
public slots:
//TODO
QPixmap thumbnail(bool force = false);
void updateAudioThumbnail(const audioByteArray& data);
protected:
QUrl m_url;
......@@ -174,7 +183,11 @@ private:
/** @brief The Clip controller for this clip. */
ClipController *m_controller;
/** @brief Generate and store file hash if not available. */
void getFileHash();
const QString getFileHash() const;
bool m_audioThumbCreated;
signals:
void gotAudioData();
};
#endif
......@@ -22,7 +22,7 @@
#include "docclipbase.h"
#include "documentchecker.h"
#include "documentvalidator.h"
#include "mltcontroller/clipcontroller.h"
#include <config-kdenlive.h>
#include "kdenlivesettings.h"
#include "renderer.h"
......@@ -1287,6 +1287,11 @@ ProjectClip *KdenliveDoc::getBinClip(const QString &clipId)
return pCore->bin()->getBinClip(clipId);
}
ClipController *KdenliveDoc::getClipController(const QString &clipId)
{
return pCore->binController()->getController(clipId);
}
DocClipBase *KdenliveDoc::getBaseClip(const QString &clipId)
{
return m_clipManager->getClipById(clipId);
......@@ -1897,7 +1902,7 @@ void KdenliveDoc::slotProxyCurrentItem(bool doProxy)
for (int i = 0; i < clipList.count(); ++i) {
ProjectClip *item = clipList.at(i);
ClipType t = item->clipType();
if ((t == Video || t == AV || t == Unknown || t == Image || t == Playlist) && item->hasProducer()) {
if ((t == Video || t == AV || t == Unknown || t == Image || t == Playlist) && item->isReady()) {
if ((doProxy && item->hasProxy()) || (!doProxy && !item->hasProxy() && pCore->binController()->hasClip(item->clipId()))) continue;
if (m_render->isProcessing(item->clipId())) {
//qDebug()<<"//// TRYING TO PROXY: "<<item->clipId()<<", but it is busy";
......
......@@ -46,6 +46,7 @@ class MainWindow;
class TrackInfo;
class NotesPlugin;
class ProjectClip;
class ClipController;
class QTextEdit;
class QProgressDialog;
......@@ -91,6 +92,7 @@ public:
void deleteClip(const QString &clipId);
int getFramePos(const QString &duration);
ProjectClip *getBinClip(const QString &clipId);
ClipController *getClipController(const QString &clipId);
DocClipBase *getBaseClip(const QString &clipId);
void updateClip(const QString &id);
......
......@@ -22,7 +22,7 @@
#include "kdenlivesettings.h"
#include "mainwindow.h"
#include "doc/kthumb.h"
#include "doc/docclipbase.h"
#include "bin/projectclip.h"
#include "project/projectlist.h"
#include "effectslist/effectslist.h"
#include "timeline/clipitem.h"
......@@ -116,9 +116,11 @@ void EffectStackView2::slotClipItemSelected(ClipItem* c)
m_ui.checkAll->setText(i18n("Effects for %1", cname));
}
m_ui.checkAll->setEnabled(true);
QString size = c->baseClip()->getProperty("frame_size");
double factor = c->baseClip()->getProperty("aspect_ratio").toDouble();
m_effectMetaInfo.frameSize = QPoint((int)(size.section('x', 0, 0).toInt() * factor + 0.5), size.section('x', 1, 1).toInt());
//TODO
int frameWidth = c->binClip()->getProducerIntProperty("meta.media.width");
int frameHeight = c->binClip()->getProducerIntProperty("meta.media.height");
double factor = c->binClip()->getProducerProperty("aspect_ratio").toDouble();
m_effectMetaInfo.frameSize = QPoint((int)(frameWidth * factor + 0.5), frameHeight);
}
}
if (m_clipref == NULL) {
......@@ -652,7 +654,7 @@ void EffectStackView2::slotMoveEffectUp(const QList<int> &indexes, bool up)
void EffectStackView2::slotStartFilterJob(QMap <QString, QString> &filterParams, QMap <QString, QString> &consumerParams, QMap <QString, QString> &extraParams)
{
if (!m_clipref) return;
emit startFilterJob(m_clipref->info(), m_clipref->clipProducer(), filterParams, consumerParams, extraParams);
emit startFilterJob(m_clipref->info(), m_clipref->getBinId(), filterParams, consumerParams, extraParams);
}
void EffectStackView2::slotResetEffect(int ix)
......
......@@ -21,6 +21,8 @@
#include "mainwindow.h"
#include "mainwindowadaptor.h"
#include "core.h"
#include "bin/projectclip.h"
#include "mltcontroller/clipcontroller.h"
#include "kdenlivesettings.h"
#include "dialogs/kdenlivesettingsdialog.h"
#include "effectslist/initeffects.h"
......@@ -175,9 +177,6 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
m_clipMonitor = new Monitor(Kdenlive::ClipMonitor, pCore->monitorManager(), m_timelineArea);
pCore->bin()->setMonitor(m_clipMonitor);
// Connect the project list
connect(m_projectList, SIGNAL(clipSelected(DocClipBase*,QPoint,bool)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase*,QPoint,bool)));
connect(m_projectList, SIGNAL(raiseClipMonitor(bool)), m_clipMonitor, SLOT(slotActivateMonitor(bool)));
connect(m_projectList, SIGNAL(loadingIsOver()), this, SLOT(slotElapsedTime()));
connect(m_projectList, SIGNAL(displayMessage(QString,int,MessageType)), this, SLOT(slotGotProgressInfo(QString,int,MessageType)));
connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
......@@ -627,18 +626,20 @@ void MainWindow::slotAddEffect(const QDomElement &effect)
void MainWindow::slotUpdateClip(const QString &id)
{
DocClipBase *clip = pCore->projectManager()->current()->clipManager()->getClipById(id);
ProjectClip *clip = pCore->bin()->getBinClip(id);
if (!clip) {
return;
}
if (clip->numReferences() > 0) {
//TOFO
/*if (clip->numReferences() > 0) {
pCore->projectManager()->currentTrackView()->projectView()->slotUpdateClip(id);
}*/
//TODO Should probably be removed
if (m_clipMonitor->activeClipId() == id) {
m_clipMonitor->openClip(pCore->binController()->getController(id));
}
if (m_clipMonitor->activeClip() && m_clipMonitor->activeClip()->getId() == id) {
Mlt::Producer *monitorProducer = clip->getCloneProducer();
m_clipMonitor->updateClipProducer(monitorProducer);
}
clip->cleanupProducers();
//TODO
//clip->cleanupProducers();
}
void MainWindow::slotConnectMonitors()
......@@ -1369,7 +1370,7 @@ void MainWindow::slotUpdateProjectProfile(const QString &profile)
// Deselect current effect / transition
m_effectStack->slotClipItemSelected(NULL);
m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
m_clipMonitor->slotSetClipProducer(NULL);
m_clipMonitor->openClip(NULL);
bool updateFps = project->setProfilePath(profile);
pCore->binController()->resetProfile(profile);
KdenliveSettings::setProject_fps(project->fps());
......@@ -1515,7 +1516,6 @@ void MainWindow::connectDocument()
connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), project, SLOT(setModified()));
connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers(bool,bool)), project, SLOT(checkProjectClips(bool,bool)));
connect(project, SIGNAL(addProjectClip(DocClipBase*,bool)), m_projectList, SLOT(slotAddClip(DocClipBase*,bool)));
connect(project, SIGNAL(resetProjectList()), m_projectList, SLOT(slotResetProjectList()));
connect(project, SIGNAL(signalDeleteProjectClip(QString)), this, SLOT(slotDeleteClip(QString)));
connect(project, SIGNAL(updateClipDisplay(QString)), m_projectList, SLOT(slotUpdateClip(QString)));
......@@ -1526,7 +1526,7 @@ void MainWindow::connectDocument()
connect(project, SIGNAL(saveTimelinePreview(QString)), trackView, SLOT(slotSaveTimelinePreview(QString)));
connect(m_proxyClip, SIGNAL(toggled(bool)), project, SLOT(slotProxyCurrentItem(bool)));
connect(trackView->projectView(), SIGNAL(updateClipMarkers(DocClipBase*)), this, SLOT(slotUpdateClipMarkers(DocClipBase*)));
connect(trackView->projectView(), SIGNAL(updateClipMarkers(ClipController*)), this, SLOT(slotUpdateClipMarkers(ClipController*)));
connect(trackView, SIGNAL(showTrackEffects(int,TrackInfo)), this, SLOT(slotTrackSelected(int,TrackInfo)));
connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*,bool)), this, SLOT(slotTimelineClipSelected(ClipItem*,bool)));
......@@ -1763,7 +1763,7 @@ void MainWindow::slotDeleteItem()
}
}
void MainWindow::slotUpdateClipMarkers(DocClipBase *clip)
void MainWindow::slotUpdateClipMarkers(ClipController *clip)
{
if (m_clipMonitor->isActive()) {
m_clipMonitor->checkOverlay();
......@@ -1775,25 +1775,25 @@ void MainWindow::slotAddClipMarker()
{
KdenliveDoc *project = pCore->projectManager()->current();
DocClipBase *clip = NULL;
ClipController *clip = NULL;
GenTime pos;
if (m_projectMonitor->isActive()) {
if (pCore->projectManager()->currentTrackView()) {
ClipItem *item = pCore->projectManager()->currentTrackView()->projectView()->getActiveClipUnderCursor();
if (item) {
pos = GenTime((int)((m_projectMonitor->position() - item->startPos() + item->cropStart()).frames(project->fps()) * item->speed() + 0.5), project->fps());
clip = item->baseClip();
clip = pCore->binController()->getController(item->getBinId());
}
}
} else {
clip = m_clipMonitor->activeClip();
clip = m_clipMonitor->currentController();
pos = m_clipMonitor->position();
}
if (!clip) {
m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
return;
}
QString id = clip->getId();
QString id = clip->clipId();
CommentedTime marker(pos, i18n("Marker"), KdenliveSettings::default_marker_type());
QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
project->timecode(), i18n("Add Marker"), this);
......@@ -1807,18 +1807,18 @@ void MainWindow::slotAddClipMarker()
void MainWindow::slotDeleteClipMarker()
{
DocClipBase *clip = NULL;
ClipController *clip = NULL;
GenTime pos;
if (m_projectMonitor->isActive()) {
if (pCore->projectManager()->currentTrackView()) {
ClipItem *item = pCore->projectManager()->currentTrackView()->projectView()->getActiveClipUnderCursor();
if (item) {
pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
clip = item->baseClip();
clip = pCore->binController()->getController(item->getBinId());
}
}
} else {
clip = m_clipMonitor->activeClip();
clip = m_clipMonitor->currentController();
pos = m_clipMonitor->position();
}
if (!clip) {
......@@ -1826,7 +1826,7 @@ void MainWindow::slotDeleteClipMarker()
return;
}
QString id = clip->getId();
QString id = clip->clipId();
QString comment = clip->markerComment(pos);
if (comment.isEmpty()) {
m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
......@@ -1837,38 +1837,38 @@ void MainWindow::slotDeleteClipMarker()
void MainWindow::slotDeleteAllClipMarkers()
{
DocClipBase *clip = NULL;
ClipController *clip = NULL;
if (m_projectMonitor->isActive()) {
if (pCore->projectManager()->currentTrackView()) {
ClipItem *item = pCore->projectManager()->currentTrackView()->projectView()->getActiveClipUnderCursor();
if (item) {
clip = item->baseClip();
clip = pCore->binController()->getController(item->getBinId());
}
}
} else {
clip = m_clipMonitor->activeClip();
clip = m_clipMonitor->currentController();
}
if (!clip) {
m_messageLabel->setMessage(i18n("Cannot find clip to remove marker"), ErrorMessage);
return;
}
pCore->projectManager()->currentTrackView()->projectView()->slotDeleteAllClipMarkers(clip->getId());
pCore->projectManager()->currentTrackView()->projectView()->slotDeleteAllClipMarkers(clip->clipId());
}
void MainWindow::slotEditClipMarker()
{
DocClipBase *clip = NULL;
ClipController *clip = NULL;
GenTime pos;
if (m_projectMonitor->isActive()) {
if (pCore->projectManager()->currentTrackView()) {
ClipItem *item = pCore->projectManager()->currentTrackView()->projectView()->getActiveClipUnderCursor();
if (item) {
pos = (m_projectMonitor->position() - item->startPos() + item->cropStart()) / item->speed();
clip = item->baseClip();
clip = pCore->binController()->getController(item->getBinId());
}
}
} else {
clip = m_clipMonitor->activeClip();
clip = m_clipMonitor->currentController();
pos = m_clipMonitor->position();
}
if (!clip) {
......@@ -1876,7 +1876,7 @@ void MainWindow::slotEditClipMarker()
return;
}
QString id = clip->getId();
QString id = clip->clipId();
CommentedTime oldMarker = clip->markerAt(pos);
if (oldMarker == CommentedTime()) {
m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
......@@ -1904,7 +1904,7 @@ void MainWindow::slotAddMarkerGuideQuickly()
return;
if (m_clipMonitor->isActive()) {
DocClipBase *clip = m_clipMonitor->activeClip();
ClipController *clip = m_clipMonitor->currentController();
GenTime pos = m_clipMonitor->position();
if (!clip) {
......@@ -1913,7 +1913,7 @@ void MainWindow::slotAddMarkerGuideQuickly()
}
//TODO: allow user to set default marker category
CommentedTime marker(pos, pCore->projectManager()->current()->timecode().getDisplayTimecode(pos, false), KdenliveSettings::default_marker_type());
pCore->projectManager()->currentTrackView()->projectView()->slotAddClipMarker(clip->getId(), QList <CommentedTime>() <<marker);
pCore->projectManager()->currentTrackView()->projectView()->slotAddClipMarker(clip->clipId(), QList <CommentedTime>() <<marker);
} else {
pCore->projectManager()->currentTrackView()->projectView()->slotAddGuide(false);
}
......@@ -2411,7 +2411,7 @@ void MainWindow::slotClipInProjectTree()
if (pCore->projectManager()->currentTrackView()) {
QStringList clipIds;
if (m_mainClip) {
clipIds << m_mainClip->clipProducer();
clipIds << m_mainClip->getBinId();
} else {
clipIds = pCore->projectManager()->currentTrackView()->projectView()->selectedClips();
}
......@@ -3008,14 +3008,14 @@ void MainWindow::slotSwitchMonitors()
void MainWindow::slotInsertZoneToTree()
{
if (!m_clipMonitor->isActive() || m_clipMonitor->activeClip() == NULL) return;
if (!m_clipMonitor->isActive() || m_clipMonitor->currentController() == NULL) return;
QStringList info = m_clipMonitor->getZoneInfo();
m_projectList->slotAddClipCut(info.at(0), info.at(1).toInt(), info.at(2).toInt());
}
void MainWindow::slotInsertZoneToTimeline()
{
if (pCore->projectManager()->currentTrackView() == NULL || m_clipMonitor->activeClip() == NULL) return;
if (pCore->projectManager()->currentTrackView() == NULL || m_clipMonitor->currentController() == NULL) return;
QStringList info = m_clipMonitor->getZoneInfo();
pCore->projectManager()->currentTrackView()->projectView()->insertClipCut(m_clipMonitor->activeClipId(), info.at(1).toInt(), info.at(2).toInt());
}
......@@ -3060,10 +3060,10 @@ void MainWindow::slotOpenStopmotion()
void MainWindow::slotDeleteClip(const QString &id)
{
QList <ClipProperties *> list = findChildren<ClipProperties *>();
/*QList <ClipProperties *> list = findChildren<ClipProperties *>();
for (int i = 0; i < list.size(); ++i) {
list.at(i)->disableClipId(id);
}
}*/
m_projectList->slotDeleteClip(id);
}
......
......@@ -409,7 +409,7 @@ private slots:
/** @brief Removes the focus of anything. */
void slotRemoveFocus();
void slotCleanProject();
void slotUpdateClipMarkers(DocClipBase *clip);
void slotUpdateClipMarkers(ClipController *clip);
void slotShutdown();
void slotUpdateTrackInfo();
......
......@@ -194,12 +194,22 @@ Mlt::Producer *BinController::cloneProducer(Mlt::Producer &original)
return clone;
}
Mlt::Producer *BinController::getBinClip(const QString &id, int track, int clipState, double speed)
Mlt::Producer *BinController::getBinClip(const QString &id, int track, PlaylistState::ClipState clipState, double speed)
{
if (!m_clipList.contains(id)) return NULL;
// TODO: framebuffer speed clips
ClipController *controller = m_clipList.value(id);
return controller->getTrackProducer(id, track, clipState, speed);
return controller->getTrackProducer(track, clipState, speed);
}
double BinController::fps() const
{
return m_mltProfile->fps();
}
double BinController::dar() const
{
return m_mltProfile->dar();
}
void BinController::duplicateFilters(Mlt::Producer original, Mlt::Producer clone)
......
......@@ -53,6 +53,12 @@ public:
/** @brief Returns the MLT profile used everywhere in the project. */
Mlt::Profile *profile();
/** @brief Returns the project's fps. */
double fps() const;
/** @brief Returns the project's dar. */
double dar() const;
/** @brief Reset the profile to a new one, for example when loading a document with another profile.
* @param newProfile The file name for the new MLT profile
* */
......@@ -101,7 +107,7 @@ public:
@param clipState The state of the clip (if we need an audio only or video only producer).
@param speed If the clip has a speed effect (framebuffer producer), we indicate the speed here
*/
Mlt::Producer *getBinClip(const QString &id, int track, int clipState = PlaylistState::Original, double speed = 1.0);
Mlt::Producer *getBinClip(const QString &id, int track, PlaylistState::ClipState clipState = PlaylistState::Original, double speed = 1.0);
/** @brief Returns the clip data as rendered by MLT's XML consumer, used to duplicate a clip
* @param producer The clip's original producer
......
......@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
ClipController::ClipController(BinController *bincontroller, Mlt::Producer& producer) : QObject()
, m_binController(bincontroller)
, m_snapMarkers(QList < CommentedTime >())
{
m_masterProducer = &producer;
if (!m_masterProducer->is_valid()) qDebug()<<"// WARNING, USING INVALID PRODUCER";
......@@ -41,11 +42,13 @@ ClipController::ClipController(BinController *bincontroller, Mlt::Producer& prod
m_name = m_url.fileName();
}
m_service = m_masterProducer->get("mlt_service");
m_duration = GenTime(m_masterProducer->get_playtime(), m_binController->fps());
}
}
ClipController::ClipController(BinController *bincontroller) : QObject()
, m_binController(bincontroller)
, m_snapMarkers(QList < CommentedTime >())
{
m_masterProducer = NULL;
}
......@@ -54,11 +57,17 @@ ClipController::~ClipController()
{
}
double ClipController::dar() const
{
return m_binController->dar();
}
void ClipController::addMasterProducer(Mlt::Producer &producer)
{
m_masterProducer = &producer;
if (!m_masterProducer->is_valid()) qDebug()<<"// WARNING, USING INVALID PRODUCER";