mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
v4l2videodec: add gst_v4l2_decoder_cmd helper
https://bugzilla.gnome.org/show_bug.cgi?id=733864
This commit is contained in:
parent
24862c2f74
commit
ddf7d9d6de
1 changed files with 31 additions and 0 deletions
|
@ -293,6 +293,37 @@ gst_v4l2_video_dec_negotiate (GstVideoDecoder * decoder)
|
|||
return GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_v4l2_decoder_cmd (GstV4l2Object * v4l2object, guint cmd, guint flags)
|
||||
{
|
||||
struct v4l2_decoder_cmd dcmd = { 0, };
|
||||
|
||||
GST_DEBUG_OBJECT (v4l2object->element,
|
||||
"sending v4l2 decoder command %u with flags %u", cmd, flags);
|
||||
|
||||
if (!GST_V4L2_IS_OPEN (v4l2object))
|
||||
return FALSE;
|
||||
|
||||
dcmd.cmd = cmd;
|
||||
dcmd.flags = flags;
|
||||
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_DECODER_CMD, &dcmd) < 0)
|
||||
goto dcmd_failed;
|
||||
|
||||
return TRUE;
|
||||
|
||||
dcmd_failed:
|
||||
if (errno == ENOTTY) {
|
||||
GST_INFO_OBJECT (v4l2object->element,
|
||||
"Failed to send decoder command %u with flags %u for '%s'. (%s)",
|
||||
cmd, flags, v4l2object->videodev, g_strerror (errno));
|
||||
} else {
|
||||
GST_ERROR_OBJECT (v4l2object->element,
|
||||
"Failed to send decoder command %u with flags %u for '%s'. (%s)",
|
||||
cmd, flags, v4l2object->videodev, g_strerror (errno));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_v4l2_video_dec_finish (GstVideoDecoder * decoder)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue