/** Create the producer from the MLT XML QDomDocument */
-void Render::setProducer(Mlt::Producer *producer, int position)
+int Render::setProducer(Mlt::Producer *producer, int position)
{
- if (m_winid == -1) return;
+ if (m_winid == -1) return -1;
if (m_mltConsumer) {
m_mltConsumer->stop();
- } else return;
+ } else return -1;
m_mltConsumer->purge();
if (!m_mltProducer || !m_mltProducer->is_valid()) kDebug() << " WARNING - - - - -INVALID PLAYLIST: ";
m_fps = m_mltProducer->get_fps();
- connectPlaylist();
+ int error = connectPlaylist();
if (position != -1) {
m_mltProducer->seek(position);
emit rendererPosition(position);
}
m_isBlocked = false;
+ return error;
}
/** Create the producer from the MLT XML QDomDocument */
-void Render::setSceneList(QDomDocument list, int position)
+int Render::setSceneList(QDomDocument list, int position)
{
- setSceneList(list.toString(), position);
+ return setSceneList(list.toString(), position);
}
/** Create the producer from the MLT XML QDomDocument */
-void Render::setSceneList(QString playlist, int position)
+int Render::setSceneList(QString playlist, int position)
{
- if (m_winid == -1) return;
+ if (m_winid == -1) return -1;
m_isBlocked = true;
+ int error;
qDeleteAll(m_slowmotionProducers.values());
m_slowmotionProducers.clear();
if (m_mltConsumer == NULL) {
kWarning() << "/////// ERROR, TRYING TO USE NULL MLT CONSUMER";
m_isBlocked = false;
- return;
+ return -1;
}
if (!m_mltConsumer->is_stopped()) {
}
kDebug() << "// NEW SCENE LIST DURATION SET TO: " << m_mltProducer->get_playtime();
- connectPlaylist();
+ error = connectPlaylist();
fillSlowMotionProducers();
m_isBlocked = false;
blockSignals(false);
emit refreshDocumentProducers();
+ return error;
//kDebug()<<"// SETSCN LST, POS: "<<position;
//if (position != 0) emit rendererPosition(position);
}
return m_fps;
}
-void Render::connectPlaylist()
+int Render::connectPlaylist()
{
- if (!m_mltConsumer) return;
+ if (!m_mltConsumer) return -1;
//m_mltConsumer->set("refresh", "0");
m_mltConsumer->connect(*m_mltProducer);
m_mltProducer->set_speed(0);
- m_mltConsumer->start();
+ if (m_mltConsumer->start() == -1) {
+ // ARGH CONSUMER BROKEN!!!!
+ 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."));
+ emit blockMonitors();
+ delete m_mltProducer;
+ m_mltProducer = NULL;
+ return -1;
+ }
emit durationChanged(m_mltProducer->get_playtime());
+ return 0;
//refresh();
- /*
- 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."));
- delete m_mltConsumer;
- m_mltConsumer = NULL;
- }
- else {
- refresh();
- }*/
}
void Render::refreshDisplay()
kDebug() << "----- BROKEN MONITOR: " << m_name << ", RESTART";
return;
}
-
if (m_mltConsumer && m_mltConsumer->is_stopped()) {
kDebug() << "----- MONITOR: " << m_name << " WAS 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."));
- delete m_mltConsumer;
- m_mltConsumer = NULL;
- return;
+ emit blockMonitors();
+ delete m_mltProducer;
+ m_mltProducer = NULL;
} else {
kDebug() << "----- MONITOR: " << m_name << " REFRESH";
m_isBlocked = false;
void Render::stop()
{
+ if (m_mltProducer == NULL) return;
if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
kDebug() << "///////////// RENDER STOPPED: " << m_name;
m_isBlocked = true;
if (show == false) dropFrames = 0;
m_mltConsumer->stop();
m_mltConsumer->set("play.real_time", dropFrames);
- m_mltConsumer->start();
+ if (m_mltConsumer->start() == -1) {
+ emit blockMonitors();
+ delete m_mltProducer;
+ m_mltProducer = NULL;
+ }
+
}
}
QList <Mlt::Producer *> Render::producersList()
{
QList <Mlt::Producer *> prods;
+ if (m_mltProducer == NULL) return prods;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) return prods;
Mlt::Tractor tractor(service);
void Render::fillSlowMotionProducers()
{
+ if (m_mltProducer == NULL) return;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) return;