+ QString playlist;
+ QString v4lparameters;
+ QStringList grabParameters;
+ MltVideoProfile profile;
+ bool showPreview;
+ bool isXml;
+ QString captureSize;
+ QRect screenSize = QApplication::desktop()->screenGeometry();
+ QString capturename = KdenliveSettings::dvgrabfilename();
+ if (capturename.isEmpty()) capturename = "capture";
+
+ switch (device_selector->currentIndex()) {
+ case VIDEO4LINUX:
+ if (rec_video->isChecked()) slotActivateMonitor();
+ path = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
+ profile = ProfilesDialog::getVideoProfile(path);
+ //m_videoBox->setRatio((double) profile.display_aspect_num / profile.display_aspect_den);
+ buildMltDevice(path);
+ playlist = getV4lXmlPlaylist(profile, &isXml);
+
+ v4lparameters = KdenliveSettings::v4l_parameters();
+
+ // TODO: when recording audio only, allow param configuration?
+ if (!rec_video->isChecked()) v4lparameters.clear();
+
+ // Add alsa audio capture
+ if (!rec_audio->isChecked()) {
+ // if we do not want audio, make sure that we don't have audio encoding parameters
+ // this is required otherwise the MLT avformat consumer will not close properly
+ if (v4lparameters.contains("acodec")) {
+ QString endParam = v4lparameters.section("acodec", 1);
+ int vcodec = endParam.indexOf(" vcodec");
+ int format = endParam.indexOf(" f=");
+ int cutPosition = -1;
+ if (vcodec > -1) {
+ if (format > -1) {
+ cutPosition = qMin(vcodec, format);
+ }
+ else cutPosition = vcodec;
+ }
+ else if (format > -1) {
+ cutPosition = format;
+ }
+ else {
+ // nothing interesting in end params
+ endParam.clear();
+ }
+ if (cutPosition > -1) {
+ endParam.remove(0, cutPosition);
+ }
+ v4lparameters = QString(v4lparameters.section("acodec", 0, 0) + "an=1 " + endParam).simplified();
+ }
+ }