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,
} G_STMT_END;
static GstCaps *
-gst_alsasink_getcaps (GstBaseSink * bsink)
+gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter)
{
GstElementClass *element_class;
GstPadTemplate *pad_template;
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);
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
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,
static GstCaps *
-gst_alsasrc_getcaps (GstBaseSrc * bsrc)
+gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
{
GstElementClass *element_class;
GstPadTemplate *pad_template;
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);
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