alsa: Update for negotiation related API changes

This commit is contained in:
Sebastian Dröge 2011-05-16 12:17:49 +02:00
parent 8d6e2c8a89
commit 0415b90e99
2 changed files with 34 additions and 8 deletions

View file

@ -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

View file

@ -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