mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
v4l2videoenc: support force keyframe event in v4l2 encoder
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4663>
This commit is contained in:
parent
3a9c103b58
commit
8dd51501d0
1 changed files with 11 additions and 0 deletions
|
@ -817,6 +817,17 @@ gst_v4l2_video_enc_handle_frame (GstVideoEncoder * encoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame->input_buffer) {
|
if (frame->input_buffer) {
|
||||||
|
/* Process force keyframe event if it was passed */
|
||||||
|
if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (frame)) {
|
||||||
|
struct v4l2_control ctrl = { V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME, 1 };
|
||||||
|
if (self->v4l2output->ioctl (self->v4l2output->video_fd, VIDIOC_S_CTRL,
|
||||||
|
&ctrl) < 0)
|
||||||
|
GST_ELEMENT_WARNING (self, RESOURCE, FAILED,
|
||||||
|
(_("Failed to force keyframe.")),
|
||||||
|
("VIDIOC_S_CTRL (V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME) failed: %s (%d)",
|
||||||
|
g_strerror (errno), errno));
|
||||||
|
}
|
||||||
|
|
||||||
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
GST_VIDEO_ENCODER_STREAM_UNLOCK (encoder);
|
||||||
GST_LOG_OBJECT (encoder, "Passing buffer with frame number %u",
|
GST_LOG_OBJECT (encoder, "Passing buffer with frame number %u",
|
||||||
frame->system_frame_number);
|
frame->system_frame_number);
|
||||||
|
|
Loading…
Reference in a new issue