Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GStreamer
gst-plugins-good
Commits
6858c822
Commit
6858c822
authored
Jul 27, 2021
by
Qi Hou
Browse files
v4l2: Keep decoder capture fps same as output fps if it's not set
Part-of: <
!1035
>
parent
4a5197dc
Pipeline
#372953
waiting for manual action with stages
in 44 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
sys/v4l2/gstv4l2object.c
View file @
6858c822
...
...
@@ -2219,6 +2219,26 @@ done:
return
ret
;
}
static
gboolean
gst_v4l2_object_get_streamparm
(
GstV4l2Object
*
v4l2object
,
GstVideoInfo
*
info
)
{
struct
v4l2_streamparm
streamparm
;
memset
(
&
streamparm
,
0x00
,
sizeof
(
struct
v4l2_streamparm
));
streamparm
.
type
=
v4l2object
->
type
;
if
(
v4l2object
->
ioctl
(
v4l2object
->
video_fd
,
VIDIOC_G_PARM
,
&
streamparm
)
<
0
)
{
GST_WARNING_OBJECT
(
v4l2object
->
dbg_obj
,
"VIDIOC_G_PARM failed"
);
return
FALSE
;
}
if
(
v4l2object
->
type
==
V4L2_BUF_TYPE_VIDEO_CAPTURE
||
v4l2object
->
type
==
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
)
{
GST_VIDEO_INFO_FPS_N
(
info
)
=
streamparm
.
parm
.
capture
.
timeperframe
.
denominator
;
GST_VIDEO_INFO_FPS_D
(
info
)
=
streamparm
.
parm
.
capture
.
timeperframe
.
numerator
;
}
return
TRUE
;
}
static
int
gst_v4l2_object_try_fmt
(
GstV4l2Object
*
v4l2object
,
struct
v4l2_format
*
try_fmt
)
...
...
@@ -4218,6 +4238,14 @@ gst_v4l2_object_acquire_format (GstV4l2Object * v4l2object, GstVideoInfo * info)
height
);
gst_v4l2_object_get_colorspace
(
v4l2object
,
&
fmt
,
&
info
->
colorimetry
);
gst_v4l2_object_get_streamparm
(
v4l2object
,
info
);
if
((
info
->
fps_n
==
0
)
&&
(
v4l2object
->
type
==
V4L2_BUF_TYPE_VIDEO_CAPTURE
||
v4l2object
->
type
==
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
))
{
info
->
fps_d
=
v4l2object
->
info
.
fps_d
;
info
->
fps_n
=
v4l2object
->
info
.
fps_n
;
GST_DEBUG_OBJECT
(
v4l2object
->
dbg_obj
,
"Set capture fps to %d/%d"
,
info
->
fps_n
,
info
->
fps_d
);
}
gst_v4l2_object_save_format
(
v4l2object
,
fmtdesc
,
&
fmt
,
info
,
&
align
);
...
...
sys/v4l2/gstv4l2videodec.c
View file @
6858c822
...
...
@@ -690,6 +690,10 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
gst_buffer_unref
(
codec_data
);
/* init capture fps according to output */
self
->
v4l2capture
->
info
.
fps_d
=
self
->
v4l2output
->
info
.
fps_d
;
self
->
v4l2capture
->
info
.
fps_n
=
self
->
v4l2output
->
info
.
fps_n
;
/* For decoders G_FMT returns coded size, G_SELECTION returns visible size
* in the compose rectangle. gst_v4l2_object_acquire_format() checks both
* and returns the visible size as with/height and the coded size as
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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