Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Val Doroshchuk
qtgstreamerextras
Commits
7ad6ec0f
Commit
7ad6ec0f
authored
Dec 17, 2018
by
Val Doroshchuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
empty caps
parent
6d2c5280
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
src/gstreamerextras/qgstreamerappsrc.cpp
src/gstreamerextras/qgstreamerappsrc.cpp
+16
-6
No files found.
src/gstreamerextras/qgstreamerappsrc.cpp
View file @
7ad6ec0f
...
...
@@ -54,7 +54,7 @@ public:
{
}
void
restart
(
QVideoFrame
&
frame
);
bool
restart
(
QVideoFrame
&
frame
);
private:
GstElement
*
appsrc
=
nullptr
;
...
...
@@ -64,11 +64,20 @@ private:
QSize
size
;
};
void
QGstreamerAppSrcPrivate
::
restart
(
QVideoFrame
&
frame
)
bool
QGstreamerAppSrcPrivate
::
restart
(
QVideoFrame
&
frame
)
{
QList
<
QVideoFrame
::
PixelFormat
>
cc
;
cc
<<
frame
.
pixelFormat
();
auto
format
=
frame
.
pixelFormat
();
if
(
format
==
QVideoFrame
::
Format_ARGB32_Premultiplied
)
format
=
QVideoFrame
::
Format_RGB32
;
cc
<<
format
;
GstCaps
*
caps
=
QGstUtils
::
capsForFormats
(
cc
);
if
(
!
caps
||
gst_caps_is_empty
(
caps
))
{
qWarning
()
<<
"Could not create caps for"
<<
frame
.
pixelFormat
();
return
false
;
}
gst_caps_set_simple
(
caps
,
"framerate"
,
GST_TYPE_FRACTION
,
30
,
1
,
...
...
@@ -79,6 +88,7 @@ void QGstreamerAppSrcPrivate::restart(QVideoFrame &frame)
g_object_set
(
G_OBJECT
(
appsrc
),
"caps"
,
caps
,
NULL
);
gst_caps_unref
(
caps
);
size
=
frame
.
size
();
return
true
;
}
static
void
start_feed
(
GstElement
*
pipeline
,
guint
size
,
QGstreamerAppSrc
*
q
)
...
...
@@ -128,11 +138,11 @@ void QGstreamerAppSrc::timerEvent(QTimerEvent *event)
return
;
QVideoFrame
frame
=
readFrame
();
if
(
!
frame
.
isValid
()
||
!
frame
.
map
(
QAbstractVideoBuffer
::
ReadOnly
))
if
(
d
->
size
!=
frame
.
size
()
&&
!
d
->
restart
(
frame
))
return
;
if
(
d
->
size
!=
frame
.
size
(
))
d
->
restart
(
frame
)
;
if
(
!
frame
.
isValid
()
||
!
frame
.
map
(
QAbstractVideoBuffer
::
ReadOnly
))
return
;
auto
app_buffer
=
gst_buffer_new
();
int
size
=
frame
.
bytesPerLine
()
*
frame
.
height
();
...
...
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