GstJpegDec *dec;
GstCaps *caps;
GstPad *peer;
+ GstCaps *templ_caps;
dec = GST_JPEG_DEC (GST_OBJECT_PARENT (pad));
peer = gst_pad_get_peer (dec->srcpad);
+ templ_caps = gst_pad_get_pad_template_caps (pad);
+
if (peer) {
GstCaps *peer_caps;
- const GstCaps *templ_caps;
GstStructure *s;
guint i, n;
gst_structure_set_name (s, "image/jpeg");
}
- templ_caps = gst_pad_get_pad_template_caps (pad);
caps = gst_caps_intersect_full (peer_caps, templ_caps,
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peer_caps);
+ gst_caps_unref (templ_caps);
gst_object_unref (peer);
} else {
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = templ_caps;
}
return caps;
gst_alpha_color_transform_caps (GstBaseTransform * btrans,
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
{
- const GstCaps *tmpl_caps = NULL;
+ GstCaps *tmpl_caps = NULL;
GstCaps *result = NULL, *local_caps = NULL;
guint i;
/* Intersect with our template caps */
result = gst_caps_intersect (local_caps, tmpl_caps);
+ gst_caps_unref (tmpl_caps);
gst_caps_unref (local_caps);
gst_caps_do_simplify (result);
static GstCaps *
gst_aac_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter)
{
- GstCaps *peercaps;
+ GstCaps *peercaps, *templ;
GstCaps *res;
/* FIXME: handle filter caps */
- peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
+ templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
+ peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
gst_structure_remove_field (s, "framed");
}
- res =
- gst_caps_intersect_full (peercaps,
- gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
- GST_CAPS_INTERSECT_FIRST);
+ res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
} else {
- res =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
- (parse)));
+ res = templ;
}
return res;
static GstCaps *
gst_ac3_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
- GstCaps *peercaps;
+ GstCaps *peercaps, *templ;
GstCaps *res;
/* FIXME: handle filter */
-
- peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
+ templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
+ peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
gst_structure_remove_field (s, "alignment");
}
- res =
- gst_caps_intersect_full (peercaps,
- gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
- GST_CAPS_INTERSECT_FIRST);
+ res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
} else {
- res =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
- (parse)));
+ res = templ;
}
return res;
static GstCaps *
gst_amr_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter)
{
- GstCaps *peercaps;
+ GstCaps *peercaps, *templ;
GstCaps *res;
/* FIXME: handle filter caps */
+ templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse));
+
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
guint i, n;
gst_structure_set_name (s, "audio/x-amr-wb-sh");
}
- res =
- gst_caps_intersect_full (peercaps,
- gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
- GST_CAPS_INTERSECT_FIRST);
+ res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
} else {
- res =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
- (parse)));
+ res = templ;
}
return res;
static GstCaps *
gst_dca_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
- GstCaps *peercaps;
+ GstCaps *peercaps, *templ;
GstCaps *res;
/* FIXME: handle filter caps */
+ templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse));
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
gst_structure_remove_field (s, "framed");
}
- res =
- gst_caps_intersect_full (peercaps,
- gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
- GST_CAPS_INTERSECT_FIRST);
+ res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
} else {
- res =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
- (parse)));
+ res = templ;
}
return res;
static GstCaps *
gst_flac_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
- GstCaps *peercaps;
+ GstCaps *peercaps, *templ;
GstCaps *res;
/* FIXME: handle filter caps */
+ templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse));
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
gst_structure_remove_field (s, "framed");
}
- res =
- gst_caps_intersect_full (peercaps,
- gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
- GST_CAPS_INTERSECT_FIRST);
+ res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
} else {
- res =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
- (parse)));
+ res = templ;
}
return res;
static GstCaps *
gst_mpeg_audio_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
- GstCaps *peercaps;
+ GstCaps *peercaps, *templ;
GstCaps *res;
/* FIXME: handle filter caps */
+ templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse));
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
gst_structure_remove_field (s, "parsed");
}
- res =
- gst_caps_intersect_full (peercaps,
- gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
- GST_CAPS_INTERSECT_FIRST);
+ res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
} else {
- res =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
- (parse)));
+ res = templ;
}
return res;
static GstCaps *
gst_wavpack_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
{
- GstCaps *peercaps;
+ GstCaps *peercaps, *templ;
GstCaps *res;
/* FIXME: handle filter caps */
+ templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse));
peercaps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (parse));
if (peercaps) {
gst_structure_remove_field (s, "framed");
}
- res =
- gst_caps_intersect_full (peercaps,
- gst_pad_get_pad_template_caps (GST_BASE_PARSE_SRC_PAD (parse)),
- GST_CAPS_INTERSECT_FIRST);
+ res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
} else {
- res =
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD
- (parse)));
+ res = templ;
}
return res;
"channels", G_TYPE_INT, auparse->channels, NULL);
auparse->sample_size = auparse->channels;
} else if (format != GST_AUDIO_FORMAT_UNKNOWN) {
- const GstCaps *templ_caps = gst_pad_get_pad_template_caps (auparse->srcpad);
+ GstCaps *templ_caps = gst_pad_get_pad_template_caps (auparse->srcpad);
GstCaps *intersection;
tempcaps = gst_caps_new_simple ("audio/x-raw",
intersection = gst_caps_intersect (tempcaps, templ_caps);
gst_caps_unref (tempcaps);
+ gst_caps_unref (templ_caps);
tempcaps = intersection;
} else if (layout[0]) {
tempcaps = gst_caps_new_simple ("audio/x-adpcm",
{
GstCaps *othercaps, *target;
GstStructure *structure;
- const GstCaps *templ;
+ GstCaps *templ;
GstQuery *query;
GstBufferPool *pool = NULL;
guint size, min, max, prefix, alignment;
othercaps = gst_pad_peer_query_caps (goom->srcpad, NULL);
if (othercaps) {
target = gst_caps_intersect (othercaps, templ);
+ gst_caps_unref (templ);
gst_caps_unref (othercaps);
if (gst_caps_is_empty (target))
goto no_format;
+ target = gst_caps_make_writable (target);
gst_caps_truncate (target);
} else {
- target = gst_caps_ref ((GstCaps *) templ);
+ target = gst_caps_copy (templ);
}
structure = gst_caps_get_structure (target, 0);
GstALawDec *alawdec;
GstPad *otherpad;
GstCaps *othercaps, *result;
- const GstCaps *templ;
+ GstCaps *templ;
const gchar *name;
gint i;
/* filter against the allowed caps of the pad to return our result */
result = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
+ gst_caps_unref (templ);
} else {
/* there was no peer, return the template caps */
- result = gst_caps_copy (templ);
+ result = templ;
}
if (filter && result) {
GstCaps *temp;
GstALawEnc *alawenc;
GstPad *otherpad;
GstCaps *othercaps, *result;
- const GstCaps *templ;
+ GstCaps *templ;
const gchar *name;
gint i;
}
/* filter against the allowed caps of the pad to return our result */
result = gst_caps_intersect (othercaps, templ);
+ gst_caps_unref (templ);
gst_caps_unref (othercaps);
} else {
/* there was no peer, return the template caps */
- result = gst_caps_copy (templ);
+ result = templ;
}
if (filter && result) {
GstCaps *temp;
GstMuLawDec *mulawdec;
GstPad *otherpad;
GstCaps *othercaps, *result;
- const GstCaps *templ;
+ GstCaps *templ;
const gchar *name;
gint i;
/* filter against the allowed caps of the pad to return our result */
result = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
+ gst_caps_unref (templ);
} else {
/* there was no peer, return the template caps */
- result = gst_caps_copy (templ);
+ result = templ;
}
if (filter && result) {
GstCaps *temp;
GstMuLawEnc *mulawenc;
GstPad *otherpad;
GstCaps *othercaps, *result;
- const GstCaps *templ;
+ GstCaps *templ;
const gchar *name;
gint i;
/* filter against the allowed caps of the pad to return our result */
result = gst_caps_intersect (othercaps, templ);
gst_caps_unref (othercaps);
+ gst_caps_unref (templ);
} else {
/* there was no peer, return the template caps */
- result = gst_caps_copy (templ);
+ result = templ;
}
if (filter && result) {
GstCaps *temp;