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,6 +305,10 @@ gst_alsasink_getcaps (GstBaseSink * bsink)
if (sink->cached_caps) {
GST_LOG_OBJECT (sink, "Returning 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);
}
@ -321,8 +325,17 @@ gst_alsasink_getcaps (GstBaseSink * bsink)
GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, 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
set_hwparams (GstAlsaSink * alsa)

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,6 +317,10 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc)
if (src->cached_caps) {
GST_LOG_OBJECT (src, "Returning 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);
}
@ -333,8 +337,17 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc)
GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, 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
set_hwparams (GstAlsaSrc * alsa)