Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1cdb2e1e authored by Roger Morton's avatar Roger Morton Committed by Vincent PINON

fix mantis#3415: FFmpeg recording freeze

parent 94d73b32
......@@ -15,7 +15,6 @@
* *
***************************************************************************/
#include "mltdevicecapture.h"
#include "kdenlivesettings.h"
......@@ -180,7 +179,7 @@ void MltDeviceCapture::stop()
if (m_mltConsumer) {
m_mltConsumer->set("refresh", 0);
m_mltConsumer->purge();
m_mltConsumer->stop();
m_mltConsumer->stop();
//if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
}
if (m_mltProducer) {
......@@ -395,10 +394,10 @@ bool MltDeviceCapture::slotStartCapture(const QString &params, const QString &pa
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("terminate_on_pause", 0);// was commented out. restoring it fixes mantis#3415 - FFmpeg recording freezes
// without this line a call to mlt_properties_get_int(terminate on pause) for in mlt/src/modules/core/consumer_multi.c is returning 1
// and going into and endless loop.
renderProps->set("mlt_profile", m_activeProfile.toUtf8().constData());
QStringList paramList = params.split(' ', QString::SkipEmptyParts);
for (int i = 0; i < paramList.count(); ++i) {
tmp = qstrdup(paramList.at(i).section('=', 0, 0).toUtf8().constData());
......
......@@ -15,11 +15,16 @@
* *
***************************************************************************/
/**
/*!
* @class MltDeviceCapture
* @brief Interface for MLT capture.
* Capturing started by MltDeviceCapture::slotStartCapture ()
*
* Capturing is stopped by RecMonitor::slotStopCapture()
*/
#ifndef MLTDEVICECAPTURE_H
#define MLTDEVICECAPTURE_H
......@@ -71,6 +76,7 @@ Q_OBJECT public:
/** @brief Starts the MLT Video4Linux process.
* @param surface The widget onto which the frame should be painted
* Called by RecMonitor::slotRecord ()
*/
bool slotStartCapture(const QString &params, const QString &path, const QString &playlist, bool livePreview, bool xmlPlaylist = true);
bool slotStartPreview(const QString &producer, bool xmlFormat = false);
......
......@@ -36,6 +36,13 @@ class DocumentChecker: public QObject
public:
explicit DocumentChecker(const QDomNodeList &infoproducers, const QDomDocument &doc);
~DocumentChecker();
/**
* @brief checks for problems with the clips in the project
* Checks for missing proxies, wrong duration clips, missing fonts, missing images, missing source clips
* Calls DocumentChecker::checkMissingImagesAndFonts () /n
* Called by KdenliveDoc::checkDocumentClips () /n
* @return
*/
bool hasErrorInClips();
private slots:
......
......@@ -199,6 +199,12 @@ private:
void setNewClipResource(const QString &id, const QString &path);
QString searchFileRecursively(const QDir &dir, const QString &matchSize, const QString &matchHash) const;
void moveProjectData(const KUrl &url);
/**
* @brief check for issues with the clips in the project
* Instansiates DocumentChecker objects to do this task.
* @param infoproducers
* @return
*/
bool checkDocumentClips(QDomNodeList infoproducers);
/** @brief Creates a new project. */
......@@ -217,6 +223,13 @@ public slots:
void slotCreateXmlClip(const QString &name, const QDomElement &xml, const QString &group, const QString &groupId);
void slotCreateColorClip(const QString &name, const QString &color, const QString &duration, const QString &group, const QString &groupId);
void slotCreateSlideshowClipFile(const QMap<QString, QString> &properties, const QString &group, const QString &groupId);
/**
* @brief Create a title clip.
* Instansiates TitleWidget objects
* @param group
* @param groupId
* @param templatePath
*/
void slotCreateTextClip(QString group, const QString &groupId, const QString &templatePath = QString());
void slotCreateTextTemplateClip(const QString &group, const QString &groupId, KUrl path);
......
......@@ -591,6 +591,11 @@ void RecMonitor::slotStartPreview(bool play)
void RecMonitor::slotRecord()
{
m_error.clear();
video_frame->setText(i18n(""));// clear error text from previous run if any.
// ^^ This does clear the error text but the change is not visible straight way in the UI
// it only becomes visible after the capture is complete. Vincent and JBM - how come? What can
// we do to make the error text go way as soon as a new capture starts. It is missleading to the user
// to have the error still display while we are happily capturing.
if (m_captureProcess->state() == QProcess::NotRunning && device_selector->currentIndex() == Firewire) {
slotStartPreview();
}
......@@ -641,7 +646,7 @@ void RecMonitor::slotRecord()
if (capturename.isEmpty()) capturename = "capture";
switch (device_selector->currentIndex()) {
case Video4Linux:
case Video4Linux: //ffmpeg capture
if (rec_video->isChecked()) slotActivateMonitor();
path = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
profile = ProfilesDialog::getVideoProfile(path);
......@@ -691,19 +696,19 @@ void RecMonitor::slotRecord()
m_recAction->setEnabled(false);
m_stopAction->setEnabled(true);
m_previewSettings->setEnabled(false);
control_frame->setEnabled(false);
control_frame->setEnabled(false);
}
else {
video_frame->setText(i18n("Failed to start Video4Linux,\ncheck your parameters..."));
video_frame->setText(i18n("Failed to start ffmpeg capture,\ncheck your parameters..."));
videoBox->setHidden(true);
m_recAction->blockSignals(true);
m_recAction->setChecked(false);
m_recAction->blockSignals(false);
m_recAction->blockSignals(true);
m_recAction->setChecked(false);
m_recAction->blockSignals(false);
m_isCapturing = false;
}
break;
case BlackMagic:
case BlackMagic:// BlackMagic capture
slotActivateMonitor();
path = KdenliveSettings::current_profile();
profile = ProfilesDialog::getVideoProfile(path);
......@@ -727,7 +732,7 @@ void RecMonitor::slotRecord()
}
break;
case ScreenBag:
case ScreenBag:// screen grab capture
m_captureArgs << "-f" << "x11grab";
if (KdenliveSettings::grab_follow_mouse()) m_captureArgs << "-follow_mouse" << "centered";
if (!KdenliveSettings::grab_hide_frame()) m_captureArgs << "-show_region" << "1";
......
......@@ -17,10 +17,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
/**
/*!
* @class RecMonitor
* @brief Records video via dvgrab, video4linux and recordmydesktop
* @brief Records video via dvgrab (firewire), ffmpeg=video4linux and screen capture also via ffmpeg
* @author Jean-Baptiste Mardelle
* Recording is started by RecMonitor::slotRecord ()
* Recording stoped in RecMonitor::slotStopCapture ()
*/
#ifndef RECMONITOR_H
......@@ -127,6 +129,12 @@ private:
private slots:
void slotStartPreview(bool play = true);
/**
* @brief Starts recording from the Record Monitor tab.
* 4 different recording modes
* Firewire, ScreenBag (=Screen Grab), Video4Linux (=Ffmepg) and BlackMagic. \n
* calls MltDeviceCapture::slotStartCapture ()
*/
void slotRecord();
void slotProcessStatus(QProcess::ProcessState status);
void slotVideoDeviceChanged(int ix);
......@@ -148,6 +156,9 @@ public slots:
void slotPlay();
void stop();
void start();
/**
* @brief Stops the RecMonitor capturing
*/
void slotStopCapture();
void slotUpdateCaptureFolder(const QString &currentProjectFolder);
void slotMouseSeek(int eventDelta, bool fast);
......
......@@ -50,7 +50,10 @@ public:
double rotatex, rotatey, rotatez;
};
/*! \class KdenliveDoc
\brief Represents a kdenlive project file
Instances of TitleWidget classes are instansiated by KdenliveDoc::slotCreateTextClip ()
*/
class TitleWidget : public QDialog , public Ui::TitleWidget_UI
{
Q_OBJECT
......@@ -73,9 +76,10 @@ public:
* @return list of the image files */
static QStringList extractImageList(const QString &xml);
/** @brief Checks for the fonts referenced by a title clip.
/** @brief Checks for the fonts referenced by a title clip.\n
* Called by DocumentChecker::hasErrorInClips () \n
* @param xml XML data representing the title
* @return list of the fonts */
* @return list of the fonts in the title */
static QStringList extractFontList(const QString &xml);
/** @brief Returns clip duration. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment