summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-03-09 18:41:49 +0100
committerVíctor Manuel Jáquez Leal <victorx.jaquez@intel.com>2016-03-11 09:42:37 +0100
commit96ac9bee8ecae2532ff9a53d0a6f3015adc63ed2 (patch)
tree67c34879e4d38c53f1ad75ded7ff49519cc022ea
parent8aa880786d6d3bc55202f0507781caa7eac89c2f (diff)
downloadgstreamer-vaapi-96ac9bee8ecae2532ff9a53d0a6f3015adc63ed2.tar.gz
vaapidecode: register decoder with internal GType
Don't expose the the vaapidecode GType, instead expose a function which will register element. This is the first step to split the decoder by codecs. https://bugzilla.gnome.org/show_bug.cgi?id=734093
-rw-r--r--gst/vaapi/gstvaapi.c4
-rw-r--r--gst/vaapi/gstvaapidecode.c45
-rw-r--r--gst/vaapi/gstvaapidecode.h3
3 files changed, 37 insertions, 15 deletions
diff --git a/gst/vaapi/gstvaapi.c b/gst/vaapi/gstvaapi.c
index dc972609..aabddc35 100644
--- a/gst/vaapi/gstvaapi.c
+++ b/gst/vaapi/gstvaapi.c
@@ -53,8 +53,8 @@
static gboolean
plugin_init (GstPlugin * plugin)
{
- gst_element_register (plugin, "vaapidecode",
- GST_RANK_PRIMARY + 1, GST_TYPE_VAAPIDECODE);
+ gst_vaapidecode_register (plugin);
+
gst_element_register (plugin, "vaapipostproc",
GST_RANK_PRIMARY, GST_TYPE_VAAPIPOSTPROC);
gst_element_register (plugin, "vaapisink",
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c
index aeb97c36..3c219ec0 100644
--- a/gst/vaapi/gstvaapidecode.c
+++ b/gst/vaapi/gstvaapidecode.c
@@ -120,14 +120,10 @@ static GstStaticPadTemplate gst_vaapidecode_src_factory =
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapidecode_src_caps_str));
-
-G_DEFINE_TYPE_WITH_CODE(
- GstVaapiDecode,
- gst_vaapidecode,
- GST_TYPE_VIDEO_DECODER,
- GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES)
/* *INDENT-ON* */
+static GstElementClass *parent_class = NULL;
+
static gboolean gst_vaapidecode_update_sink_caps (GstVaapiDecode * decode,
GstCaps * caps);
static gboolean gst_vaapi_decode_input_state_replace (GstVaapiDecode * decode,
@@ -815,7 +811,7 @@ gst_vaapidecode_finalize (GObject * object)
g_mutex_clear (&decode->surface_ready_mutex);
gst_vaapi_plugin_base_finalize (GST_VAAPI_PLUGIN_BASE (object));
- G_OBJECT_CLASS (gst_vaapidecode_parent_class)->finalize (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
@@ -1036,8 +1032,7 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query)
break;
}
default:{
- ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->sink_query
- (vdec, query);
+ ret = GST_VIDEO_DECODER_CLASS (parent_class)->sink_query (vdec, query);
break;
}
}
@@ -1075,8 +1070,7 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query)
break;
}
default:{
- ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->src_query
- (vdec, query);
+ ret = GST_VIDEO_DECODER_CLASS (parent_class)->src_query (vdec, query);
break;
}
}
@@ -1095,6 +1089,8 @@ gst_vaapidecode_class_init (GstVaapiDecodeClass * klass)
GST_DEBUG_CATEGORY_INIT (gst_debug_vaapidecode,
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
+ parent_class = g_type_class_peek_parent (klass);
+
gst_vaapi_plugin_base_class_init (GST_VAAPI_PLUGIN_BASE_CLASS (klass));
object_class->finalize = gst_vaapidecode_finalize;
@@ -1147,3 +1143,30 @@ gst_vaapidecode_init (GstVaapiDecode * decode)
gst_video_decoder_set_packetized (vdec, FALSE);
}
+
+gboolean
+gst_vaapidecode_register (GstPlugin * plugin)
+{
+ GType type;
+ GTypeInfo typeinfo = {
+ sizeof (GstVaapiDecodeClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gst_vaapidecode_class_init,
+ NULL,
+ NULL,
+ sizeof (GstVaapiDecode),
+ 0,
+ (GInstanceInitFunc) gst_vaapidecode_init,
+ };
+
+ type = g_type_from_name ("GstVaapiDecode");
+ if (!type) {
+ type = g_type_register_static (GST_TYPE_VIDEO_DECODER, "GstVaapiDecode",
+ &typeinfo, 0);
+ gst_vaapi_plugin_base_init_interfaces (type);
+ }
+
+ return
+ gst_element_register (plugin, "vaapidecode", GST_RANK_PRIMARY + 1, type);
+}
diff --git a/gst/vaapi/gstvaapidecode.h b/gst/vaapi/gstvaapidecode.h
index 13c57bc0..55d4b36d 100644
--- a/gst/vaapi/gstvaapidecode.h
+++ b/gst/vaapi/gstvaapidecode.h
@@ -81,8 +81,7 @@ struct _GstVaapiDecodeClass {
GstVaapiPluginBaseClass parent_class;
};
-GType
-gst_vaapidecode_get_type(void) G_GNUC_CONST;
+gboolean gst_vaapidecode_register (GstPlugin * plugin);
G_END_DECLS