vaapidecode_props: h264: add low latency property

Adding support for private data.

https://bugzilla.gnome.org/show_bug.cgi?id=783588
This commit is contained in:
Víctor Manuel Jáquez Leal 2017-06-14 18:31:18 +02:00
parent 484033d039
commit f39b7e97ce
2 changed files with 59 additions and 0 deletions

View file

@ -23,21 +23,70 @@
#include "gstvaapidecode_props.h" #include "gstvaapidecode_props.h"
enum
{
GST_VAAPI_DECODER_H264_PROP_FORCE_LOW_LATENCY = 1,
};
static gint h264_private_offset;
static void static void
gst_vaapi_decode_h264_get_property (GObject * object, guint prop_id, gst_vaapi_decode_h264_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstVaapiDecodeH264Private *priv;
priv = gst_vaapi_decode_h264_get_instance_private (object);
switch (prop_id) {
case GST_VAAPI_DECODER_H264_PROP_FORCE_LOW_LATENCY:
g_value_set_boolean (value, priv->is_low_latency);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
} }
static void static void
gst_vaapi_decode_h264_set_property (GObject * object, guint prop_id, gst_vaapi_decode_h264_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstVaapiDecodeH264Private *priv;
priv = gst_vaapi_decode_h264_get_instance_private (object);
switch (prop_id) {
case GST_VAAPI_DECODER_H264_PROP_FORCE_LOW_LATENCY:
priv->is_low_latency = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
} }
void void
gst_vaapi_decode_h264_install_properties (GObjectClass * klass) gst_vaapi_decode_h264_install_properties (GObjectClass * klass)
{ {
h264_private_offset = sizeof (GstVaapiDecodeH264Private);
g_type_class_adjust_private_offset (klass, &h264_private_offset);
klass->get_property = gst_vaapi_decode_h264_get_property; klass->get_property = gst_vaapi_decode_h264_get_property;
klass->set_property = gst_vaapi_decode_h264_set_property; klass->set_property = gst_vaapi_decode_h264_set_property;
g_object_class_install_property (klass,
GST_VAAPI_DECODER_H264_PROP_FORCE_LOW_LATENCY,
g_param_spec_boolean ("low-latency", "Force low latency mode",
"When enabled, frames will be pushed as soon as they are available. "
"It might violate the H.264 spec.", FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
}
GstVaapiDecodeH264Private *
gst_vaapi_decode_h264_get_instance_private (gpointer self)
{
if (h264_private_offset == 0)
return NULL;
return (G_STRUCT_MEMBER_P (self, h264_private_offset));
} }

View file

@ -28,9 +28,19 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct _GstVaapiDecodeH264Private GstVaapiDecodeH264Private;
struct _GstVaapiDecodeH264Private
{
gboolean is_low_latency;
};
void void
gst_vaapi_decode_h264_install_properties (GObjectClass * klass); gst_vaapi_decode_h264_install_properties (GObjectClass * klass);
GstVaapiDecodeH264Private *
gst_vaapi_decode_h264_get_instance_private (gpointer self);
G_END_DECLS G_END_DECLS
#endif /* GST_VAAPI_DECODE_PROPS_H */ #endif /* GST_VAAPI_DECODE_PROPS_H */