1 /***************************************************************************
2 krender.cpp - description
4 begin : Fri Nov 22 2002
5 copyright : (C) 2002 by Jason Wood
6 email : jasonwood@blueyonder.co.uk
7 copyright : (C) 2005 Lucio Flavio Correa
8 email : lucio.correa@gmail.com
9 copyright : (C) Marco Gittler
10 email : g.marco@freenet.de
11 copyright : (C) 2006 Jean-Baptiste Mardelle
14 ***************************************************************************/
16 /***************************************************************************
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 ***************************************************************************/
25 // ffmpeg Header files
28 #include <ffmpeg/avformat.h>
32 #include <QApplication>
36 #include <KStandardDirs>
37 #include <KMessageBox>
41 #include <mlt++/Mlt.h>
46 Render::Render(const QString & rendererName, QWidget *parent):QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_sceneList(QDomDocument()), m_winid(-1), m_framePosition(0), m_generateScenelist(false), isBlocked(true)
48 refreshTimer = new QTimer( this );
49 connect( refreshTimer, SIGNAL(timeout()), this, SLOT( refresh()) );
51 m_connectTimer = new QTimer( this );
52 connect( m_connectTimer, SIGNAL(timeout()), this, SLOT(connectPlaylist()) );
54 if (rendererName == "project") m_monitorId = 10000;
55 else m_monitorId = 10001;
56 osdTimer = new QTimer( this );
57 connect( osdTimer, SIGNAL(timeout()), this, SLOT(slotOsdTimeout()) );
59 m_osdProfile = KStandardDirs::locate("data", "kdenlive/profiles/metadata.properties");
60 /*m_osdInfo = new Mlt::Filter("data_show");
61 char *tmp = decodedString(m_osdProfile);
62 m_osdInfo->set("resource", tmp);
64 // Does it do anything usefull? I mean, RenderThread doesn't do anything useful at the moment
65 // (except being cpu hungry :)
67 /* if(!s_renderThread) {
68 s_renderThread = new RenderThread;
69 s_renderThread->start();
79 void Render::closeMlt()
81 delete m_connectTimer;
93 static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr)
95 // detect if the producer has finished playing. Is there a better way to do it ?
96 //if (self->isBlocked) return;
97 if (mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame_ptr ), "_speed" ) == 0.0) {
98 self->emitConsumerStopped();
101 self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
105 /** Wraps the VEML command of the same name; requests that the renderer
106 should create a video window. If show is true, then the window should be
107 displayed, otherwise it should be hidden. Render will emit the signal
108 replyCreateVideoXWindow() once the renderer has replied. */
110 void Render::createVideoXWindow(WId winid, WId externalMonitor)
113 delete m_mltConsumer;
116 m_mltConsumer = new Mlt::Consumer("sdl_preview");
117 if (!m_mltConsumer || !m_mltConsumer->is_valid()) {
118 KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install.\n Exiting now..."));
119 kError()<<"Sorry, cannot create MLT consumer, check your MLT install you miss SDL libraries support in MLT";
123 //only as is saw, if we want to lock something with the sdl lock
124 /*if (!KdenliveSettings::videoprofile().isEmpty())
125 m_mltConsumer->set("profile", KdenliveSettings::videoprofile().ascii());*/
127 m_mltConsumer->set("profile", "hdv_1080_50i"); //KdenliveSettings::videoprofile().ascii());
128 /*m_mltConsumer->set("app_locked", 1);
129 m_mltConsumer->set("app_lock", (void *) &my_lock, 0);
130 m_mltConsumer->set("app_unlock", (void *) &my_unlock, 0);*/
131 m_externalwinid = (int) externalMonitor;
132 m_winid = (int) winid;
134 m_mltConsumer->set("window_id", m_winid);
135 m_mltConsumer->set("resize", 1);
137 m_mltConsumer->set("terminate_on_pause", 1);
138 /*QString aDevice = KdenliveSettings::audiodevice();
139 if (!KdenliveSettings::videodriver().isEmpty()) m_mltConsumer->set("video_driver", KdenliveSettings::videodriver().ascii());
140 if (!KdenliveSettings::audiodriver().isEmpty()) m_mltConsumer->set("audio_driver", KdenliveSettings::audiodriver().ascii());
141 m_mltConsumer->set("audio_device", aDevice.section(";", 1).ascii());*/
142 m_mltConsumer->set("progressive", 1);
143 m_mltConsumer->set("audio_buffer", 1024);
144 m_mltConsumer->set("frequency", 48000);
146 m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
148 QTimer::singleShot(500, this, SLOT(initSceneList()));
150 // m_mltConsumer->listen("consumer-stopped", this, (mlt_listener) consumer_stopped);
151 // m_mltConsumer->set("buffer", 25);
155 int Render::resetRendererProfile(char * profile)
157 if (!m_mltConsumer) return 0;
158 if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
159 m_mltConsumer->set("refresh", 0);
160 m_mltConsumer->set("profile", profile);
161 kDebug()<<" + + RESET CONSUMER WITH PROFILE: "<<profile;
163 m_mltConsumer->set("fps", m_fps);
164 mlt_properties properties = MLT_CONSUMER_PROPERTIES( m_mltConsumer->get_consumer() );
165 int result = mlt_consumer_profile( properties, profile );
170 void Render::restartConsumer()
172 if (m_winid != -1) createVideoXWindow( m_winid, m_externalwinid);
175 /** Wraps the VEML command of the same name; Seeks the renderer clip to the given time. */
176 void Render::seek(GenTime time)
178 sendSeekCommand(time);
179 //emit positionChanged(time);
183 char *Render::decodedString(QString str)
185 /*QCString fn = QFile::encodeName(str);
186 char *t = new char[fn.length() + 1];
187 strcpy(t, (const char *)fn);*/
189 return qstrdup( str.toLatin1().data() );
193 QPixmap Render::frameThumbnail(Mlt::Frame *frame, int width, int height, bool border)
195 QPixmap pix(width, height);
197 mlt_image_format format = mlt_image_rgb24a;
202 uint8_t *thumb = frame->get_image(format, width, height);
203 QImage image(thumb, width, height, QImage::Format_ARGB32);
205 if (!image.isNull()) {
206 pix = pix.fromImage(image);
208 QPainter painter(&pix);
209 painter.drawRect(0, 0, width - 1, height - 1);
211 /*if (!border) pix = pix.fromImage(image);
212 //bitBlt(&pix, 0, 0, &image, 0, 0, width, height);
215 bitBlt(&pix, 1, 1, &image, 0, 0, width, height);
218 else pix.fill(Qt::black);
223 QPixmap Render::extractFrame(int frame_position, int width, int height)
225 QPixmap pix(width, height);
226 if (!m_mltProducer) {
230 Mlt::Producer *mlt_producer = m_mltProducer->cut(frame_position, frame_position + 1);
231 Mlt::Filter m_convert("avcolour_space");
232 m_convert.set("forced", mlt_image_rgb24a);
233 mlt_producer->attach(m_convert);
234 Mlt::Frame *frame = mlt_producer->get_frame();
237 pix = frameThumbnail(frame, width, height);
240 else pix.fill(Qt::black);
245 QPixmap Render::getImageThumbnail(KUrl url, int width, int height)
249 if (url.fileName().startsWith(".all.")) { // check for slideshow
250 QString fileType = url.fileName().right(3);
252 QStringList::Iterator it;
254 QDir dir( url.directory() );
255 more = dir.entryList( QDir::Files );
257 for ( it = more.begin() ; it != more.end() ; ++it ) {
258 if ((*it).endsWith("."+fileType, Qt::CaseInsensitive)) {
259 im.load(url.directory() + "/" + *it);
264 else im.load(url.path());
265 //pixmap = im.scaled(width, height);
270 QPixmap Render::getVideoThumbnail(QString file, int frame_position, int width, int height)
272 QPixmap pix(width, height);
273 char *tmp = decodedString(file);
274 Mlt::Producer m_producer(tmp);
276 if (m_producer.is_blank()) {
281 Mlt::Filter m_convert("avcolour_space");
282 m_convert.set("forced", mlt_image_rgb24a);
283 m_producer.attach(m_convert);
284 m_producer.seek(frame_position);
285 Mlt::Frame * frame = m_producer.get_frame();
287 pix = frameThumbnail(frame, width, height, true);
294 void Render::getImage(KUrl url, int frame_position, QPoint size)
296 char *tmp = decodedString(url.path());
297 Mlt::Producer m_producer(tmp);
299 if (m_producer.is_blank()) {
302 Mlt::Filter m_convert("avcolour_space");
303 m_convert.set("forced", mlt_image_rgb24a);
304 m_producer.attach(m_convert);
305 m_producer.seek(frame_position);
307 Mlt::Frame * frame = m_producer.get_frame();
310 QPixmap pix = frameThumbnail(frame, size.x(), size.y(), true);
312 emit replyGetImage(url, frame_position, pix, size.x(), size.y());
316 /* Create thumbnail for color */
317 void Render::getImage(int id, QString color, QPoint size)
319 QPixmap pixmap(size.x() - 2, size.y() - 2);
320 color = color.replace(0, 2, "#");
321 color = color.left(7);
322 pixmap.fill(QColor(color));
323 QPixmap result(size.x(), size.y());
324 result.fill(Qt::black);
325 //copyBlt(&result, 1, 1, &pixmap, 0, 0, size.x() - 2, size.y() - 2);
326 emit replyGetImage(id, result, size.x(), size.y());
330 /* Create thumbnail for image */
331 void Render::getImage(KUrl url, QPoint size)
335 if (url.fileName().startsWith(".all.")) { // check for slideshow
336 QString fileType = url.fileName().right(3);
338 QStringList::Iterator it;
340 QDir dir( url.directory() );
341 more = dir.entryList( QDir::Files );
342 for ( it = more.begin() ; it != more.end() ; ++it ) {
343 if ((*it).endsWith("."+fileType, Qt::CaseInsensitive)) {
344 if (!im.load(url.directory() + "/" + *it))
345 kDebug()<<"++ ERROR LOADIN IMAGE: "<<url.directory() + "/" + *it;
350 else im.load(url.path());
352 //pixmap = im.smoothScale(size.x() - 2, size.y() - 2);
353 QPixmap result(size.x(), size.y());
354 result.fill(Qt::black);
355 //copyBlt(&result, 1, 1, &pixmap, 0, 0, size.x() - 2, size.y() - 2);
356 emit replyGetImage(url, 1, result, size.x(), size.y());
360 double Render::consumerRatio() const
362 if (!m_mltConsumer) return 1.0;
363 return (m_mltConsumer->get_double("aspect_ratio_num")/m_mltConsumer->get_double("aspect_ratio_den"));
367 int Render::getLength()
372 kDebug()<<"////// LENGTH: "<<mlt_producer_get_playtime(m_mltProducer->get_producer());
373 return mlt_producer_get_playtime(m_mltProducer->get_producer());
378 bool Render::isValid(KUrl url)
380 char *tmp = decodedString(url.path());
381 Mlt::Producer producer(tmp);
383 if (producer.is_blank())
390 void Render::getFileProperties(const KUrl &url, uint framenb)
393 int width = height * 16/9.0; //KdenliveSettings::displayratio();
394 char *tmp = decodedString(url.path());
395 Mlt::Producer producer(tmp);
397 if (producer.is_blank()) {
400 producer.seek( framenb );
401 mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer.get_producer() );
403 QMap < QString, QString > filePropertyMap;
404 QMap < QString, QString > metadataPropertyMap;
406 filePropertyMap["filename"] = url.path();
407 filePropertyMap["duration"] = QString::number(producer.get_playtime());
409 Mlt::Filter m_convert("avcolour_space");
410 m_convert.set("forced", mlt_image_rgb24a);
411 producer.attach(m_convert);
413 Mlt::Frame * frame = producer.get_frame();
415 if (frame->is_valid()) {
416 filePropertyMap["fps"] =
417 QString::number(mlt_producer_get_fps( producer.get_producer() ));
418 filePropertyMap["width"] =
419 QString::number(frame->get_int("width"));
420 filePropertyMap["height"] =
421 QString::number(frame->get_int("height"));
422 filePropertyMap["frequency"] =
423 QString::number(frame->get_int("frequency"));
424 filePropertyMap["channels"] =
425 QString::number(frame->get_int("channels"));
427 // Retrieve audio / video codec name
429 // Fetch the video_context
430 AVFormatContext *context = (AVFormatContext *) mlt_properties_get_data( properties, "video_context", NULL );
431 if (context != NULL) {
432 // Get the video_index
433 int index = mlt_properties_get_int( properties, "video_index" );
434 filePropertyMap["videocodec"] = context->streams[ index ]->codec->codec->name;
436 context = (AVFormatContext *) mlt_properties_get_data( properties, "audio_context", NULL );
437 if (context != NULL) {
438 // Get the video_index
439 int index = mlt_properties_get_int( properties, "audio_index" );
440 filePropertyMap["audiocodec"] = context->streams[ index ]->codec->codec->name;
447 mlt_properties metadata = mlt_properties_new( );
448 mlt_properties_pass( metadata, properties, "meta.attr." );
449 int count = mlt_properties_count( metadata );
450 for ( int i = 0; i < count; i ++ )
452 QString name = mlt_properties_get_name( metadata, i );
453 QString value = QString::fromUtf8(mlt_properties_get_value( metadata, i ));
454 if (name.endsWith("markup") && !value.isEmpty())
455 metadataPropertyMap[ name.section(".", 0, -2) ] = value;
458 if (frame->get_int("test_image") == 0) {
459 if (url.path().endsWith(".westley") || url.path().endsWith(".kdenlive")) {
460 filePropertyMap["type"] = "playlist";
461 metadataPropertyMap["comment"] = QString::fromUtf8(mlt_properties_get( MLT_SERVICE_PROPERTIES( producer.get_service() ), "title"));
463 else if (frame->get_int("test_audio") == 0)
464 filePropertyMap["type"] = "av";
466 filePropertyMap["type"] = "video";
468 // Generate thumbnail for this frame
469 QPixmap pixmap = frameThumbnail(frame, width, height, true);
471 emit replyGetImage(url, 0, pixmap, width, height);
473 } else if (frame->get_int("test_audio") == 0) {
474 QPixmap pixmap(KStandardDirs::locate("appdata", "graphics/music.png"));
475 emit replyGetImage(url, 0, pixmap, width, height);
476 filePropertyMap["type"] = "audio";
479 emit replyGetFileProperties(filePropertyMap, metadataPropertyMap);
483 QDomDocument Render::sceneList() const
488 /** Create the producer from the Westley QDomDocument */
489 void Render::initSceneList()
491 kDebug()<<"-------- INIT SCENE LIST ------_";
493 QDomElement westley = doc.createElement("westley");
494 doc.appendChild(westley);
495 QDomElement prod = doc.createElement("producer");
496 prod.setAttribute("resource", "colour");
497 prod.setAttribute("colour", "red");
498 prod.setAttribute("id", "black");
499 prod.setAttribute("in", "0");
500 prod.setAttribute("out", "0");
502 QDomElement tractor = doc.createElement("tractor");
503 QDomElement multitrack = doc.createElement("multitrack");
505 QDomElement playlist1 = doc.createElement("playlist");
506 playlist1.appendChild(prod);
507 multitrack.appendChild(playlist1);
508 QDomElement playlist2 = doc.createElement("playlist");
509 multitrack.appendChild(playlist2);
510 QDomElement playlist3 = doc.createElement("playlist");
511 multitrack.appendChild(playlist3);
512 QDomElement playlist4 = doc.createElement("playlist");
513 multitrack.appendChild(playlist4);
514 QDomElement playlist5 = doc.createElement("playlist");
515 multitrack.appendChild(playlist5);
516 tractor.appendChild(multitrack);
517 westley.appendChild(tractor);
518 kDebug()<<doc.toString();
520 QString tmp = QString("<westley><producer resource=\"colour\" colour=\"red\" id=\"red\" /><tractor><multitrack><playlist></playlist><playlist></playlist><playlist /><playlist /><playlist></playlist></multitrack></tractor></westley>");*/
521 setSceneList(doc, 0);
525 /** Create the producer from the Westley QDomDocument */
526 void Render::setSceneList(QDomDocument list, int position)
528 if (!m_winid == -1) return;
529 m_generateScenelist = true;
531 kWarning()<<"////// RENDER, SET SCENE LIST";
534 char *tmp = decodedString(list.toString());
535 kDebug()<<" / / /STRING rESULT-----------: "<<tmp;
536 Mlt::Producer clip("westley-xml", tmp);
539 if (!clip.is_valid()) {
540 kWarning()<<" ++++ WARNING, UNABLE TO CREATE MLT PRODUCER";
541 m_generateScenelist = false;
548 m_mltConsumer->set("refresh", 0);
549 if (!m_mltConsumer->is_stopped()) {
550 //emitConsumerStopped();
551 m_mltConsumer->stop();
556 m_mltProducer->set_speed(0.0);
558 //if (KdenliveSettings::osdtimecode() && m_osdInfo) m_mltProducer->detach(*m_osdInfo);
560 delete m_mltProducer;
561 m_mltProducer = NULL;
565 m_mltProducer = new Mlt::Producer(clip); //track.current();
566 m_mltProducer->optimise();
567 if (position != 0) m_mltProducer->seek(position);
569 /*if (KdenliveSettings::osdtimecode()) {
570 // Attach filter for on screen display of timecode
572 QString attr = "attr_check";
573 mlt_filter filter = mlt_factory_filter( "data_feed", (char*) attr.ascii() );
574 mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "_fezzik", 1 );
575 mlt_producer_attach( m_mltProducer->get_producer(), filter );
576 mlt_filter_close( filter );
578 m_osdInfo = new Mlt::Filter("data_show");
579 tmp = decodedString(m_osdProfile);
580 m_osdInfo->set("resource", tmp);
582 mlt_properties properties = MLT_PRODUCER_PROPERTIES(m_mltProducer->get_producer());
583 mlt_properties_set_int( properties, "meta.attr.timecode", 1);
584 mlt_properties_set( properties, "meta.attr.timecode.markup", "#timecode#");
585 m_osdInfo->set("dynamic", "1");
587 if (m_mltProducer->attach(*m_osdInfo) == 1) kDebug()<<"////// error attaching filter";
589 m_osdInfo->set("dynamic", "0");
592 m_fps = m_mltProducer->get_fps();
593 if (!m_mltConsumer) {
596 emit playListDuration( (int) m_mltProducer->get_playtime());
597 m_connectTimer->start( 500 );
598 m_generateScenelist = false;
602 const double Render::fps() const
607 void Render::connectPlaylist() {
608 kDebug()<<"************** CONNECTING PLAYLIST";
609 m_connectTimer->stop();
610 if (m_mltConsumer->start() == -1) {
611 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."));
612 m_mltConsumer = NULL;
615 m_mltConsumer->connect(*m_mltProducer);
616 m_mltProducer->set_speed(0.0);
621 void Render::refreshDisplay() {
623 if (!m_mltProducer) return;
624 m_mltConsumer->set("refresh", 0);
626 mlt_properties properties = MLT_PRODUCER_PROPERTIES(m_mltProducer->get_producer());
627 /*if (KdenliveSettings::osdtimecode()) {
628 mlt_properties_set_int( properties, "meta.attr.timecode", 1);
629 mlt_properties_set( properties, "meta.attr.timecode.markup", "#timecode#");
630 m_osdInfo->set("dynamic", "1");
631 m_mltProducer->attach(*m_osdInfo);
634 m_mltProducer->detach(*m_osdInfo);
635 m_osdInfo->set("dynamic", "0");
640 void Render::setVolume(double volume)
642 if (!m_mltConsumer || !m_mltProducer) return;
644 m_mltConsumer->set("refresh", 0);
645 // Attach filter for on screen display of timecode
646 mlt_properties properties = MLT_PRODUCER_PROPERTIES(m_mltProducer->get_producer());
647 mlt_properties_set_double( properties, "meta.volume", volume );
648 mlt_properties_set_int( properties, "meta.attr.osdvolume", 1);
649 mlt_properties_set( properties, "meta.attr.osdvolume.markup", i18n("Volume: ") + QString::number(volume * 100));
651 if (!KdenliveSettings::osdtimecode()) {
652 m_mltProducer->detach(*m_osdInfo);
653 mlt_properties_set_int( properties, "meta.attr.timecode", 0);
654 if (m_mltProducer->attach(*m_osdInfo) == 1) kDebug()<<"////// error attaching filter";
657 osdTimer->setSingleShot(2500 );
660 void Render::slotOsdTimeout()
662 mlt_properties properties = MLT_PRODUCER_PROPERTIES(m_mltProducer->get_producer());
663 mlt_properties_set_int(properties, "meta.attr.osdvolume", 0);
664 mlt_properties_set(properties, "meta.attr.osdvolume.markup", NULL);
665 //if (!KdenliveSettings::osdtimecode()) m_mltProducer->detach(*m_osdInfo);
671 if (!m_mltConsumer || m_winid == -1) {
676 if (m_mltConsumer->is_stopped()) {
677 if (m_mltConsumer->start() == -1) {
678 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."));
679 m_mltConsumer = NULL;
692 m_mltConsumer->set("refresh", 0);
693 if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
697 //if (KdenliveSettings::osdtimecode() && m_osdInfo) m_mltProducer->detach(*m_osdInfo);
698 m_mltProducer->set_speed(0.0);
699 delete m_mltProducer;
700 m_mltProducer = NULL;
707 kDebug()<<"///////////// RENDER STOP-------";
708 if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
709 m_mltConsumer->set("refresh", 0);
710 m_mltConsumer->stop();
716 m_mltProducer->set_speed(0.0);
717 m_mltProducer->set("out", m_mltProducer->get_length() - 1);
721 void Render::stop(const GenTime & startTime)
723 kDebug()<<"///////////// RENDER STOP-------2";
725 m_mltProducer->set_speed(0.0);
726 m_mltProducer->seek((int) startTime.frames(m_fps));
728 m_mltConsumer->purge();
731 void Render::switchPlay()
735 if (m_mltProducer->get_speed() == 0.0) m_mltProducer->set_speed(1.0);
737 m_mltProducer->set_speed(0.0);
738 kDebug()<<"// POSITON: "<<m_framePosition;
739 m_mltProducer->seek((int) m_framePosition);
742 /*if (speed == 0.0) {
743 m_mltProducer->seek((int) m_framePosition + 1);
744 m_mltConsumer->purge();
749 void Render::play(double speed)
753 if (speed == 0.0) m_mltProducer->set("out", m_mltProducer->get_length() - 1);
754 m_mltProducer->set_speed(speed);
755 /*if (speed == 0.0) {
756 m_mltProducer->seek((int) m_framePosition + 1);
757 m_mltConsumer->purge();
762 void Render::play(double speed, const GenTime & startTime)
764 kDebug()<<"///////////// RENDER PLAY2-------"<<speed;
767 //m_mltProducer->set("out", m_mltProducer->get_length() - 1);
768 //if (speed == 0.0) m_mltConsumer->set("refresh", 0);
769 m_mltProducer->set_speed(speed);
770 m_mltProducer->seek((int) (startTime.frames(m_fps)));
771 //m_mltConsumer->purge();
775 void Render::play(double speed, const GenTime & startTime,
776 const GenTime & stopTime)
778 kDebug()<<"///////////// RENDER PLAY3-------"<<speed;
781 m_mltProducer->set("out", stopTime.frames(m_fps));
782 m_mltProducer->seek((int) (startTime.frames(m_fps)));
783 m_mltConsumer->purge();
784 m_mltProducer->set_speed(speed);
788 void Render::render(const KUrl & url)
791 QDomElement elem = doc.createElement("render");
792 elem.setAttribute("filename", url.path());
793 doc.appendChild(elem);
796 void Render::sendSeekCommand(GenTime time)
800 //kDebug()<<"////////// KDENLIVE SEEK: "<<(int) (time.frames(m_fps));
801 m_mltProducer->seek((int) (time.frames(m_fps)));
805 void Render::seekToFrame(int pos)
809 //kDebug()<<"////////// KDENLIVE SEEK: "<<(int) (time.frames(m_fps));
810 m_mltProducer->seek(pos);
814 void Render::askForRefresh()
816 // Use a Timer so that we don't refresh too much
817 refreshTimer->start( 200 );
820 void Render::refresh()
824 refreshTimer->stop();
826 m_mltConsumer->set("refresh", 1);
830 /** Sets the description of this renderer to desc. */
831 void Render::setDescription(const QString & description)
833 m_description = description;
836 /** Returns the description of this renderer */
837 QString Render::description()
839 return m_description;
843 double Render::playSpeed()
845 if (m_mltProducer) return m_mltProducer->get_speed();
849 const GenTime & Render::seekPosition() const
851 if (m_mltProducer) return GenTime((int) m_mltProducer->position(), m_fps);
852 else return GenTime();
856 const QString & Render::rendererName() const
862 void Render::emitFrameNumber(double position)
864 //kDebug()<<"// POSITON: "<<m_framePosition;
865 if (m_generateScenelist) return;
866 m_framePosition = position;
867 emit rendererPosition((int) position);
868 //if (qApp->activeWindow()) QApplication::postEvent(qApp->activeWindow(), new PositionChangeEvent( GenTime((int) position, m_fps), m_monitorId));
871 void Render::emitConsumerStopped()
873 // This is used to know when the playing stopped
874 if (m_mltProducer && !m_generateScenelist) {
875 double pos = m_mltProducer->position();
876 emit rendererStopped((int) pos);
877 //if (qApp->activeWindow()) QApplication::postEvent(qApp->activeWindow(), new PositionChangeEvent(GenTime((int) pos, m_fps), m_monitorId + 100));
878 //new QCustomEvent(10002));
884 void Render::exportFileToFirewire(QString srcFileName, int port, GenTime startTime, GenTime endTime)
886 KMessageBox::sorry(0, i18n("Firewire is not enabled on your system.\n Please install Libiec61883 and recompile Kdenlive"));
890 void Render::exportCurrentFrame(KUrl url, bool notify) {
891 if (!m_mltProducer) {
892 KMessageBox::sorry(qApp->activeWindow(), i18n("There is no clip, cannot extract frame."));
896 int height = 1080;//KdenliveSettings::defaultheight();
897 int width = 1940; //KdenliveSettings::displaywidth();
899 QPixmap pix(width, height);
901 Mlt::Filter m_convert("avcolour_space");
902 m_convert.set("forced", mlt_image_rgb24a);
903 m_mltProducer->attach(m_convert);
904 Mlt::Frame * frame = m_mltProducer->get_frame();
905 m_mltProducer->detach(m_convert);
907 pix = frameThumbnail(frame, width, height);
910 pix.save(url.path(), "PNG");
911 //if (notify) QApplication::postEvent(qApp->activeWindow(), new UrlEvent(url, 10003));
914 /** MLT PLAYLIST DIRECT MANIPULATON **/
917 void Render::mltCheckLength()
919 //kDebug()<<"checking track length: "<<track<<"..........";
920 Mlt::Service service(m_mltProducer->get_service());
921 Mlt::Tractor tractor(service);
923 int trackNb = tractor.count( );
925 double trackDuration;
927 Mlt::Producer trackProducer(tractor.track(0));
928 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
929 duration = Mlt::Producer(trackPlaylist.get_producer()).get_playtime() - 1;
930 m_mltProducer->set("out", duration);
931 emit durationChanged();
934 while (trackNb > 1) {
935 Mlt::Producer trackProducer(tractor.track(trackNb - 1));
936 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
937 trackDuration = Mlt::Producer(trackPlaylist.get_producer()).get_playtime() - 1;
939 kDebug()<<" / / /DURATON FOR TRACK "<<trackNb - 1<<" = "<<trackDuration;
940 if (trackDuration > duration) duration = trackDuration;
944 Mlt::Producer blackTrackProducer(tractor.track(0));
945 Mlt::Playlist blackTrackPlaylist(( mlt_playlist ) blackTrackProducer.get_service());
946 double blackDuration = Mlt::Producer(blackTrackPlaylist.get_producer()).get_playtime() - 1;
947 kDebug()<<" / / /DURATON FOR TRACK 0 = "<<blackDuration;
948 if (blackDuration != duration) {
949 blackTrackPlaylist.remove_region( 0, blackDuration );
953 while (dur > 14000) { // <producer mlt_service=\"colour\" colour=\"black\" in=\"0\" out=\"13999\" />
954 mltInsertClip(0, GenTime(i * 14000, m_fps), QString("<westley><producer mlt_service=\"colour\" colour=\"black\" in=\"0\" out=\"13999\" /></westley>"));
959 mltInsertClip(0, GenTime(), QString("<westley><producer mlt_service=\"colour\" colour=\"black\" in=\"0\" out=\"" + QString::number(dur) + "\" /></westley>"));
961 m_mltProducer->set("out", duration);
962 emit durationChanged();
967 void Render::mltInsertClip(int track, GenTime position, QString resource)
969 if (!m_mltProducer) {
970 kDebug()<<"PLAYLISTÂ NOT INITIALISED //////";
973 Mlt::Producer parentProd(m_mltProducer->parent());
974 if (parentProd.get_producer() == NULL) {
975 kDebug()<<"PLAYLISTÂ BROKEN, CANNOT INSERTÂ CLIP //////";
978 Mlt::Service service(parentProd.get_service());
979 Mlt::Tractor tractor(service);
981 Mlt::Producer trackProducer(tractor.track(track));
982 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
983 char *tmp = decodedString(resource);
984 Mlt::Producer clip("westley-xml", tmp);
985 //clip.set_in_and_out(in.frames(m_fps), out.frames(m_fps));
988 trackPlaylist.insert_at(position.frames(m_fps), clip, 1);
989 tractor.multitrack()->refresh();
991 if (track != 0) mltCheckLength();
992 double duration = Mlt::Producer(trackPlaylist.get_producer()).get_playtime();
993 kDebug()<<"// + +INSERTING CLIP: "<<resource<<" AT: "<<position.frames(m_fps)<<" on track: "<<track<<", DURATION: "<<duration;
998 void Render::mltCutClip(int track, GenTime position)
1000 Mlt::Service service(m_mltProducer->parent().get_service());
1001 if (service.type() == playlist_type) kDebug()<<"// PLAYLIST TYPE";
1002 if (service.type() == tractor_type) kDebug()<<"// TRACOT TYPE";
1003 if (service.type() == multitrack_type) kDebug()<<"// MULTITRACK TYPE";
1004 if (service.type() == producer_type) kDebug()<<"// PROD TYPE";
1006 Mlt::Tractor tractor(service);
1007 Mlt::Producer trackProducer(tractor.track(track));
1008 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1009 trackPlaylist.split_at(position.frames(m_fps));
1010 trackPlaylist.consolidate_blanks(0);
1011 kDebug()<<"/ / / /CUTTING CLIP AT: "<<position.frames(m_fps);
1015 void Render::mltRemoveClip(int track, GenTime position)
1017 Mlt::Service service(m_mltProducer->parent().get_service());
1018 if (service.type() == playlist_type) kDebug()<<"// PLAYLIST TYPE";
1019 if (service.type() == tractor_type) kDebug()<<"// TRACOT TYPE";
1020 if (service.type() == multitrack_type) kDebug()<<"// MULTITRACK TYPE";
1021 if (service.type() == producer_type) kDebug()<<"// PROD TYPE";
1023 Mlt::Tractor tractor(service);
1024 Mlt::Producer trackProducer(tractor.track(track));
1025 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1026 int clipIndex = trackPlaylist.get_clip_index_at(position.frames(m_fps));
1027 //trackPlaylist.remove(clipIndex);
1028 trackPlaylist.replace_with_blank(clipIndex);
1029 trackPlaylist.consolidate_blanks(0);
1030 if (track != 0) mltCheckLength();
1031 //emit durationChanged();
1034 void Render::mltRemoveEffect(int track, GenTime position, QString id, QString tag, int index)
1036 Mlt::Service service(m_mltProducer->parent().get_service());
1038 Mlt::Tractor tractor(service);
1039 Mlt::Producer trackProducer(tractor.track(track));
1040 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1041 //int clipIndex = trackPlaylist.get_clip_index_at(position.frames(m_fps));
1042 Mlt::Producer *clip = trackPlaylist.get_clip_at(position.frames(m_fps));
1044 kDebug()<<" / / / CANNOT FIND CLIP TO REMOVE EFFECT";
1047 Mlt::Service clipService(clip->get_service());
1049 if (tag.startsWith("ladspa")) tag = "ladspa";
1053 Mlt::Filter *filter = clipService.filter( ct );
1055 if (filter->get("mlt_service") == tag && filter->get("kdenlive_id") == id) {
1056 clipService.detach(*filter);
1057 kDebug()<<" / / / DLEETED EFFECT: "<<ct;
1060 filter = clipService.filter( ct );
1064 Mlt::Filter *filter = clipService.filter( index );
1065 if (filter && filter->get("mlt_service") == tag && filter->get("kdenlive_id") == id) clipService.detach(*filter);
1067 kDebug()<<"WARINIG, FILTER "<<id<<" NOT FOUND!!!!!";
1074 void Render::mltAddEffect(int track, GenTime position, QString id, QString tag, QMap <QString, QString> args)
1076 Mlt::Service service(m_mltProducer->parent().get_service());
1078 Mlt::Tractor tractor(service);
1079 Mlt::Producer trackProducer(tractor.track(track));
1080 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1082 Mlt::Producer *clip = trackPlaylist.get_clip_at(position.frames(m_fps));
1085 kDebug()<<"********** CANNOT FIND CLIP TO APPLY EFFECT-----------";
1088 Mlt::Service clipService(clip->get_service());
1091 kDebug()<<" / / INSERTING EFFECT: "<<id;
1092 if (tag.startsWith("ladspa")) tag = "ladspa";
1093 char *filterId = decodedString(tag);
1094 Mlt::Filter *filter = new Mlt::Filter(filterId);
1095 filter->set("kdenlive_id", filterId);
1097 QMap<QString, QString>::Iterator it;
1098 QString keyFrameNumber = "#0";
1100 for ( it = args.begin(); it != args.end(); ++it ) {
1101 //kDebug()<<" / / INSERTING EFFECT ARGS: "<<it.key()<<": "<<it.data();
1103 QString currentKeyFrameNumber;
1104 if (it.key().startsWith("#")) {
1105 currentKeyFrameNumber = it.key().section(":", 0, 0);
1106 if (currentKeyFrameNumber != keyFrameNumber) {
1107 // attach filter to the clip
1108 clipService.attach(*filter);
1109 filter = new Mlt::Filter(filterId);
1110 filter->set("kdenlive_id", filterId);
1111 keyFrameNumber = currentKeyFrameNumber;
1113 key = it.key().section(":", 1);
1115 else key = it.key();
1116 char *name = decodedString(key);
1117 char *value = decodedString(it.value());
1118 filter->set(name, value);
1122 // attach filter to the clip
1123 clipService.attach(*filter);
1129 void Render::mltEditEffect(int track, GenTime position, int index, QString id, QString tag, QMap <QString, QString> args)
1131 QMap<QString, QString>::Iterator it = args.begin();
1132 if (it.key().startsWith("#") || tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle") {
1133 // This is a keyframe effect, to edit it, we remove it and re-add it.
1134 mltRemoveEffect(track, position, id, tag, -1);
1135 mltAddEffect(track, position, id, tag, args);
1140 Mlt::Service service(m_mltProducer->parent().get_service());
1142 Mlt::Tractor tractor(service);
1143 Mlt::Producer trackProducer(tractor.track(track));
1144 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1145 //int clipIndex = trackPlaylist.get_clip_index_at(position.frames(m_fps));
1146 Mlt::Producer *clip = trackPlaylist.get_clip_at(position.frames(m_fps));
1147 Mlt::Service clipService(clip->get_service());
1148 Mlt::Filter *filter = clipService.filter( index );
1151 if (!filter || filter->get("mlt_service") != tag) {
1152 kDebug()<<"WARINIG, FILTER NOT FOUND!!!!!";
1154 filter = clipService.filter( index );
1156 if (filter->get("mlt_service") == tag && filter->get("kdenlive_id") == id) break;
1158 filter = clipService.filter( index );
1162 kDebug()<<"WARINIG, FILTER "<<id<<" NOT FOUND!!!!!";
1166 for ( it = args.begin(); it != args.end(); ++it ) {
1167 kDebug()<<" / / INSERTING EFFECT ARGS: "<<it.key()<<": "<<it.value();
1168 char *name = decodedString(it.key());
1169 char *value = decodedString(it.value());
1170 filter->set(name, value);
1177 void Render::mltResizeClipEnd(int track, GenTime pos, GenTime in, GenTime out)
1179 Mlt::Service service(m_mltProducer->parent().get_service());
1181 Mlt::Tractor tractor(service);
1182 Mlt::Producer trackProducer(tractor.track(track));
1183 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1184 if (trackPlaylist.is_blank_at(pos.frames(m_fps) + 1))
1185 kDebug()<<"//////// ERROR RSIZING BLANK CLIP!!!!!!!!!!!";
1186 int clipIndex = trackPlaylist.get_clip_index_at(pos.frames(m_fps) + 1);
1188 int previousDuration = trackPlaylist.clip_length(clipIndex) - 1;
1189 int newDuration = out.frames(m_fps) - 1;
1191 kDebug()<<" ** RESIZING CLIP END:" << clipIndex << " on track:"<< track <<", mid pos: "<<pos.frames(25)<<", in: "<<in.frames(25)<<", out: "<<out.frames(25)<<", PREVIOUS duration: "<<previousDuration;
1192 trackPlaylist.resize_clip(clipIndex, in.frames(m_fps), newDuration);
1193 trackPlaylist.consolidate_blanks(0);
1194 if (previousDuration < newDuration) {
1195 // clip was made longer, trim next blank if there is one.
1196 if (trackPlaylist.is_blank(clipIndex + 1)) {
1197 trackPlaylist.split(clipIndex + 1, newDuration - previousDuration);
1198 trackPlaylist.remove(clipIndex + 1);
1201 else trackPlaylist.insert_blank(clipIndex + 1, previousDuration - newDuration - 1);
1203 trackPlaylist.consolidate_blanks(0);
1204 tractor.multitrack()->refresh();
1206 if (track != 0) mltCheckLength();
1210 void Render::mltChangeTrackState(int track, bool mute, bool blind)
1212 Mlt::Service service(m_mltProducer->parent().get_service());
1214 Mlt::Tractor tractor(service);
1215 Mlt::Producer trackProducer(tractor.track(track));
1216 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1218 if (blind) trackProducer.set("hide", 3);
1219 else trackProducer.set("hide", 2);
1222 trackProducer.set("hide", 1);
1225 trackProducer.set("hide", 0);
1227 tractor.multitrack()->refresh();
1232 void Render::mltResizeClipStart(int track, GenTime pos, GenTime moveEnd, GenTime moveStart, GenTime in, GenTime out)
1234 Mlt::Service service(m_mltProducer->parent().get_service());
1235 if (service.type() == playlist_type) kDebug()<<"// PLAYLIST TYPE";
1236 if (service.type() == tractor_type) kDebug()<<"// TRACOT TYPE";
1237 if (service.type() == multitrack_type) kDebug()<<"// MULTITRACK TYPE";
1238 if (service.type() == producer_type) kDebug()<<"// PROD TYPE";
1240 int moveFrame = (moveEnd - moveStart).frames(m_fps);
1242 Mlt::Tractor tractor(service);
1243 Mlt::Producer trackProducer(tractor.track(track));
1244 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1245 if (trackPlaylist.is_blank_at(pos.frames(m_fps) - 1))
1246 kDebug()<<"//////// ERROR RSIZING BLANK CLIP!!!!!!!!!!!";
1247 int clipIndex = trackPlaylist.get_clip_index_at(pos.frames(m_fps) - 1);
1248 kDebug()<<" ** RESIZING CLIP START:" << clipIndex << " on track:"<< track <<", mid pos: "<<pos.frames(25)<<", moving: "<<moveFrame<<", in: "<<in.frames(25)<<", out: "<<out.frames(25);
1250 trackPlaylist.resize_clip(clipIndex, in.frames(m_fps), out.frames(m_fps));
1251 if (moveFrame > 0) trackPlaylist.insert_blank(clipIndex, moveFrame - 1);
1253 int midpos = moveStart.frames(m_fps) - 1; //+ (moveFrame / 2)
1254 int blankIndex = trackPlaylist.get_clip_index_at(midpos);
1255 int blankLength = trackPlaylist.clip_length(blankIndex);
1257 kDebug()<<" + resizing blank: "<<blankIndex<<", Mid: "<<midpos<<", Length: "<<blankLength<< ", SIZE DIFF: "<<moveFrame;
1260 if (blankLength + moveFrame == 0) trackPlaylist.remove(blankIndex);
1261 else trackPlaylist.resize_clip(blankIndex, 0, blankLength + moveFrame -1);
1263 trackPlaylist.consolidate_blanks(0);
1265 kDebug()<<"-----------------\n"<<"CLIP 0: "<<trackPlaylist.clip_start(0)<<", LENGT: "<<trackPlaylist.clip_length(0);
1266 kDebug()<<"CLIP 1: "<<trackPlaylist.clip_start(1)<<", LENGT: "<<trackPlaylist.clip_length(1);
1267 kDebug()<<"CLIP 2: "<<trackPlaylist.clip_start(2)<<", LENGT: "<<trackPlaylist.clip_length(2);
1268 kDebug()<<"CLIP 3: "<<trackPlaylist.clip_start(3)<<", LENGT: "<<trackPlaylist.clip_length(3);
1269 kDebug()<<"CLIP 4: "<<trackPlaylist.clip_start(4)<<", LENGT: "<<trackPlaylist.clip_length(4);
1272 void Render::mltMoveClip(int startTrack, int endTrack, GenTime moveStart, GenTime moveEnd)
1274 mltMoveClip(startTrack, endTrack, (int) moveStart.frames(m_fps), (int) moveEnd.frames(m_fps));
1278 void Render::mltMoveClip(int startTrack, int endTrack, int moveStart, int moveEnd)
1280 m_mltConsumer->set("refresh", 0);
1281 Mlt::Service service(m_mltProducer->parent().get_service());
1283 Mlt::Tractor tractor(service);
1284 Mlt::Producer trackProducer(tractor.track(startTrack));
1285 Mlt::Playlist trackPlaylist(( mlt_playlist ) trackProducer.get_service());
1286 int clipIndex = trackPlaylist.get_clip_index_at(moveStart + 1);
1289 mlt_field field = mlt_tractor_field(tractor.get_tractor());
1291 mlt_multitrack multitrack = mlt_field_multitrack(field); //mlt_tractor_multitrack(tractor.get_tractor());
1292 kDebug()<<" -- CURRENT MULTIOTRACK HAS: "<<mlt_multitrack_count(multitrack)<<" tracks";;
1293 mlt_service multiprod = mlt_multitrack_service( multitrack );
1295 Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
1296 trackPlaylist.consolidate_blanks(0);
1297 mlt_events_block( MLT_PRODUCER_PROPERTIES(clipProducer.get_producer()), NULL );
1299 if (endTrack == startTrack) {
1300 if (!trackPlaylist.is_blank_at(moveEnd)) {
1301 kWarning()<<"// ERROR, CLIP COLLISION----------";
1302 int ix = trackPlaylist.get_clip_index_at(moveEnd);
1303 kDebug()<<"BAD CLIP STARTS AT: "<<trackPlaylist.clip_start(ix)<<", LENGT: "<<trackPlaylist.clip_length(ix);
1305 trackPlaylist.insert_at(moveEnd, clipProducer, 1);
1306 trackPlaylist.consolidate_blanks(0);
1309 trackPlaylist.consolidate_blanks(0);
1310 Mlt::Producer destTrackProducer(tractor.track(endTrack));
1311 Mlt::Playlist destTrackPlaylist(( mlt_playlist ) destTrackProducer.get_service());
1312 destTrackPlaylist.consolidate_blanks(1);
1313 destTrackPlaylist.insert_at(moveEnd, clipProducer, 1);
1314 destTrackPlaylist.consolidate_blanks(0);
1318 mlt_events_unblock( MLT_PRODUCER_PROPERTIES(clipProducer.get_producer()), NULL );
1321 void Render::mltMoveTransition(QString type, int startTrack, int trackOffset, GenTime oldIn, GenTime oldOut, GenTime newIn, GenTime newOut)
1323 m_mltConsumer->set("refresh", 0);
1324 mlt_service serv = m_mltProducer->parent().get_service();
1326 mlt_service nextservice = mlt_service_get_producer(serv);
1327 mlt_properties properties = MLT_SERVICE_PROPERTIES( nextservice );
1328 QString mlt_type = mlt_properties_get( properties, "mlt_type" );
1329 QString resource = mlt_properties_get( properties, "mlt_service");
1330 int old_pos = (oldIn.frames(m_fps) + oldOut.frames(m_fps)) / 2;
1332 int new_in = newIn.frames(m_fps);
1333 int new_out = newOut.frames(m_fps) - 1;
1334 while (mlt_type == "transition") {
1335 mlt_transition tr = (mlt_transition) nextservice;
1336 int currentTrack = mlt_transition_get_b_track(tr);
1337 int currentIn = (int) mlt_transition_get_in(tr);
1338 int currentOut = (int) mlt_transition_get_out(tr);
1339 kDebug()<<"// FOUND EXISTING TRANS, IN: "<<currentIn<<", OUT: "<<currentOut<<", TRACK: "<<currentTrack;
1340 //kDebug()<<"// LOOKING FOR IN: "<<old_in<<", OUT: "<<old_out;
1341 kDebug()<<"// OLD IN: "<<oldIn.frames(m_fps)<<" // OLD OUT: "<<oldOut.frames(m_fps)<<", TRACK: "<<startTrack<<", MID POS: "<<old_pos;
1342 if (resource == type && startTrack == currentTrack && currentIn <= old_pos && currentOut >= old_pos) {
1343 mlt_transition_set_in_and_out(tr, new_in, new_out);
1344 if (trackOffset != 0) {
1345 mlt_properties properties = MLT_TRANSITION_PROPERTIES( tr );
1346 mlt_properties_set_int( properties, "a_track", mlt_transition_get_a_track(tr) + trackOffset );
1347 mlt_properties_set_int( properties, "b_track", mlt_transition_get_b_track(tr) + trackOffset );
1351 nextservice = mlt_service_producer(nextservice);
1352 properties = MLT_SERVICE_PROPERTIES( nextservice );
1353 mlt_type = mlt_properties_get( properties, "mlt_type" );
1354 resource = mlt_properties_get( properties, "mlt_service" );
1358 void Render::mltAddTransition(QString tag, int a_track, int b_track, GenTime in, GenTime out, QMap <QString, QString> args)
1360 Mlt::Service service(m_mltProducer->parent().get_service());
1362 Mlt::Tractor tractor(service);
1363 Mlt::Field *field = tractor.field();
1365 char *transId = decodedString(tag);
1366 Mlt::Transition *transition = new Mlt::Transition(transId);
1367 transition->set_in_and_out((int) in.frames(m_fps), (int) out.frames(m_fps));
1368 QMap<QString, QString>::Iterator it;
1371 kDebug()<<" ------ ADDING TRANSITION PARAMs: "<<args.count();
1373 for ( it = args.begin(); it != args.end(); ++it ) {
1375 char *name = decodedString(key);
1376 char *value = decodedString(it.value());
1377 transition->set(name, value);
1378 kDebug()<<" ------ ADDING TRANS PARAM: "<<name<<": "<<value;
1379 //filter->set("kdenlive_id", id);
1383 // attach filter to the clip
1384 field->plant_transition(*transition, a_track, b_track);
1390 void Render::mltSavePlaylist()
1392 kWarning()<<"// UPDATING PLAYLIST TO DISK++++++++++++++++";
1393 Mlt::Consumer *fileConsumer = new Mlt::Consumer("westley");
1394 fileConsumer->set("resource", "/home/one/playlist.xml");
1396 Mlt::Service service(m_mltProducer->get_service());
1397 Mlt::Tractor tractor(service);
1399 fileConsumer->connect(service);
1400 fileConsumer->start();
1404 #include "renderer.moc"