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");
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);
GstElementClass *element_class;
GstPadTemplate *pad_template;
GstAlsaSrc *src;
- GstCaps *caps;
+ GstCaps *caps, *templ_caps;
src = GST_ALSA_SRC (bsrc);
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);
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;
}
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
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
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
/* 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);
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);
* 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);