From 0415b90e992db84aba469d018c1925ef62e7eed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 May 2011 12:17:49 +0200 Subject: [PATCH] alsa: Update for negotiation related API changes --- ext/alsa/gstalsasink.c | 21 +++++++++++++++++---- ext/alsa/gstalsasrc.c | 21 +++++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 1f4529f452..1e904a5fdb 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -79,7 +79,7 @@ static void gst_alsasink_set_property (GObject * object, static void gst_alsasink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstCaps *gst_alsasink_getcaps (GstBaseSink * bsink); +static GstCaps *gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter); static gboolean gst_alsasink_open (GstAudioSink * asink); static gboolean gst_alsasink_prepare (GstAudioSink * asink, @@ -291,7 +291,7 @@ if ((err = call) < 0) \ } G_STMT_END; static GstCaps * -gst_alsasink_getcaps (GstBaseSink * bsink) +gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter) { GstElementClass *element_class; GstPadTemplate *pad_template; @@ -305,7 +305,11 @@ gst_alsasink_getcaps (GstBaseSink * bsink) if (sink->cached_caps) { GST_LOG_OBJECT (sink, "Returning cached caps"); - return gst_caps_ref (sink->cached_caps); + if (filter) + return gst_caps_intersect_full (filter, sink->cached_caps, + GST_CAPS_INTERSECT_FIRST); + else + return gst_caps_ref (sink->cached_caps); } element_class = GST_ELEMENT_GET_CLASS (sink); @@ -321,7 +325,16 @@ gst_alsasink_getcaps (GstBaseSink * bsink) GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, caps); - return caps; + if (filter) { + GstCaps *intersection; + + intersection = + gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (caps); + return intersection; + } else { + return caps; + } } static int diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 8a4e3d3dff..430a940dbc 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -77,7 +77,7 @@ static void gst_alsasrc_set_property (GObject * object, static void gst_alsasrc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstCaps *gst_alsasrc_getcaps (GstBaseSrc * bsrc); +static GstCaps *gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter); static gboolean gst_alsasrc_open (GstAudioSrc * asrc); static gboolean gst_alsasrc_prepare (GstAudioSrc * asrc, @@ -301,7 +301,7 @@ if ((err = call) < 0) \ static GstCaps * -gst_alsasrc_getcaps (GstBaseSrc * bsrc) +gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter) { GstElementClass *element_class; GstPadTemplate *pad_template; @@ -317,7 +317,11 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc) if (src->cached_caps) { GST_LOG_OBJECT (src, "Returning cached caps"); - return gst_caps_ref (src->cached_caps); + if (filter) + return gst_caps_intersect_full (filter, src->cached_caps, + GST_CAPS_INTERSECT_FIRST); + else + return gst_caps_ref (src->cached_caps); } element_class = GST_ELEMENT_GET_CLASS (src); @@ -333,7 +337,16 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc) GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, caps); - return caps; + if (filter) { + GstCaps *intersection; + + intersection = + gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (caps); + return intersection; + } else { + return caps; + } } static int