From e310ee82188f2580f316c43ae1e5810786333d0f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 27 Mar 2012 16:41:06 +0200 Subject: [PATCH] caps: improve caps handling Avoid caps copy and leaks --- gst/avi/gstavimux.c | 2 +- gst/imagefreeze/gstimagefreeze.c | 2 -- gst/law/alaw-encode.c | 3 ++- gst/law/mulaw-encode.c | 3 ++- gst/matroska/matroska-demux.c | 11 ++++------- gst/rtp/gstasteriskh263.c | 3 +-- gst/rtp/gstrtpL16pay.c | 5 +++-- gst/rtp/gstrtpbvpay.c | 5 +++-- gst/rtp/gstrtpceltpay.c | 13 +++++++++---- gst/rtp/gstrtpg722pay.c | 3 ++- gst/rtp/gstrtph263ppay.c | 10 +++++----- gst/rtp/gstrtpilbcpay.c | 3 ++- gst/rtp/gstrtpspeexpay.c | 10 +++++++--- gst/shapewipe/gstshapewipe.c | 34 +++++++++++++++++----------------- gst/smpte/gstsmpte.c | 3 ++- sys/oss/gstosssink.c | 7 +++---- sys/v4l2/gstv4l2sink.c | 4 +--- sys/v4l2/gstv4l2src.c | 5 +---- sys/ximage/gstximagesrc.c | 8 ++------ tests/check/elements/qtmux.c | 8 ++++---- 20 files changed, 71 insertions(+), 71 deletions(-) diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index 10601eb..76dfe9e 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -1701,7 +1701,7 @@ gst_avi_mux_start_file (GstAviMux * avimux) } } - caps = gst_caps_copy (gst_pad_get_pad_template_caps (avimux->srcpad)); + caps = gst_pad_get_pad_template_caps (avimux->srcpad); gst_pad_set_caps (avimux->srcpad, caps); gst_caps_unref (caps); diff --git a/gst/imagefreeze/gstimagefreeze.c b/gst/imagefreeze/gstimagefreeze.c index da2872f..85bfd2d 100644 --- a/gst/imagefreeze/gstimagefreeze.c +++ b/gst/imagefreeze/gstimagefreeze.c @@ -273,8 +273,6 @@ gst_image_freeze_sink_getcaps (GstImageFreeze * self, GstCaps * filter) pad = self->sinkpad; if (gst_pad_has_current_caps (pad)) { ret = gst_pad_get_current_caps (pad); - gst_caps_replace (&ret, gst_caps_copy (ret)); - gst_caps_unref (ret); goto done; } diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index 0e08c73..a373601 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -403,7 +403,8 @@ gst_alaw_enc_setcaps (GstALawEnc * alawenc, GstCaps * caps) gst_structure_get_int (structure, "channels", &alawenc->channels); gst_structure_get_int (structure, "rate", &alawenc->rate); - base_caps = gst_caps_copy (gst_pad_get_pad_template_caps (alawenc->srcpad)); + base_caps = gst_pad_get_pad_template_caps (alawenc->srcpad); + base_caps = gst_caps_make_writable (base_caps); structure = gst_caps_get_structure (base_caps, 0); gst_structure_set (structure, "rate", G_TYPE_INT, alawenc->rate, NULL); gst_structure_set (structure, "channels", G_TYPE_INT, alawenc->channels, diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index 165a346..cb9a7e2 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -159,7 +159,8 @@ mulawenc_setcaps (GstMuLawEnc * mulawenc, GstCaps * caps) gst_structure_get_int (structure, "channels", &mulawenc->channels); gst_structure_get_int (structure, "rate", &mulawenc->rate); - base_caps = gst_caps_copy (gst_pad_get_pad_template_caps (mulawenc->srcpad)); + base_caps = gst_pad_get_pad_template_caps (mulawenc->srcpad); + base_caps = gst_caps_make_writable (base_caps); structure = gst_caps_get_structure (base_caps, 0); gst_structure_set (structure, "rate", G_TYPE_INT, mulawenc->rate, NULL); diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 33dedd7..c577a9c 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -3000,20 +3000,17 @@ gst_matroska_demux_check_aac (GstElement * element, size = gst_buffer_get_size (*buf); if (size > 2 && data[0] == 0xff && (data[1] >> 4 == 0x0f)) { - GstCaps *new_caps; GstStructure *s; /* tss, ADTS data, remove codec_data * still assume it is at least parsed */ - new_caps = gst_caps_copy (stream->caps); - s = gst_caps_get_structure (new_caps, 0); + stream->caps = gst_caps_make_writable (stream->caps); + s = gst_caps_get_structure (stream->caps, 0); g_assert (s); gst_structure_remove_field (s, "codec_data"); - gst_caps_replace (&stream->caps, new_caps); - gst_pad_set_caps (stream->pad, new_caps); + gst_pad_set_caps (stream->pad, stream->caps); GST_DEBUG_OBJECT (element, "ADTS AAC audio data; removing codec-data, " - "new caps: %" GST_PTR_FORMAT, new_caps); - gst_caps_unref (new_caps); + "new caps: %" GST_PTR_FORMAT, stream->caps); } /* disable subsequent checking */ diff --git a/gst/rtp/gstasteriskh263.c b/gst/rtp/gstasteriskh263.c index 54cc3fb..924f3f5 100644 --- a/gst/rtp/gstasteriskh263.c +++ b/gst/rtp/gstasteriskh263.c @@ -175,8 +175,7 @@ gst_asteriskh263_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) if (!gst_pad_has_current_caps (asteriskh263->srcpad)) { GstCaps *caps; - caps = gst_caps_copy - (gst_pad_get_pad_template_caps (asteriskh263->srcpad)); + caps = gst_pad_get_pad_template_caps (asteriskh263->srcpad); gst_pad_set_caps (asteriskh263->srcpad, caps); gst_caps_unref (caps); } diff --git a/gst/rtp/gstrtpL16pay.c b/gst/rtp/gstrtpL16pay.c index fc6dc66..29aa4e8 100644 --- a/gst/rtp/gstrtpL16pay.c +++ b/gst/rtp/gstrtpL16pay.c @@ -176,9 +176,9 @@ gst_rtp_L16_pay_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad, GstCaps *otherpadcaps; GstCaps *caps; - otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + caps = gst_pad_get_pad_template_caps (pad); + otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad); if (otherpadcaps) { if (!gst_caps_is_empty (otherpadcaps)) { GstStructure *structure; @@ -187,6 +187,7 @@ gst_rtp_L16_pay_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad, gint rate; structure = gst_caps_get_structure (otherpadcaps, 0); + caps = gst_caps_make_writable (caps); if (gst_structure_get_int (structure, "channels", &channels)) { gst_caps_set_simple (caps, "channels", G_TYPE_INT, channels, NULL); diff --git a/gst/rtp/gstrtpbvpay.c b/gst/rtp/gstrtpbvpay.c index 5c07d61..7e55517 100644 --- a/gst/rtp/gstrtpbvpay.c +++ b/gst/rtp/gstrtpbvpay.c @@ -179,9 +179,9 @@ gst_rtp_bv_pay_sink_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad, GstCaps *otherpadcaps; GstCaps *caps; - otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + caps = gst_pad_get_pad_template_caps (pad); + otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad); if (otherpadcaps) { if (!gst_caps_is_empty (otherpadcaps)) { GstStructure *structure; @@ -201,6 +201,7 @@ gst_rtp_bv_pay_sink_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad, mode = -1; if (mode == 16 || mode == 32) { + caps = gst_caps_make_writable (caps); structure = gst_caps_get_structure (caps, 0); gst_structure_set (structure, "mode", G_TYPE_INT, mode, NULL); } diff --git a/gst/rtp/gstrtpceltpay.c b/gst/rtp/gstrtpceltpay.c index 2229b48..e740a95 100644 --- a/gst/rtp/gstrtpceltpay.c +++ b/gst/rtp/gstrtpceltpay.c @@ -164,15 +164,20 @@ gst_rtp_celt_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad, GstCaps *caps; const gchar *params; - otherpadcaps = gst_pad_get_allowed_caps (payload->srcpad); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + caps = gst_pad_get_pad_template_caps (pad); + otherpadcaps = gst_pad_get_allowed_caps (payload->srcpad); if (otherpadcaps) { if (!gst_caps_is_empty (otherpadcaps)) { - GstStructure *ps = gst_caps_get_structure (otherpadcaps, 0); - GstStructure *s = gst_caps_get_structure (caps, 0); + GstStructure *ps; + GstStructure *s; gint clock_rate = 0, frame_size = 0, channels = 1; + caps = gst_caps_make_writable (caps); + + ps = gst_caps_get_structure (otherpadcaps, 0); + s = gst_caps_get_structure (caps, 0); + if (gst_structure_get_int (ps, "clock-rate", &clock_rate)) { gst_structure_fixate_field_nearest_int (s, "rate", clock_rate); } diff --git a/gst/rtp/gstrtpg722pay.c b/gst/rtp/gstrtpg722pay.c index 986b84c..163a5ef 100644 --- a/gst/rtp/gstrtpg722pay.c +++ b/gst/rtp/gstrtpg722pay.c @@ -196,10 +196,11 @@ gst_rtp_g722_pay_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad, GstCaps *caps; otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + caps = gst_pad_get_pad_template_caps (pad); if (otherpadcaps) { if (!gst_caps_is_empty (otherpadcaps)) { + caps = gst_caps_make_writable (caps); gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL); gst_caps_set_simple (caps, "rate", G_TYPE_INT, 16000, NULL); } diff --git a/gst/rtp/gstrtph263ppay.c b/gst/rtp/gstrtph263ppay.c index 7333bed..8eff6be 100644 --- a/gst/rtp/gstrtph263ppay.c +++ b/gst/rtp/gstrtph263ppay.c @@ -235,7 +235,7 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad, GstCaps * filter) { GstRtpH263PPay *rtph263ppay; - GstCaps *caps = NULL; + GstCaps *caps = NULL, *templ; GstCaps *peercaps = NULL; GstCaps *intersect = NULL; guint i; @@ -246,12 +246,12 @@ gst_rtp_h263p_pay_sink_getcaps (GstRTPBasePayload * payload, GstPad * pad, gst_pad_peer_query_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload), filter); if (!peercaps) return - gst_caps_copy (gst_pad_get_pad_template_caps - (GST_RTP_BASE_PAYLOAD_SINKPAD (payload))); + gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload)); - intersect = gst_caps_intersect (peercaps, - gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload))); + templ = gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload)); + intersect = gst_caps_intersect (peercaps, templ); gst_caps_unref (peercaps); + gst_caps_unref (templ); if (gst_caps_is_empty (intersect)) return intersect; diff --git a/gst/rtp/gstrtpilbcpay.c b/gst/rtp/gstrtpilbcpay.c index 8dbb6aa..a66ba87 100644 --- a/gst/rtp/gstrtpilbcpay.c +++ b/gst/rtp/gstrtpilbcpay.c @@ -183,7 +183,7 @@ gst_rtp_ilbc_pay_sink_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad, GstCaps *caps; otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + caps = gst_pad_get_pad_template_caps (pad); if (otherpadcaps) { if (!gst_caps_is_empty (otherpadcaps)) { @@ -198,6 +198,7 @@ gst_rtp_ilbc_pay_sink_getcaps (GstRTPBasePayload * rtppayload, GstPad * pad, if (mode_str) { mode = strtol (mode_str, NULL, 10); if (mode == 20 || mode == 30) { + caps = gst_caps_make_writable (caps); structure = gst_caps_get_structure (caps, 0); gst_structure_set (structure, "mode", G_TYPE_INT, mode, NULL); } diff --git a/gst/rtp/gstrtpspeexpay.c b/gst/rtp/gstrtpspeexpay.c index 303a72e..994aee3 100644 --- a/gst/rtp/gstrtpspeexpay.c +++ b/gst/rtp/gstrtpspeexpay.c @@ -114,14 +114,18 @@ gst_rtp_speex_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad, GstCaps *caps; otherpadcaps = gst_pad_get_allowed_caps (payload->srcpad); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + caps = gst_pad_get_pad_template_caps (pad); if (otherpadcaps) { if (!gst_caps_is_empty (otherpadcaps)) { - GstStructure *ps = gst_caps_get_structure (otherpadcaps, 0); - GstStructure *s = gst_caps_get_structure (caps, 0); + GstStructure *ps; + GstStructure *s; gint clock_rate; + ps = gst_caps_get_structure (otherpadcaps, 0); + caps = gst_caps_make_writable (caps); + s = gst_caps_get_structure (caps, 0); + if (gst_structure_get_int (ps, "clock-rate", &clock_rate)) { gst_structure_fixate_field_nearest_int (s, "rate", clock_rate); } diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c index 5eb5510..6b5b7a4 100644 --- a/gst/shapewipe/gstshapewipe.c +++ b/gst/shapewipe/gstshapewipe.c @@ -327,17 +327,19 @@ static GstCaps * gst_shape_wipe_video_sink_getcaps (GstPad * pad, GstCaps * filter) { GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad)); - GstCaps *ret, *tmp; + GstCaps *templ, *ret, *tmp; if (gst_pad_has_current_caps (pad)) return gst_pad_get_current_caps (pad); + templ = gst_pad_get_pad_template_caps (pad); tmp = gst_pad_peer_query_caps (self->srcpad, NULL); if (tmp) { - ret = gst_caps_intersect (tmp, gst_pad_get_pad_template_caps (pad)); + ret = gst_caps_intersect (tmp, templ); + gst_caps_unref (templ); gst_caps_unref (tmp); } else { - ret = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); + ret = templ; } GST_LOG_OBJECT (pad, "srcpad accepted caps: %" GST_PTR_FORMAT, ret); @@ -365,6 +367,7 @@ gst_shape_wipe_video_sink_getcaps (GstPad * pad, GstCaps * filter) if (self->vinfo.height && self->vinfo.width) { guint i, n; + ret = gst_caps_make_writable (ret); n = gst_caps_get_size (ret); for (i = 0; i < n; i++) { GstStructure *s = gst_caps_get_structure (ret, i); @@ -381,15 +384,13 @@ gst_shape_wipe_video_sink_getcaps (GstPad * pad, GstCaps * filter) GstCaps *intersection, *tmp2; guint i, n; - tmp = gst_caps_make_writable (tmp); - - tmp2 = gst_caps_copy (gst_pad_get_pad_template_caps (self->mask_sinkpad)); - + tmp2 = gst_pad_get_pad_template_caps (self->mask_sinkpad); intersection = gst_caps_intersect (tmp, tmp2); gst_caps_unref (tmp); gst_caps_unref (tmp2); tmp = intersection; + tmp = gst_caps_make_writable (tmp); n = gst_caps_get_size (tmp); for (i = 0; i < n; i++) { @@ -463,7 +464,7 @@ gst_shape_wipe_mask_sink_getcaps (GstPad * pad, GstCaps * filter) gst_pad_get_pad_template_caps (self->video_sinkpad)); gst_caps_unref (tmp); } else { - ret = gst_caps_copy (gst_pad_get_pad_template_caps (self->video_sinkpad)); + ret = gst_pad_get_pad_template_caps (self->video_sinkpad); } GST_LOG_OBJECT (pad, "video sink accepted caps: %" GST_PTR_FORMAT, ret); @@ -536,21 +537,21 @@ static GstCaps * gst_shape_wipe_src_getcaps (GstPad * pad, GstCaps * filter) { GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad)); - GstCaps *ret, *tmp; + GstCaps *templ, *ret, *tmp; if (gst_pad_has_current_caps (pad)) return gst_pad_get_current_caps (pad); else if (gst_pad_has_current_caps (self->video_sinkpad)) return gst_pad_get_current_caps (self->video_sinkpad); + templ = gst_pad_get_pad_template_caps (self->video_sinkpad); tmp = gst_pad_peer_query_caps (self->video_sinkpad, NULL); if (tmp) { - ret = - gst_caps_intersect (tmp, - gst_pad_get_pad_template_caps (self->video_sinkpad)); + ret = gst_caps_intersect (tmp, templ); + gst_caps_unref (templ); gst_caps_unref (tmp); } else { - ret = gst_caps_copy (gst_pad_get_pad_template_caps (self->video_sinkpad)); + ret = templ; } GST_LOG_OBJECT (pad, "video sink accepted caps: %" GST_PTR_FORMAT, ret); @@ -577,6 +578,7 @@ gst_shape_wipe_src_getcaps (GstPad * pad, GstCaps * filter) if (self->vinfo.height && self->vinfo.width) { guint i, n; + ret = gst_caps_make_writable (ret); n = gst_caps_get_size (ret); for (i = 0; i < n; i++) { GstStructure *s = gst_caps_get_structure (ret, i); @@ -592,14 +594,12 @@ gst_shape_wipe_src_getcaps (GstPad * pad, GstCaps * filter) GstCaps *intersection, *tmp2; guint i, n; - tmp = gst_caps_make_writable (tmp); - tmp2 = gst_caps_copy (gst_pad_get_pad_template_caps (self->mask_sinkpad)); - + tmp2 = gst_pad_get_pad_template_caps (self->mask_sinkpad); intersection = gst_caps_intersect (tmp, tmp2); gst_caps_unref (tmp); gst_caps_unref (tmp2); - tmp = intersection; + tmp = gst_caps_make_writable (intersection); n = gst_caps_get_size (tmp); for (i = 0; i < n; i++) { diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index 97e4f9d..1aeaad6 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -545,13 +545,14 @@ gst_smpte_collected (GstCollectPads2 * pads, GstSMPTE * smpte) GstSegment segment; caps = - gst_caps_copy (gst_static_caps_get + gst_caps_make_writable (gst_static_caps_get (&gst_smpte_src_template.static_caps)); gst_caps_set_simple (caps, "width", G_TYPE_INT, smpte->width, "height", G_TYPE_INT, smpte->height, "framerate", GST_TYPE_FRACTION, smpte->fps_num, smpte->fps_denom, NULL); gst_pad_set_caps (smpte->srcpad, caps); + gst_caps_unref (caps); gst_segment_init (&segment, GST_FORMAT_TIME); gst_pad_push_event (smpte->srcpad, gst_event_new_segment (&segment)); diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c index 6781347..ba8ab8d 100644 --- a/sys/oss/gstosssink.c +++ b/sys/oss/gstosssink.c @@ -294,14 +294,13 @@ gst_oss_sink_getcaps (GstBaseSink * bsink) osssink = GST_OSSSINK (bsink); if (osssink->fd == -1) { - caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD - (bsink))); + caps = gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD (bsink)); } else if (osssink->probed_caps) { - caps = gst_caps_copy (osssink->probed_caps); + caps = gst_caps_ref (osssink->probed_caps); } else { caps = gst_oss_helper_probe_caps (osssink->fd); if (caps && !gst_caps_is_empty (caps)) { - osssink->probed_caps = gst_caps_copy (caps); + osssink->probed_caps = gst_caps_ref (caps); } } diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c index 8c0c93e..ba73c5a 100644 --- a/sys/v4l2/gstv4l2sink.c +++ b/sys/v4l2/gstv4l2sink.c @@ -513,9 +513,7 @@ gst_v4l2sink_get_caps (GstBaseSink * bsink, GstCaps * filter) if (!GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) { /* FIXME: copy? */ GST_DEBUG_OBJECT (v4l2sink, "device is not open"); - return - gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD - (v4l2sink))); + return gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD (v4l2sink)); } if (v4l2sink->probed_caps == NULL) { diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index d19de4d..2a06a7b 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -442,10 +442,7 @@ gst_v4l2src_get_caps (GstBaseSrc * src, GstCaps * filter) obj = v4l2src->v4l2object; if (!GST_V4L2_IS_OPEN (obj)) { - /* FIXME: copy? */ - return - gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD - (v4l2src))); + return gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (v4l2src)); } if (v4l2src->probed_caps) diff --git a/sys/ximage/gstximagesrc.c b/sys/ximage/gstximagesrc.c index 0ec9688..60b33e4 100644 --- a/sys/ximage/gstximagesrc.c +++ b/sys/ximage/gstximagesrc.c @@ -1022,14 +1022,10 @@ gst_ximage_src_get_caps (GstBaseSrc * bs, GstCaps * filter) GstVideoFormat format; if ((!s->xcontext) && (!gst_ximage_src_open_display (s, s->display_name))) - return - gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC - (s)->srcpad)); + return gst_pad_get_pad_template_caps (GST_BASE_SRC (s)->srcpad); if (!gst_ximage_src_recalc (s)) - return - gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC - (s)->srcpad)); + return gst_pad_get_pad_template_caps (GST_BASE_SRC (s)->srcpad); xcontext = s->xcontext; width = s->xcontext->width; diff --git a/tests/check/elements/qtmux.c b/tests/check/elements/qtmux.c index 643a783..45e31c0 100644 --- a/tests/check/elements/qtmux.c +++ b/tests/check/elements/qtmux.c @@ -208,7 +208,7 @@ check_qtmux_pad (GstStaticPadTemplate * srctemplate, const gchar * sinkname, fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment))); inbuffer = gst_buffer_new_and_alloc (1); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad)); + caps = gst_pad_get_pad_template_caps (mysrcpad); gst_pad_set_caps (mysrcpad, caps); gst_caps_unref (caps); GST_BUFFER_TIMESTAMP (inbuffer) = 0; @@ -296,7 +296,7 @@ check_qtmux_pad_fragmented (GstStaticPadTemplate * srctemplate, fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment))); inbuffer = gst_buffer_new_and_alloc (1); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad)); + caps = gst_pad_get_pad_template_caps (mysrcpad); gst_pad_set_caps (mysrcpad, caps); gst_caps_unref (caps); GST_BUFFER_TIMESTAMP (inbuffer) = 0; @@ -526,7 +526,7 @@ GST_START_TEST (test_reuse) inbuffer = gst_buffer_new_and_alloc (1); fail_unless (inbuffer != NULL); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad)); + caps = gst_pad_get_pad_template_caps (mysrcpad); gst_pad_set_caps (mysrcpad, caps); gst_caps_unref (caps); GST_BUFFER_TIMESTAMP (inbuffer) = 0; @@ -817,7 +817,7 @@ test_average_bitrate_custom (const gchar * elementname, for (i = 0; i < 3; i++) { inbuffer = gst_buffer_new_and_alloc (bytes[i]); - caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad)); + caps = gst_pad_get_pad_template_caps (mysrcpad); gst_pad_set_caps (mysrcpad, caps); gst_caps_unref (caps); GST_BUFFER_TIMESTAMP (inbuffer) = total_duration; -- 2.7.4