Unverified Commit 93c9e91e authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #5949 from mavlink/nameVideoFile

Allow setting a path and filename for the recorded video (optional)
parents 35743f65 2037cdcd
......@@ -609,7 +609,7 @@ VideoReceiver::_cleanupOldVideos()
// | |
// +--------------------------------------+
void
VideoReceiver::startRecording(void)
VideoReceiver::startRecording(const QString &videoFile)
{
#if defined(QGC_GST_STREAMING)
......@@ -620,12 +620,6 @@ VideoReceiver::startRecording(void)
return;
}
QString savePath = qgcApp()->toolbox()->settingsManager()->appSettings()->videoSavePath();
if(savePath.isEmpty()) {
qgcApp()->showMessage(tr("Unabled to record video. Video save path must be specified in Settings."));
return;
}
uint32_t muxIdx = _videoSettings->recordingFormat()->rawValue().toUInt();
if(muxIdx >= NUM_MUXES) {
qgcApp()->showMessage(tr("Invalid video format defined."));
......@@ -648,11 +642,20 @@ VideoReceiver::startRecording(void)
return;
}
QString videoFile;
videoFile = savePath + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss") + "." + kVideoExtensions[muxIdx];
if(videoFile.isEmpty()) {
QString savePath = qgcApp()->toolbox()->settingsManager()->appSettings()->videoSavePath();
if(savePath.isEmpty()) {
qgcApp()->showMessage(tr("Unabled to record video. Video save path must be specified in Settings."));
return;
}
_videoFile = savePath + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss") + "." + kVideoExtensions[muxIdx];
} else {
_videoFile = videoFile;
}
emit videoFileChanged();
g_object_set(G_OBJECT(_sink->filesink), "location", qPrintable(videoFile), NULL);
qCDebug(VideoReceiverLog) << "New video file:" << videoFile;
g_object_set(G_OBJECT(_sink->filesink), "location", qPrintable(_videoFile), NULL);
qCDebug(VideoReceiverLog) << "New video file:" << _videoFile;
gst_object_ref(_sink->queue);
gst_object_ref(_sink->parse);
......
......@@ -42,6 +42,7 @@ public:
Q_PROPERTY(VideoSurface* videoSurface READ videoSurface CONSTANT)
Q_PROPERTY(bool videoRunning READ videoRunning NOTIFY videoRunningChanged)
Q_PROPERTY(QString imageFile READ imageFile NOTIFY imageFileChanged)
Q_PROPERTY(QString videoFile READ videoFile NOTIFY videoFileChanged)
Q_PROPERTY(bool showFullScreen READ showFullScreen WRITE setShowFullScreen NOTIFY showFullScreenChanged)
explicit VideoReceiver(QObject* parent = 0);
......@@ -58,6 +59,7 @@ public:
VideoSurface* videoSurface () { return _videoSurface; }
bool videoRunning () { return _videoRunning; }
QString imageFile () { return _imageFile; }
QString videoFile () { return _videoFile; }
bool showFullScreen () { return _showFullScreen; }
void grabImage (QString imageFile);
......@@ -67,6 +69,7 @@ public:
signals:
void videoRunningChanged ();
void imageFileChanged ();
void videoFileChanged ();
void showFullScreenChanged ();
#if defined(QGC_GST_STREAMING)
void recordingChanged ();
......@@ -80,7 +83,7 @@ public slots:
void stop ();
void setUri (const QString& uri);
void stopRecording ();
void startRecording ();
void startRecording (const QString& videoFile = QString());
private slots:
void _updateTimer ();
......@@ -136,6 +139,7 @@ private:
QString _uri;
QString _imageFile;
QString _videoFile;
VideoSurface* _videoSurface;
bool _videoRunning;
bool _showFullScreen;
......
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