mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-12 02:59:29 +00:00
fix template caps refcount
This commit is contained in:
parent
e0e39cb4ee
commit
756948262c
|
@ -733,6 +733,7 @@ gst_jpeg_dec_getcaps (GstPad * pad, GstCaps * filter)
|
|||
GstJpegDec *dec;
|
||||
GstCaps *caps;
|
||||
GstPad *peer;
|
||||
GstCaps *templ_caps;
|
||||
|
||||
dec = GST_JPEG_DEC (GST_OBJECT_PARENT (pad));
|
||||
|
||||
|
@ -741,9 +742,10 @@ gst_jpeg_dec_getcaps (GstPad * pad, GstCaps * filter)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -758,13 +760,13 @@ gst_jpeg_dec_getcaps (GstPad * pad, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -110,7 +110,7 @@ static GstCaps *
|
|||
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;
|
||||
|
||||
|
@ -138,6 +138,7 @@ gst_alpha_color_transform_caps (GstBaseTransform * btrans,
|
|||
|
||||
/* 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);
|
||||
|
|
|
@ -1088,12 +1088,13 @@ gst_aac_parse_stop (GstBaseParse * parse)
|
|||
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;
|
||||
|
||||
|
@ -1106,15 +1107,11 @@ gst_aac_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -693,12 +693,12 @@ gst_ac3_parse_src_event (GstBaseParse * parse, GstEvent * event)
|
|||
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;
|
||||
|
||||
|
@ -713,15 +713,11 @@ gst_ac3_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -365,11 +365,13 @@ gst_amr_parse_stop (GstBaseParse * parse)
|
|||
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;
|
||||
|
@ -386,15 +388,11 @@ gst_amr_parse_sink_getcaps (GstBaseParse * parse, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -443,10 +443,11 @@ cleanup:
|
|||
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) {
|
||||
|
@ -461,15 +462,11 @@ gst_dca_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -1526,10 +1526,11 @@ gst_flac_parse_convert (GstBaseParse * parse,
|
|||
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) {
|
||||
|
@ -1544,15 +1545,11 @@ gst_flac_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -1401,10 +1401,11 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse,
|
|||
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) {
|
||||
|
@ -1419,15 +1420,11 @@ gst_mpeg_audio_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -607,10 +607,11 @@ more:
|
|||
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) {
|
||||
|
@ -625,15 +626,11 @@ gst_wavpack_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
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;
|
||||
|
|
|
@ -348,7 +348,7 @@ gst_au_parse_parse_header (GstAuParse * auparse)
|
|||
"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",
|
||||
|
@ -358,6 +358,7 @@ gst_au_parse_parse_header (GstAuParse * auparse)
|
|||
|
||||
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",
|
||||
|
|
|
@ -249,7 +249,7 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
{
|
||||
GstCaps *othercaps, *target;
|
||||
GstStructure *structure;
|
||||
const GstCaps *templ;
|
||||
GstCaps *templ;
|
||||
GstQuery *query;
|
||||
GstBufferPool *pool = NULL;
|
||||
guint size, min, max, prefix, alignment;
|
||||
|
@ -262,14 +262,16 @@ gst_goom_src_negotiate (GstGoom * goom)
|
|||
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);
|
||||
|
|
|
@ -150,7 +150,7 @@ gst_alaw_dec_getcaps (GstPad * pad, GstCaps * filter)
|
|||
GstALawDec *alawdec;
|
||||
GstPad *otherpad;
|
||||
GstCaps *othercaps, *result;
|
||||
const GstCaps *templ;
|
||||
GstCaps *templ;
|
||||
const gchar *name;
|
||||
gint i;
|
||||
|
||||
|
@ -195,9 +195,10 @@ gst_alaw_dec_getcaps (GstPad * pad, GstCaps * filter)
|
|||
/* 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;
|
||||
|
|
|
@ -306,7 +306,7 @@ gst_alaw_enc_getcaps (GstPad * pad, GstCaps * filter)
|
|||
GstALawEnc *alawenc;
|
||||
GstPad *otherpad;
|
||||
GstCaps *othercaps, *result;
|
||||
const GstCaps *templ;
|
||||
GstCaps *templ;
|
||||
const gchar *name;
|
||||
gint i;
|
||||
|
||||
|
@ -350,10 +350,11 @@ gst_alaw_enc_getcaps (GstPad * pad, GstCaps * filter)
|
|||
}
|
||||
/* 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;
|
||||
|
|
|
@ -91,7 +91,7 @@ mulawdec_getcaps (GstPad * pad, GstCaps * filter)
|
|||
GstMuLawDec *mulawdec;
|
||||
GstPad *otherpad;
|
||||
GstCaps *othercaps, *result;
|
||||
const GstCaps *templ;
|
||||
GstCaps *templ;
|
||||
const gchar *name;
|
||||
gint i;
|
||||
|
||||
|
@ -136,9 +136,10 @@ mulawdec_getcaps (GstPad * pad, GstCaps * filter)
|
|||
/* 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;
|
||||
|
|
|
@ -62,7 +62,7 @@ mulawenc_getcaps (GstPad * pad, GstCaps * filter)
|
|||
GstMuLawEnc *mulawenc;
|
||||
GstPad *otherpad;
|
||||
GstCaps *othercaps, *result;
|
||||
const GstCaps *templ;
|
||||
GstCaps *templ;
|
||||
const gchar *name;
|
||||
gint i;
|
||||
|
||||
|
@ -107,9 +107,10 @@ mulawenc_getcaps (GstPad * pad, GstCaps * filter)
|
|||
/* 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;
|
||||
|
|
Loading…
Reference in a new issue