plugin: chain up set_context() vmethod

Since Gstreamer 1.7, set_context() vmethod needs to be chained up with
the parent class in order to broadcast all its contexts when the element
is added into a bin:

http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=d5ded1588920c4471eefe055d09095d9e5e989b5

There is no need to guard the call, because before GStreamer 1.7, the
set_context() vmethod was NULL in the element class, hence the conditional
call make it safe.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=757598
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-11-02 16:48:27 +01:00
parent 4fc8769761
commit 1e96fae94c

View file

@ -35,6 +35,8 @@
/* Default debug category is from the subclass */
#define GST_CAT_DEFAULT (plugin->debug_category)
static gpointer plugin_parent_class = NULL;
/* GstVideoContext interface */
static void
plugin_set_display (GstVaapiPluginBase * plugin, GstVaapiDisplay * display)
@ -59,10 +61,14 @@ static void
plugin_set_context (GstElement * element, GstContext * context)
{
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (element);
GstElementClass *element_class = GST_ELEMENT_CLASS (plugin_parent_class);
GstVaapiDisplay *display = NULL;
if (gst_vaapi_video_context_get_display (context, &display))
plugin_set_display (plugin, display);
if (element_class->set_context)
element_class->set_context (element, context);
}
void
@ -177,6 +183,8 @@ gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass)
klass->has_interface = default_has_interface;
klass->display_changed = default_display_changed;
plugin_parent_class = g_type_class_peek_parent (klass);
GstElementClass *const element_class = GST_ELEMENT_CLASS (klass);
element_class->set_context = GST_DEBUG_FUNCPTR (plugin_set_context);
}