+ m_winid = (int) m_captureDisplayWidget->winId();
+
+ // Create multi consumer setup
+ Mlt::Properties *renderProps = new Mlt::Properties;
+ renderProps->set("mlt_service", "avformat");
+ renderProps->set("target", path.toUtf8().constData());
+ renderProps->set("real_time", -KdenliveSettings::mltthreads());
+ //renderProps->set("terminate_on_pause", 0);
+ renderProps->set("mlt_profile", m_activeProfile.toUtf8().constData());
+
+
+ QStringList paramList = params.split(' ', QString::SkipEmptyParts);
+ char *tmp2;
+ for (int i = 0; i < paramList.count(); ++i) {
+ tmp = qstrdup(paramList.at(i).section('=', 0, 0).toUtf8().constData());
+ QString value = paramList.at(i).section('=', 1, 1);
+ if (value == "%threads") value = QString::number(QThread::idealThreadCount());
+ tmp2 = qstrdup(value.toUtf8().constData());
+ renderProps->set(tmp, tmp2);
+ delete[] tmp;
+ delete[] tmp2;
+ }
+ mlt_properties consumerProperties = m_mltConsumer->get_properties();
+ mlt_properties_set_data(consumerProperties, "0", renderProps->get_properties(), 0, (mlt_destructor) mlt_properties_close, NULL);
+
+ if (m_livePreview)
+ {
+ // user wants live preview
+ Mlt::Properties *previewProps = new Mlt::Properties;
+ QString videoDriver = KdenliveSettings::videodrivername();
+ if (!videoDriver.isEmpty()) {
+ if (videoDriver == "x11_noaccel") {
+ setenv("SDL_VIDEO_YUV_HWACCEL", "0", 1);
+ videoDriver = "x11";
+ } else {
+ unsetenv("SDL_VIDEO_YUV_HWACCEL");
+ }
+ }
+ setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 1);
+
+ if (m_winid == 0) {
+ // OpenGL monitor
+ previewProps->set("mlt_service", "sdl_audio");
+ previewProps->set("preview_off", 1);
+ previewProps->set("preview_format", mlt_image_rgb24);
+ previewProps->set("terminate_on_pause", 0);
+ m_showFrameEvent = m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_gl_frame_show);
+ } else {
+ previewProps->set("mlt_service", "sdl_preview");
+ previewProps->set("window_id", m_winid);
+ previewProps->set("terminate_on_pause", 0);
+ //m_showFrameEvent = m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) rec_consumer_frame_preview);
+ }
+ //m_mltConsumer->set("resize", 1);
+ previewProps->set("window_background", KdenliveSettings::window_background().name().toUtf8().constData());
+ QString audioDevice = KdenliveSettings::audiodevicename();
+ if (!audioDevice.isEmpty())
+ previewProps->set("audio_device", audioDevice.toUtf8().constData());
+
+ if (!videoDriver.isEmpty())
+ previewProps->set("video_driver", videoDriver.toUtf8().constData());
+
+ QString audioDriver = KdenliveSettings::audiodrivername();
+
+ if (!audioDriver.isEmpty())
+ previewProps->set("audio_driver", audioDriver.toUtf8().constData());
+
+ previewProps->set("real_time", "0");
+ previewProps->set("mlt_profile", m_activeProfile.toUtf8().constData());
+ mlt_properties_set_data(consumerProperties, "1", previewProps->get_properties(), 0, (mlt_destructor) mlt_properties_close, NULL);
+ //m_showFrameEvent = m_mltConsumer->listen("consumer-frame-render", this, (mlt_listener) rec_consumer_frame_show);
+ }
+ else {
+
+ }
+
+ if (xmlPlaylist) {
+ // create an xml producer
+ m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData());
+ }
+ else {
+ // create a producer based on mltproducer parameter
+ m_mltProducer = new Mlt::Producer(*m_mltProfile, playlist.toUtf8().constData());
+ }