Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1efd240d
Commit
1efd240d
authored
Jan 04, 2017
by
Jacob Walser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging category for VideoReceiver
parent
38ede336
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
VideoReceiver.cc
src/VideoStreaming/VideoReceiver.cc
+10
-8
VideoReceiver.h
src/VideoStreaming/VideoReceiver.h
+3
-0
No files found.
src/VideoStreaming/VideoReceiver.cc
View file @
1efd240d
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#include <QDateTime>
#include <QDateTime>
#include <QSysInfo>
#include <QSysInfo>
QGC_LOGGING_CATEGORY
(
VideoReceiverLog
,
"VideoReceiverLog"
)
VideoReceiver
::
Sink
*
VideoReceiver
::
_sink
=
NULL
;
VideoReceiver
::
Sink
*
VideoReceiver
::
_sink
=
NULL
;
GstElement
*
VideoReceiver
::
_pipeline
=
NULL
;
GstElement
*
VideoReceiver
::
_pipeline
=
NULL
;
GstElement
*
VideoReceiver
::
_pipeline2
=
NULL
;
GstElement
*
VideoReceiver
::
_pipeline2
=
NULL
;
...
@@ -94,7 +96,7 @@ GstPadProbeReturn VideoReceiver::_unlinkCB(GstPad* pad, GstPadProbeInfo* info, g
...
@@ -94,7 +96,7 @@ GstPadProbeReturn VideoReceiver::_unlinkCB(GstPad* pad, GstPadProbeInfo* info, g
gst_object_unref
(
bus
);
gst_object_unref
(
bus
);
if
(
gst_element_set_state
(
_pipeline2
,
GST_STATE_PLAYING
)
==
GST_STATE_CHANGE_FAILURE
)
{
if
(
gst_element_set_state
(
_pipeline2
,
GST_STATE_PLAYING
)
==
GST_STATE_CHANGE_FAILURE
)
{
q
Debug
(
)
<<
"problem starting pipeline2"
;
q
CDebug
(
VideoReceiverLog
)
<<
"problem starting pipeline2"
;
}
}
// Send EOS at the beginning of the pipeline
// Send EOS at the beginning of the pipeline
...
@@ -139,7 +141,7 @@ void VideoReceiver::startRecording(void)
...
@@ -139,7 +141,7 @@ void VideoReceiver::startRecording(void)
fileName
=
_path
+
"/QGC-"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd-hh:mm:ss"
)
+
".mkv"
;
fileName
=
_path
+
"/QGC-"
+
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd-hh:mm:ss"
)
+
".mkv"
;
}
}
g_object_set
(
G_OBJECT
(
_sink
->
filesink
),
"location"
,
qPrintable
(
fileName
),
NULL
);
g_object_set
(
G_OBJECT
(
_sink
->
filesink
),
"location"
,
qPrintable
(
fileName
),
NULL
);
q
Debug
(
)
<<
"New video file:"
<<
fileName
;
q
CDebug
(
VideoReceiverLog
)
<<
"New video file:"
<<
fileName
;
gst_object_ref
(
_sink
->
queue
);
gst_object_ref
(
_sink
->
queue
);
gst_object_ref
(
_sink
->
mux
);
gst_object_ref
(
_sink
->
mux
);
...
@@ -169,8 +171,8 @@ void VideoReceiver::stopRecording(void)
...
@@ -169,8 +171,8 @@ void VideoReceiver::stopRecording(void)
return
;
return
;
}
}
// Wait for data block before unlinking
gst_pad_add_probe
(
_sink
->
teepad
,
GST_PAD_PROBE_TYPE_IDLE
,
_unlinkCB
,
_sink
,
NULL
);
gst_pad_add_probe
(
_sink
->
teepad
,
GST_PAD_PROBE_TYPE_IDLE
,
_unlinkCB
,
_sink
,
NULL
);
_recording
=
false
;
_recording
=
false
;
emit
recordingChanged
();
emit
recordingChanged
();
#endif
#endif
...
@@ -225,7 +227,7 @@ static void newPadCB(GstElement* element, GstPad* pad, gpointer data)
...
@@ -225,7 +227,7 @@ static void newPadCB(GstElement* element, GstPad* pad, gpointer data)
g_print
(
"A new pad %s was created
\n
"
,
name
);
g_print
(
"A new pad %s was created
\n
"
,
name
);
GstCaps
*
p_caps
=
gst_pad_get_pad_template_caps
(
pad
);
GstCaps
*
p_caps
=
gst_pad_get_pad_template_caps
(
pad
);
gchar
*
description
=
gst_caps_to_string
(
p_caps
);
gchar
*
description
=
gst_caps_to_string
(
p_caps
);
q
Debug
(
)
<<
p_caps
<<
", "
<<
description
;
q
CDebug
(
VideoReceiverLog
)
<<
p_caps
<<
", "
<<
description
;
g_free
(
description
);
g_free
(
description
);
GstElement
*
p_rtph264depay
=
GST_ELEMENT
(
data
);
GstElement
*
p_rtph264depay
=
GST_ELEMENT
(
data
);
if
(
gst_element_link_pads
(
element
,
name
,
p_rtph264depay
,
"sink"
)
==
false
)
if
(
gst_element_link_pads
(
element
,
name
,
p_rtph264depay
,
"sink"
)
==
false
)
...
@@ -273,7 +275,7 @@ void VideoReceiver::_timeout()
...
@@ -273,7 +275,7 @@ void VideoReceiver::_timeout()
_socket
=
new
QTcpSocket
;
_socket
=
new
QTcpSocket
;
connect
(
_socket
,
static_cast
<
void
(
QTcpSocket
::*
)(
QAbstractSocket
::
SocketError
)
>
(
&
QTcpSocket
::
error
),
this
,
&
VideoReceiver
::
_socketError
);
connect
(
_socket
,
static_cast
<
void
(
QTcpSocket
::*
)(
QAbstractSocket
::
SocketError
)
>
(
&
QTcpSocket
::
error
),
this
,
&
VideoReceiver
::
_socketError
);
connect
(
_socket
,
&
QTcpSocket
::
connected
,
this
,
&
VideoReceiver
::
_connected
);
connect
(
_socket
,
&
QTcpSocket
::
connected
,
this
,
&
VideoReceiver
::
_connected
);
//q
Debug(
) << "Trying to connect to:" << url.host() << url.port();
//q
CDebug(VideoReceiverLog
) << "Trying to connect to:" << url.host() << url.port();
_socket
->
connectToHost
(
url
.
host
(),
url
.
port
());
_socket
->
connectToHost
(
url
.
host
(),
url
.
port
());
_timer
.
start
(
5000
);
_timer
.
start
(
5000
);
}
}
...
@@ -447,7 +449,7 @@ void VideoReceiver::start()
...
@@ -447,7 +449,7 @@ void VideoReceiver::start()
_pipeline
=
NULL
;
_pipeline
=
NULL
;
}
}
}
}
q
Debug
(
)
<<
"Video Receiver started."
;
q
CDebug
(
VideoReceiverLog
)
<<
"Video Receiver started."
;
#endif
#endif
}
}
...
@@ -455,7 +457,7 @@ void VideoReceiver::stop()
...
@@ -455,7 +457,7 @@ void VideoReceiver::stop()
{
{
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
if
(
_pipeline
!=
NULL
)
{
if
(
_pipeline
!=
NULL
)
{
q
Debug
(
)
<<
"Stopping pipeline"
;
q
CDebug
(
VideoReceiverLog
)
<<
"Stopping pipeline"
;
stopRecording
();
stopRecording
();
gst_element_set_state
(
_pipeline
,
GST_STATE_NULL
);
gst_element_set_state
(
_pipeline
,
GST_STATE_NULL
);
gst_object_unref
(
_pipeline
);
gst_object_unref
(
_pipeline
);
...
@@ -475,7 +477,7 @@ void VideoReceiver::setUri(const QString & uri)
...
@@ -475,7 +477,7 @@ void VideoReceiver::setUri(const QString & uri)
void
VideoReceiver
::
setVideoSavePath
(
const
QString
&
path
)
void
VideoReceiver
::
setVideoSavePath
(
const
QString
&
path
)
{
{
_path
=
path
;
_path
=
path
;
q
Debug
(
)
<<
"New Path:"
<<
_path
;
q
CDebug
(
VideoReceiverLog
)
<<
"New Path:"
<<
_path
;
}
}
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
...
...
src/VideoStreaming/VideoReceiver.h
View file @
1efd240d
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#ifndef VIDEORECEIVER_H
#ifndef VIDEORECEIVER_H
#define VIDEORECEIVER_H
#define VIDEORECEIVER_H
#include "QGCLoggingCategory.h"
#include <QObject>
#include <QObject>
#include <QTimer>
#include <QTimer>
#include <QTcpSocket>
#include <QTcpSocket>
...
@@ -25,6 +26,8 @@
...
@@ -25,6 +26,8 @@
#include <gst/gst.h>
#include <gst/gst.h>
#endif
#endif
Q_DECLARE_LOGGING_CATEGORY
(
VideoReceiverLog
)
class
VideoReceiver
:
public
QObject
class
VideoReceiver
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment