Skip to content

Commit

Permalink
v4l2: add handler of Controls ID
Browse files Browse the repository at this point in the history
The exist implement could handle extra controls well, but in
the properties of v4l2 encoder and decoder class, it is ignored.
I just bring it back and make the leaf class will default use it.
  • Loading branch information
hizukiayaka committed May 15, 2016
1 parent ce86ab9 commit 92b99ba
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
18 changes: 4 additions & 14 deletions sys/v4l2/gstv4l2h264enc.c
Expand Up @@ -52,26 +52,16 @@ static void
gst_v4l2_h264_enc_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstV4l2H264Enc *self = GST_V4L2_H264_ENC (object);

switch (prop_id) {
/* By default, only set on output */
default:
break;
}
GST_V4L2_VIDEO_ENC_CLASS(parent_class)->set_property
(object, prop_id, value, pspec);
}

static void
gst_v4l2_h264_enc_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstV4l2H264Enc *self = GST_V4L2_H264_ENC (object);

switch (prop_id) {
/* By default read from output */
default:
break;
}
GST_V4L2_VIDEO_ENC_CLASS(parent_class)->get_property
(object, prop_id, value, pspec);
}

static GstFlowReturn
Expand Down
8 changes: 8 additions & 0 deletions sys/v4l2/gstv4l2videodec.c
Expand Up @@ -72,6 +72,10 @@ gst_v4l2_video_dec_set_property (GObject * object,
gst_v4l2_object_set_property_helper (self->v4l2capture, prop_id, value,
pspec);
break;
case PROP_EXTRA_CONTROLS:
gst_v4l2_object_set_property_helper (self->v4l2output, prop_id, value,
pspec);
break;

/* By default, only set on output */
default:
Expand All @@ -98,6 +102,10 @@ gst_v4l2_video_dec_get_property (GObject * object,
gst_v4l2_object_get_property_helper (self->v4l2capture, prop_id, value,
pspec);
break;
case PROP_EXTRA_CONTROLS:
gst_v4l2_object_get_property_helper (self->v4l2output, prop_id, value,
pspec);
break;

/* By default read from output */
default:
Expand Down
16 changes: 14 additions & 2 deletions sys/v4l2/gstv4l2videoenc.c
Expand Up @@ -52,7 +52,7 @@ enum
G_DEFINE_ABSTRACT_TYPE (GstV4l2VideoEnc, gst_v4l2_video_enc,
GST_TYPE_VIDEO_ENCODER);

static void
void
gst_v4l2_video_enc_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
Expand All @@ -76,6 +76,10 @@ gst_v4l2_video_enc_set_property (GObject * object,
gst_v4l2_object_set_property_helper (self->v4l2capture,
prop_id, value, pspec);
break;
case PROP_EXTRA_CONTROLS:
gst_v4l2_object_set_property_helper (self->v4l2output,
prop_id, value, pspec);
break;

/* By default, only set on output */
default:
Expand All @@ -87,7 +91,7 @@ gst_v4l2_video_enc_set_property (GObject * object,
}
}

static void
void
gst_v4l2_video_enc_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
Expand All @@ -103,6 +107,10 @@ gst_v4l2_video_enc_get_property (GObject * object,
PROP_IO_MODE, value, pspec);
break;

case PROP_EXTRA_CONTROLS:
gst_v4l2_object_get_property_helper (self->v4l2output,
prop_id, value, pspec);
break;
/* By default read from output */
default:
if (!gst_v4l2_object_get_property_helper (self->v4l2output,
Expand Down Expand Up @@ -789,6 +797,10 @@ gst_v4l2_video_enc_class_init (GstV4l2VideoEncClass * klass)
GST_DEBUG_FUNCPTR (gst_v4l2_video_enc_sink_event);
/* FIXME propose_allocation or not ? */
klass->handle_frame = GST_DEBUG_FUNCPTR (gst_v4l2_video_enc_handle_frame);
klass->set_property =
GST_DEBUG_FUNCPTR (gst_v4l2_video_enc_set_property);
klass->get_property =
GST_DEBUG_FUNCPTR (gst_v4l2_video_enc_get_property);

element_class->change_state =
GST_DEBUG_FUNCPTR (gst_v4l2_video_enc_change_state);
Expand Down
9 changes: 8 additions & 1 deletion sys/v4l2/gstv4l2videoenc.h
Expand Up @@ -73,8 +73,15 @@ struct _GstV4l2VideoEncClass

gchar *default_device;

GstFlowReturn (*handle_frame) (GstVideoEncoder * encoder,
GstFlowReturn (*handle_frame) (GstVideoEncoder * encoder,
GstVideoCodecFrame * frame, GstCaps * outcaps);

void (*set_property) (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);

void (*get_property) (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);

};

GType gst_v4l2_video_enc_get_type (void);
Expand Down

0 comments on commit 92b99ba

Please sign in to comment.