Commit 2037cdcd authored by Gus Grubba's avatar Gus Grubba

Allow setting a path and filename for the recorded video (optional)

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