From 806bf3cf33db76f2e817ef9515b279bb7f226b45 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sat, 26 Sep 2009 12:44:20 +0000 Subject: [PATCH] Allow to specity a base name for dvgrab captured files: http://www.kdenlive.org/mantis/view.php?id=1141 svn path=/trunk/kdenlive/; revision=3933 --- src/clipitem.cpp | 2 +- src/kdenlivesettings.kcfg | 9 + src/kdenlivesettingsdialog.cpp | 16 +- src/recmonitor.cpp | 90 +++--- src/widgets/configcapture_ui.ui | 515 +++++++++++++++++--------------- 5 files changed, 333 insertions(+), 299 deletions(-) diff --git a/src/clipitem.cpp b/src/clipitem.cpp index ffd6c226..401c23ae 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -769,7 +769,7 @@ void ClipItem::paint(QPainter *painter, QPen pen = painter->pen(); pen.setColor(QColor(255, 255, 255, 200)); pen.setStyle(Qt::DotLine); - + for (; it != markers.end(); ++it) { pos = GenTime((int)((*it).time().frames(m_fps) / m_speed + 0.5), m_fps) - cropStart(); if (pos > GenTime()) { diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index 7f2f7738..b6e721f0 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -339,6 +339,15 @@ + + + + capture + + + + + diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index ef8cad1d..5744bcdd 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -416,13 +416,25 @@ void KdenliveSettingsDialog::updateSettings() KdenliveSettings::setDefault_profile(m_defaultPath); bool resetProfile = false; + bool updateCapturePath = false; if (m_configEnv.capturefolderurl->url().path() != KdenliveSettings::capturefolder()) { - kDebug() << "/// CAPT FOLDER UPDATED"; KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().path()); - emit updateCaptureFolder(); + updateCapturePath = true; } + if (m_configCapture.kcfg_dvgrabfilename->text() != KdenliveSettings::dvgrabfilename()) { + KdenliveSettings::setDvgrabfilename(m_configCapture.kcfg_dvgrabfilename->text()); + updateCapturePath = true; + } + + if ((uint) m_configCapture.kcfg_firewireformat->currentIndex() != KdenliveSettings::firewireformat()) { + KdenliveSettings::setFirewireformat(m_configCapture.kcfg_firewireformat->currentIndex()); + updateCapturePath = true; + } + + if (updateCapturePath) emit updateCaptureFolder(); + QString value = m_configCapture.kcfg_rmd_alsa_device->itemData(m_configCapture.kcfg_rmd_alsa_device->currentIndex()).toString(); if (value != KdenliveSettings::rmd_alsadevicename()) { KdenliveSettings::setRmd_alsadevicename(value); diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index c0d1a4ce..00699796 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -195,14 +195,35 @@ void RecMonitor::slotVideoDeviceChanged(int ix) m_playAction->setEnabled(false); m_rewAction->setEnabled(false); m_fwdAction->setEnabled(false); - //m_ui.video_frame->setText(i18n("Plug your camcorder and\npress connect button\nto initialize connection")); + + // Check that dvgab is available if (KdenliveSettings::dvgrab_path().isEmpty()) { QString dvgrabpath = KStandardDirs::findExe("dvgrab"); if (dvgrabpath.isEmpty()) m_ui.video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("dvgrab utility not found,\n please install it for firewire capture"))); else KdenliveSettings::setDvgrab_path(dvgrabpath); + } else { + // Show capture info + QString capturefile = KdenliveSettings::capturefolder(); + if (!capturefile.endsWith("/")) capturefile.append("/"); + QString capturename = KdenliveSettings::dvgrabfilename(); + if (capturename.isEmpty()) capturename = "capture"; + QString extension; + switch (KdenliveSettings::firewireformat()) { + case 0: + extension = ".dv"; + break; + case 1: + case 2: + extension = ".avi"; + break; + case 3: + extension = ".m2t"; + break; + } + capturename.append("xxx" + extension); + capturefile.append(capturename); + m_ui.video_frame->setPixmap(mergeSideBySide(KIcon("network-connect").pixmap(QSize(50, 50)), i18n("Plug your camcorder and\npress connect button\nto initialize connection\nFiles will be saved in:\n%1", capturefile))); } - - if (!KdenliveSettings::dvgrab_path().isEmpty()) m_ui.video_frame->setPixmap(mergeSideBySide(KIcon("network-connect").pixmap(QSize(50, 50)), i18n("Plug your camcorder and\npress connect button\nto initialize connection\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder()))); break; } } @@ -293,45 +314,6 @@ void RecMonitor::slotStopCapture() void RecMonitor::slotStartCapture(bool play) { - - /* - *captureProcess<<"dvgrab"; - - bool isHdv = false; - - switch (m_recPanel->capture_format->currentItem()){ - case 0: - *captureProcess<<"--format"<<"dv1"; - break; - case 1: - *captureProcess<<"--format"<<"dv2"; - break; - case 3: - *captureProcess<<"--format"<<"hdv"; - isHdv = true; - break; - default: - *captureProcess<<"--format"<<"raw"; - break; - } - - if (KdenliveSettings::autosplit()) *captureProcess<<"--autosplit"; - if (KdenliveSettings::timestamp()) *captureProcess<<"--timestamp"; - *captureProcess<<"-i"<<"capture"<<"-";*/ - - /* - QStringList captureArgs; - captureArgs<<"--format"<<"hdv"<<"-i"<<"capture"<<"-"; - QStringList displayArgs; - - displayArgs<<"-f"<<"mpegts"<<"-x"<width())<<"-y"<height())<<"-"; - - captureProcess->setStandardOutputProcess(displayProcess); - m_ui.video_frame->setScaledContents(false); - captureProcess->start("dvgrab",captureArgs); - displayProcess->start("ffplay", displayArgs);*/ - - if (m_captureProcess->state() != QProcess::NotRunning) { if (m_ui.device_selector->currentIndex() == FIREWIRE) { if (m_isPlaying) { @@ -350,6 +332,8 @@ void RecMonitor::slotStartCapture(bool play) m_captureArgs.clear(); m_displayArgs.clear(); m_isPlaying = false; + QString capturename = KdenliveSettings::dvgrabfilename(); + QStringList dvargs = KdenliveSettings::dvgrabextra().simplified().split(" ", QString::SkipEmptyParts); switch (m_ui.device_selector->currentIndex()) { case FIREWIRE: @@ -377,7 +361,13 @@ void RecMonitor::slotStartCapture(bool play) } if (KdenliveSettings::firewireautosplit()) m_captureArgs << "--autosplit"; if (KdenliveSettings::firewiretimestamp()) m_captureArgs << "--timestamp"; - m_captureArgs << "-i" << "capture" << "-"; + if (!dvargs.isEmpty()) { + m_captureArgs << dvargs; + } + m_captureArgs << "-i"; + if (capturename.isEmpty()) capturename = "capture"; + m_captureArgs << capturename << "-"; + m_displayArgs << "-x" << QString::number(m_ui.video_frame->width()) << "-y" << QString::number(m_ui.video_frame->height()) << "-"; m_captureProcess->setStandardOutputProcess(m_displayProcess); @@ -453,21 +443,15 @@ void RecMonitor::slotRecord() path = KdenliveSettings::capturefolder() + "/capture" + num + '.' + extension; i++; } - m_captureFile = KUrl(path); m_captureArgs.clear(); m_displayArgs.clear(); QString args; + QString capturename = KdenliveSettings::dvgrabfilename(); + if (capturename.isEmpty()) capturename = "capture"; switch (m_ui.device_selector->currentIndex()) { - case FIREWIRE: - m_captureArgs << "--format" << "hdv" << "-i" << "capture" << "-"; - m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(m_ui.video_frame->width()) << "-y" << QString::number(m_ui.video_frame->height()) << "-"; - m_captureProcess->setStandardOutputProcess(m_displayProcess); - kDebug() << "Capture: Running dvgrab " << m_captureArgs.join(" "); - m_captureProcess->start(KdenliveSettings::dvgrab_path(), m_captureArgs); - break; case VIDEO4LINUX: m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-y" << m_captureFile.path() << "-f" << "mpegts" << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-"; m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(m_ui.video_frame->width()) << "-y" << QString::number(m_ui.video_frame->height()) << "-"; @@ -620,7 +604,9 @@ void RecMonitor::manageCapturedFiles() } QDir dir(KdenliveSettings::capturefolder()); QStringList filters; - filters << "capture*" + extension; + QString capturename = KdenliveSettings::dvgrabfilename(); + if (capturename.isEmpty()) capturename = "capture"; + filters << capturename + "*" + extension; const QStringList result = dir.entryList(filters, QDir::Files, QDir::Time); KUrl::List capturedFiles; foreach(const QString &name, result) { diff --git a/src/widgets/configcapture_ui.ui b/src/widgets/configcapture_ui.ui index 8591d380..26453faf 100644 --- a/src/widgets/configcapture_ui.ui +++ b/src/widgets/configcapture_ui.ui @@ -1,107 +1,114 @@ - + + ConfigCapture_UI - - + + 0 0 - 509 - 464 + 409 + 428 - - - - + + + + Default capture device - - + + + + + 0 + 0 + + - + Firewire - + Video4Linux - + Screen Grab - - - + + + 401 0 - + 0 - - + + Firewire - - - - + + + + QFrame::StyledPanel - + QFrame::Raised - + - - - + + + Capture format - - + + - + DV Raw - + DV AVI type 1 - + DV AVI type 2 - + HDV - - - + + + Qt::Horizontal - + 241 20 @@ -109,26 +116,46 @@ - - - + + + Automatically start a new file on scene cut - - - + + + Add recording time to captured file name - - - + + + + Capture file name + + + + + + + + + + dvgrab additional parameters + + + + + + + + + Qt::Vertical - + 20 188 @@ -138,17 +165,17 @@ - - + + Video4Linux - - - - + + + + Qt::Vertical - + 20 40 @@ -156,208 +183,208 @@ - - - - + + + + 0 0 - + Format - - - + + + Video device - - - + + + /dev/dsp - - - - + + + + 0 0 - + Format - - - + + + Audio device - - - - + + + + 0 0 - + Capture params - - + + - - - - + + + + 0 0 - + Encoding params - - - + + + oss - - - + + + video4linux2 - - - + + + /dev/video0 - - - - + + + + 0 0 - - - + + + Qt::Horizontal - - - - + + + + 0 0 - + Image size - - - + + + 320x240 - - - + + + Frame rate - - - + + + 15 - - + + Screen Grab - - - - + + + + QFrame::StyledPanel - + QFrame::Raised - + - - - + + + Capture audio - - - + + + QFrame::StyledPanel - + QFrame::Raised - - - + + + - - + + Audio channels - + - - + + Qt::Horizontal - + 40 20 @@ -366,36 +393,36 @@ - - + + Audio frequency - + - + 48000 - + 41000 - + 32000 - + 22500 - + 11250 @@ -403,122 +430,122 @@ - - - + + + ALSA - + true - - - - + + + + 0 0 - - - + + + Buffer - - - + + + 999 - - - + + + Jack - - - + + + Ports: - - - - + + + + 0 0 - - - + + + Buffer - - + + - - + + - + Full screen capture - + Region capture - - - + + + QFrame::StyledPanel - + QFrame::Raised - - - + + + - - + + Follow mouse - - + + Hide frame - - + + Qt::Horizontal - + 40 20 @@ -528,62 +555,62 @@ - - - + + + Offset - - - - + + + + 0 0 - + 1 - + 5000 - - - - + + + + 0 0 - + 1 - + 5000 - - - + + + Size - - - + + + 5000 - - - + + + 5000 @@ -591,22 +618,22 @@ - - - + + + Frame rate - - + + - - - + + + Qt::Horizontal - + 237 20 @@ -614,19 +641,19 @@ - - - + + + Full shots - - - + + + Qt::Vertical - + 383 160 @@ -642,25 +669,25 @@ - KComboBox - QComboBox -
kcombobox.h
+ KIntSpinBox + QSpinBox +
knuminput.h
KDoubleNumInput QWidget
knuminput.h
- - KIntSpinBox - QSpinBox -
knuminput.h
-
KLineEdit QLineEdit
klineedit.h
+ + KComboBox + QComboBox +
kcombobox.h
+
kcfg_defaultcapture -- 2.39.2