From c255019b90b7a85cb2050de0c3ddaec456cb3b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 17 May 2011 13:01:39 +0200 Subject: [PATCH] ext: Update for caps/pad template related API changes --- ext/alsa/gstalsasink.c | 6 ++++-- ext/alsa/gstalsasrc.c | 6 ++++-- ext/libvisual/visual.c | 2 +- ext/ogg/gstogmparse.c | 3 +++ ext/pango/gstbasetextoverlay.c | 19 +++++++++++-------- ext/vorbis/gstvorbisdec.c | 2 +- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 1e904a5fdb..23b6d8c929 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -296,7 +296,7 @@ gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter) GstElementClass *element_class; GstPadTemplate *pad_template; GstAlsaSink *sink = GST_ALSA_SINK (bsink); - GstCaps *caps; + GstCaps *caps, *templ_caps; if (sink->handle == NULL) { GST_DEBUG_OBJECT (sink, "device not open, using template caps"); @@ -316,8 +316,10 @@ gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter) pad_template = gst_element_class_get_pad_template (element_class, "sink"); g_return_val_if_fail (pad_template != NULL, NULL); + templ_caps = gst_pad_template_get_caps (pad_template); caps = gst_alsa_probe_supported_formats (GST_OBJECT (sink), sink->handle, - gst_pad_template_get_caps (pad_template)); + templ_caps); + gst_caps_unref (templ_caps); if (caps) { sink->cached_caps = gst_caps_ref (caps); diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 74a58e7e93..1932401cea 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -412,7 +412,7 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter) GstElementClass *element_class; GstPadTemplate *pad_template; GstAlsaSrc *src; - GstCaps *caps; + GstCaps *caps, *templ_caps; src = GST_ALSA_SRC (bsrc); @@ -434,8 +434,10 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter) pad_template = gst_element_class_get_pad_template (element_class, "src"); g_return_val_if_fail (pad_template != NULL, NULL); + templ_caps = gst_pad_template_get_caps (pad_template); caps = gst_alsa_probe_supported_formats (GST_OBJECT (src), src->handle, - gst_pad_template_get_caps (pad_template)); + templ_caps); + gst_caps_unref (templ_caps); if (caps) { src->cached_caps = gst_caps_ref (caps); diff --git a/ext/libvisual/visual.c b/ext/libvisual/visual.c index 26b858d58f..ae1e91c01c 100644 --- a/ext/libvisual/visual.c +++ b/ext/libvisual/visual.c @@ -279,7 +279,7 @@ gst_visual_getcaps (GstPad * pad, GstCaps * filter) int depths; if (!visual->actor) { - ret = gst_caps_copy (gst_pad_get_pad_template_caps (visual->srcpad)); + ret = gst_pad_get_pad_template_caps (visual->srcpad); goto beach; } diff --git a/ext/ogg/gstogmparse.c b/ext/ogg/gstogmparse.c index d8238cccab..4e9a9623a8 100644 --- a/ext/ogg/gstogmparse.c +++ b/ext/ogg/gstogmparse.c @@ -284,6 +284,7 @@ gst_ogm_audio_parse_base_init (GstOgmParseClass * klass) audio_src_templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_SOMETIMES, caps); gst_element_class_add_pad_template (element_class, audio_src_templ); + gst_caps_unref (caps); } static void @@ -302,6 +303,7 @@ gst_ogm_video_parse_base_init (GstOgmParseClass * klass) video_src_templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_SOMETIMES, caps); gst_element_class_add_pad_template (element_class, video_src_templ); + gst_caps_unref (caps); } static void @@ -320,6 +322,7 @@ gst_ogm_text_parse_base_init (GstOgmParseClass * klass) text_src_templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_SOMETIMES, caps); gst_element_class_add_pad_template (element_class, text_src_templ); + gst_caps_unref (caps); } static void diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c index 86e3d63796..06abcf24c0 100644 --- a/ext/pango/gstbasetextoverlay.c +++ b/ext/pango/gstbasetextoverlay.c @@ -1096,8 +1096,7 @@ gst_base_text_overlay_getcaps (GstPad * pad, GstCaps * filter) /* we can do what the peer can */ caps = gst_pad_peer_get_caps (otherpad, filter); if (caps) { - GstCaps *temp; - const GstCaps *templ; + GstCaps *temp, *templ; GST_DEBUG_OBJECT (pad, "peer caps %" GST_PTR_FORMAT, caps); @@ -1107,16 +1106,20 @@ gst_base_text_overlay_getcaps (GstPad * pad, GstCaps * filter) temp = gst_caps_intersect_full (caps, templ, GST_CAPS_INTERSECT_FIRST); GST_DEBUG_OBJECT (pad, "intersected %" GST_PTR_FORMAT, temp); gst_caps_unref (caps); + gst_caps_unref (templ); /* this is what we can do */ caps = temp; } else { /* no peer, our padtemplate is enough then */ - if (filter) - caps = - gst_caps_intersect_full (filter, gst_pad_get_pad_template_caps (pad), - GST_CAPS_INTERSECT_FIRST); - else - caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + caps = gst_pad_get_pad_template_caps (pad); + if (filter) { + GstCaps *intersection; + + intersection = + gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (caps); + caps = intersection; + } } GST_DEBUG_OBJECT (overlay, "returning %" GST_PTR_FORMAT, caps); diff --git a/ext/vorbis/gstvorbisdec.c b/ext/vorbis/gstvorbisdec.c index c49dbfa29f..324f8484a5 100644 --- a/ext/vorbis/gstvorbisdec.c +++ b/ext/vorbis/gstvorbisdec.c @@ -597,7 +597,7 @@ vorbis_handle_identification_packet (GstVorbisDec * vd) * for mono/stereo and avoid the depth switch in tremor case */ vd->copy_samples = get_copy_sample_func (vd->vi.channels, vd->width); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (vd->srcpad)); + caps = gst_caps_make_writable (gst_pad_get_pad_template_caps (vd->srcpad)); gst_caps_set_simple (caps, "rate", G_TYPE_INT, vd->vi.rate, "channels", G_TYPE_INT, vd->vi.channels, "width", G_TYPE_INT, width, NULL);