Commit fa0911c3 authored by Sreerenj Balachandran's avatar Sreerenj Balachandran

msdk: encoder: register only the required properties

The base encoder common properties are not valid for
mjpeg encoder where there is no motion compensation or rate control.
Delaying the property installation on the base gobject
untill the subclass class_init get invoked.

https://bugzilla.gnome.org/show_bug.cgi?id=791637
parent 0156d391
This diff is collapsed.
......@@ -58,6 +58,33 @@ typedef struct _GstMsdkEnc GstMsdkEnc;
typedef struct _GstMsdkEncClass GstMsdkEncClass;
typedef struct _MsdkEncTask MsdkEncTask;
enum
{
GST_MSDKENC_PROP_0,
GST_MSDKENC_PROP_HARDWARE,
GST_MSDKENC_PROP_ASYNC_DEPTH,
GST_MSDKENC_PROP_TARGET_USAGE,
GST_MSDKENC_PROP_RATE_CONTROL,
GST_MSDKENC_PROP_BITRATE,
GST_MSDKENC_PROP_MAX_FRAME_SIZE,
GST_MSDKENC_PROP_MAX_VBV_BITRATE,
GST_MSDKENC_PROP_AVBR_ACCURACY,
GST_MSDKENC_PROP_AVBR_CONVERGENCE,
GST_MSDKENC_PROP_RC_LOOKAHEAD_DEPTH,
GST_MSDKENC_PROP_QPI,
GST_MSDKENC_PROP_QPP,
GST_MSDKENC_PROP_QPB,
GST_MSDKENC_PROP_GOP_SIZE,
GST_MSDKENC_PROP_REF_FRAMES,
GST_MSDKENC_PROP_I_FRAMES,
GST_MSDKENC_PROP_B_FRAMES,
GST_MSDKENC_PROP_NUM_SLICES,
GST_MSDKENC_PROP_MBBRC,
GST_MSDKENC_PROP_ADAPTIVE_I,
GST_MSDKENC_PROP_ADAPTIVE_B,
GST_MSDKENC_PROP_MAX,
};
struct _GstMsdkEnc
{
GstVideoEncoder element;
......@@ -133,6 +160,16 @@ GType gst_msdkenc_get_type (void);
void gst_msdkenc_add_extra_param (GstMsdkEnc * thiz, mfxExtBuffer * param);
void
gst_msdkenc_install_common_properties (GstMsdkEncClass *encoder_class);
gboolean
gst_msdkenc_set_common_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
gboolean
gst_msdkenc_get_common_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
G_END_DECLS
#endif /* __GST_MSDKENC_H__ */
......@@ -43,8 +43,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_msdkh264enc_debug);
enum
{
PROP_0,
PROP_CABAC,
PROP_CABAC = GST_MSDKENC_PROP_MAX,
PROP_LOW_POWER,
PROP_FRAME_PACKING,
};
......@@ -382,14 +381,11 @@ gst_msdkh264enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkH264Enc *thiz = GST_MSDKH264ENC (object);
GstState state;
GST_OBJECT_LOCK (thiz);
if (gst_msdkenc_set_common_property (object, prop_id, value, pspec))
return;
state = GST_STATE (thiz);
if ((state != GST_STATE_READY && state != GST_STATE_NULL) &&
!(pspec->flags & GST_PARAM_MUTABLE_PLAYING))
goto wrong_state;
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case PROP_CABAC:
......@@ -407,13 +403,6 @@ gst_msdkh264enc_set_property (GObject * object, guint prop_id,
}
GST_OBJECT_UNLOCK (thiz);
return;
/* ERROR */
wrong_state:
{
GST_WARNING_OBJECT (thiz, "setting property in wrong state");
GST_OBJECT_UNLOCK (thiz);
}
}
static void
......@@ -422,6 +411,9 @@ gst_msdkh264enc_get_property (GObject * object, guint prop_id, GValue * value,
{
GstMsdkH264Enc *thiz = GST_MSDKH264ENC (object);
if (gst_msdkenc_get_common_property (object, prop_id, value, pspec))
return;
GST_OBJECT_LOCK (thiz);
switch (prop_id) {
case PROP_CABAC:
......@@ -462,6 +454,8 @@ gst_msdkh264enc_class_init (GstMsdkH264EncClass * klass)
encoder_class->configure = gst_msdkh264enc_configure;
encoder_class->set_src_caps = gst_msdkh264enc_set_src_caps;
gst_msdkenc_install_common_properties (encoder_class);
g_object_class_install_property (gobject_class, PROP_CABAC,
g_param_spec_boolean ("cabac", "CABAC", "Enable CABAC entropy coding",
PROP_CABAC_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
......
......@@ -155,19 +155,46 @@ gst_msdkh265enc_set_src_caps (GstMsdkEnc * encoder)
return caps;
}
static void
gst_msdkh265enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
if (!gst_msdkenc_set_common_property (object, prop_id, value, pspec))
GST_WARNING_OBJECT (thiz, "Failed to set common encode property");
}
static void
gst_msdkh265enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
if (!gst_msdkenc_get_common_property (object, prop_id, value, pspec))
GST_WARNING_OBJECT (thiz, "Failed to get common encode property");
}
static void
gst_msdkh265enc_class_init (GstMsdkH265EncClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkEncClass *encoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
encoder_class = GST_MSDKENC_CLASS (klass);
gobject_class->set_property = gst_msdkh265enc_set_property;
gobject_class->get_property = gst_msdkh265enc_get_property;
encoder_class->set_format = gst_msdkh265enc_set_format;
encoder_class->configure = gst_msdkh265enc_configure;
encoder_class->set_src_caps = gst_msdkh265enc_set_src_caps;
gst_msdkenc_install_common_properties (encoder_class);
gst_element_class_set_static_metadata (element_class,
"Intel MSDK H265 encoder",
"Codec/Encoder/Video",
......
......@@ -148,19 +148,46 @@ gst_msdkmpeg2enc_set_src_caps (GstMsdkEnc * encoder)
return caps;
}
static void
gst_msdkmpeg2enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkMPEG2Enc *thiz = GST_MSDKMPEG2ENC (object);
if (!gst_msdkenc_set_common_property (object, prop_id, value, pspec))
GST_WARNING_OBJECT (thiz, "Failed to set common encode property");
}
static void
gst_msdkmpeg2enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkMPEG2Enc *thiz = GST_MSDKMPEG2ENC (object);
if (!gst_msdkenc_get_common_property (object, prop_id, value, pspec))
GST_WARNING_OBJECT (thiz, "Failed to get common encode property");
}
static void
gst_msdkmpeg2enc_class_init (GstMsdkMPEG2EncClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkEncClass *encoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
encoder_class = GST_MSDKENC_CLASS (klass);
gobject_class->set_property = gst_msdkmpeg2enc_set_property;
gobject_class->get_property = gst_msdkmpeg2enc_get_property;
encoder_class->set_format = gst_msdkmpeg2enc_set_format;
encoder_class->configure = gst_msdkmpeg2enc_configure;
encoder_class->set_src_caps = gst_msdkmpeg2enc_set_src_caps;
gst_msdkenc_install_common_properties (encoder_class);
gst_element_class_set_static_metadata (element_class,
"Intel MSDK MPEG2 encoder",
"Codec/Encoder/Video",
......
......@@ -174,19 +174,46 @@ gst_msdkvp8enc_set_src_caps (GstMsdkEnc * encoder)
return caps;
}
static void
gst_msdkvp8enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMsdkVP8Enc *thiz = GST_MSDKVP8ENC (object);
if (!gst_msdkenc_set_common_property (object, prop_id, value, pspec))
GST_WARNING_OBJECT (thiz, "Failed to set common encode property");
}
static void
gst_msdkvp8enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMsdkVP8Enc *thiz = GST_MSDKVP8ENC (object);
if (!gst_msdkenc_get_common_property (object, prop_id, value, pspec))
GST_WARNING_OBJECT (thiz, "Failed to get common encode property");
}
static void
gst_msdkvp8enc_class_init (GstMsdkVP8EncClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstMsdkEncClass *encoder_class;
gobject_class = G_OBJECT_CLASS (klass);
element_class = GST_ELEMENT_CLASS (klass);
encoder_class = GST_MSDKENC_CLASS (klass);
gobject_class->set_property = gst_msdkvp8enc_set_property;
gobject_class->get_property = gst_msdkvp8enc_get_property;
encoder_class->set_format = gst_msdkvp8enc_set_format;
encoder_class->configure = gst_msdkvp8enc_configure;
encoder_class->set_src_caps = gst_msdkvp8enc_set_src_caps;
gst_msdkenc_install_common_properties (encoder_class);
gst_element_class_set_static_metadata (element_class,
"Intel MSDK VP8 encoder",
"Codec/Encoder/Video",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment