+ 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();
+ }
+ }
+
+ showPreview = m_previewSettings->isChecked();
+ if (!rec_video->isChecked()) showPreview = false;
+
+ if (m_captureDevice->slotStartCapture(v4lparameters, m_captureFile.path(), playlist, showPreview, isXml)) {
+ videoBox->setHidden(false);
+ m_isCapturing = true;
+ m_recAction->setEnabled(false);
+ m_stopAction->setEnabled(true);
+ m_previewSettings->setEnabled(false);
+ control_frame->setEnabled(false);
+ }
+ else {
+ video_frame->setText(i18n("Failed to start Video4Linux,\ncheck your parameters..."));
+ videoBox->setHidden(true);
+ m_recAction->blockSignals(true);
+ m_recAction->setChecked(false);
+ m_recAction->blockSignals(false);
+ m_isCapturing = false;
+ }
+ break;
+
+ case BLACKMAGIC:
+ slotActivateMonitor();
+ path = KdenliveSettings::current_profile();
+ profile = ProfilesDialog::getVideoProfile(path);
+ //m_videoBox->setRatio((double) profile.display_aspect_num / profile.display_aspect_den);
+ buildMltDevice(path);
+
+ playlist = QString("<producer id=\"producer0\" in=\"0\" out=\"99999\"><property name=\"mlt_type\">producer</property><property name=\"length\">100000</property><property name=\"eof\">pause</property><property name=\"resource\">%1</property><property name=\"mlt_service\">decklink</property></producer>").arg(KdenliveSettings::decklink_capturedevice());
+
+ if (m_captureDevice->slotStartCapture(KdenliveSettings::decklink_parameters(), m_captureFile.path(), QString("decklink:%1").arg(KdenliveSettings::decklink_capturedevice()), m_previewSettings->isChecked(), false)) {
+ videoBox->setHidden(false);
+ m_isCapturing = true;
+ slotSetInfoMessage(i18n("Capturing to %1", m_captureFile.fileName()));
+ m_recAction->setEnabled(false);
+ m_stopAction->setEnabled(true);
+ m_previewSettings->setEnabled(false);
+ }
+ else {
+ video_frame->setText(i18n("Failed to start Decklink,\ncheck your parameters..."));
+ slotSetInfoMessage(i18n("Failed to start capture"));
+ videoBox->setHidden(true);
+ m_isCapturing = false;
+ }