Commit 20d46e8d authored by Gwenole Beauchesne's avatar Gwenole Beauchesne

plugins: fix pad template ref leaks.

parent bfeff67c
......@@ -168,20 +168,19 @@ static void
gst_vaapiconvert_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
gst_element_class_set_details(element_class, &gst_vaapiconvert_details);
/* sink pad */
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapiconvert_sink_factory)
);
pad_template = gst_static_pad_template_get(&gst_vaapiconvert_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapiconvert_src_factory)
);
pad_template = gst_static_pad_template_get(&gst_vaapiconvert_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
}
static void
......
......@@ -343,20 +343,19 @@ static void
gst_vaapidecode_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
gst_element_class_set_details(element_class, &gst_vaapidecode_details);
/* sink pad */
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapidecode_sink_factory)
);
pad_template = gst_static_pad_template_get(&gst_vaapidecode_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapidecode_src_factory)
);
pad_template = gst_static_pad_template_get(&gst_vaapidecode_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
}
static void
......@@ -639,6 +638,7 @@ static void
gst_vaapidecode_init(GstVaapiDecode *decode, GstVaapiDecodeClass *klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
decode->display = NULL;
decode->decoder = NULL;
......@@ -650,10 +650,9 @@ gst_vaapidecode_init(GstVaapiDecode *decode, GstVaapiDecodeClass *klass)
decode->is_ready = FALSE;
/* Pad through which data comes in to the element */
decode->sinkpad = gst_pad_new_from_template(
gst_element_class_get_pad_template(element_class, "sink"),
"sink"
);
pad_template = gst_element_class_get_pad_template(element_class, "sink");
decode->sinkpad = gst_pad_new_from_template(pad_template, "sink");
gst_object_unref(pad_template);
decode->sinkpad_caps = NULL;
gst_pad_set_getcaps_function(decode->sinkpad, gst_vaapidecode_get_caps);
......@@ -663,10 +662,9 @@ gst_vaapidecode_init(GstVaapiDecode *decode, GstVaapiDecodeClass *klass)
gst_element_add_pad(GST_ELEMENT(decode), decode->sinkpad);
/* Pad through which data goes out of the element */
decode->srcpad = gst_pad_new_from_template(
gst_element_class_get_pad_template(element_class, "src"),
"src"
);
pad_template = gst_element_class_get_pad_template(element_class, "src");
decode->srcpad = gst_pad_new_from_template(pad_template, "src");
gst_object_unref(pad_template);
decode->srcpad_caps = NULL;
gst_pad_use_fixed_caps(decode->srcpad);
......
......@@ -829,13 +829,13 @@ static void
gst_vaapisink_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
gst_element_class_set_details(element_class, &gst_vaapisink_details);
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapisink_sink_factory)
);
pad_template = gst_static_pad_template_get(&gst_vaapisink_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
}
static void
......
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