close #333784 unref the result of gst_pad_get_parent() by: Christophe Fergeau.

Original commit message from CVS:
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_setcaps):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
(gst_gdk_pixbuf_sink_getcaps):
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps),
(gst_jpegenc_setcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_chain):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps),
(gst_smokeenc_setcaps):
* ext/libmng/gstmngdec.c: (gst_mngdec_sinklink),
(gst_mngdec_src_getcaps):
* ext/libmng/gstmngenc.c: (gst_mngenc_sinklink),
(gst_mngenc_chain):
* ext/libpng/gstpngenc.c: (gst_pngenc_setcaps):
* ext/mikmod/gstmikmod.c: (gst_mikmod_srclink):
* ext/speex/gstspeexdec.c: (speex_dec_convert),
(speex_dec_src_event), (speex_dec_chain):
* gst/avi/gstavimux.c: (gst_avimux_vidsinkconnect),
(gst_avimux_audsinkconnect), (gst_avimux_handle_event):
* gst/debug/negotiation.c: (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain):
* gst/flx/gstflxdec.c: (gst_flxdec_src_query_handler),
(gst_flxdec_chain):
* gst/interleave/deinterleave.c: (deinterleave_sink_link),
(deinterleave_chain):
* gst/law/mulaw-encode.c: (mulawenc_setcaps):
* gst/median/gstmedian.c: (gst_median_link):
* gst/monoscope/gstmonoscope.c: (gst_monoscope_srcconnect),
(gst_monoscope_chain):
* gst/rtp/gstrtpL16pay.c: (gst_rtpL16pay_sinkconnect):
* gst/wavenc/gstwavenc.c: (gst_wavenc_sink_setcaps):
* sys/osxaudio/gstosxaudiosink.c: (gst_osxaudiosink_chain):
* sys/osxaudio/gstosxaudiosrc.c: (gst_osxaudiosrc_get):
close #333784 unref the result of gst_pad_get_parent()
by: Christophe Fergeau.
This commit is contained in:
Wim Taymans 2006-03-13 15:49:08 +00:00
parent b6fc501669
commit 8a51401ef6
23 changed files with 150 additions and 24 deletions

View file

@ -1,3 +1,42 @@
2006-03-13 Wim Taymans <wim@fluendo.com>
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_setcaps):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
(gst_gdk_pixbuf_sink_getcaps):
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps),
(gst_jpegenc_setcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_chain):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps),
(gst_smokeenc_setcaps):
* ext/libmng/gstmngdec.c: (gst_mngdec_sinklink),
(gst_mngdec_src_getcaps):
* ext/libmng/gstmngenc.c: (gst_mngenc_sinklink),
(gst_mngenc_chain):
* ext/libpng/gstpngenc.c: (gst_pngenc_setcaps):
* ext/mikmod/gstmikmod.c: (gst_mikmod_srclink):
* ext/speex/gstspeexdec.c: (speex_dec_convert),
(speex_dec_src_event), (speex_dec_chain):
* gst/avi/gstavimux.c: (gst_avimux_vidsinkconnect),
(gst_avimux_audsinkconnect), (gst_avimux_handle_event):
* gst/debug/negotiation.c: (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain):
* gst/flx/gstflxdec.c: (gst_flxdec_src_query_handler),
(gst_flxdec_chain):
* gst/interleave/deinterleave.c: (deinterleave_sink_link),
(deinterleave_chain):
* gst/law/mulaw-encode.c: (mulawenc_setcaps):
* gst/median/gstmedian.c: (gst_median_link):
* gst/monoscope/gstmonoscope.c: (gst_monoscope_srcconnect),
(gst_monoscope_chain):
* gst/rtp/gstrtpL16pay.c: (gst_rtpL16pay_sinkconnect):
* gst/wavenc/gstwavenc.c: (gst_wavenc_sink_setcaps):
* sys/osxaudio/gstosxaudiosink.c: (gst_osxaudiosink_chain):
* sys/osxaudio/gstosxaudiosrc.c: (gst_osxaudiosrc_get):
close #333784 unref the result of gst_pad_get_parent()
by: Christophe Fergeau.
2006-03-09 Wim Taymans <wim@fluendo.com>
* ext/dv/gstdvdemux.c: (gst_dvdemux_handle_sink_event),

View file

@ -556,6 +556,8 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps)
overlay->fps_n = gst_value_get_fraction_numerator (fps);
overlay->fps_d = gst_value_get_fraction_denominator (fps);
gst_object_unref (overlay);
return ret;
}

View file

@ -277,6 +277,7 @@ gst_esdmon_get (GstPad * pad)
GST_DEBUG ("pushed buffer from esdmon of %ld bytes, timestamp %"
G_GINT64_FORMAT, readbytes, GST_BUFFER_TIMESTAMP (buf));
gst_object_unref (esdmon);
return GST_DATA (buf);
}

View file

@ -289,11 +289,11 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
/* Initial state, we don't even know if we are dealing with a flac file */
if (tag->state == GST_FLAC_TAG_STATE_INIT) {
if (!caps_nego (tag)) {
return;
goto cleanup;
}
if (GST_BUFFER_SIZE (tag->buffer) < sizeof (FLAC_MAGIC)) {
return;
goto cleanup;
}
if (strncmp (GST_BUFFER_DATA (tag->buffer), FLAC_MAGIC,
@ -337,7 +337,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
* 24 next bits: size of the metadata to follow (big endian)
*/
if (GST_BUFFER_SIZE (tag->buffer) < 4) {
return;
goto cleanup;
}
is_last = (((GST_BUFFER_DATA (tag->buffer)[0]) & 0x80) == 0x80);
/* If we have metadata set on the element, the last metadata block
@ -443,7 +443,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
if (tag->only_output_tags) {
send_eos (tag);
return;
goto cleanup;
}
}
@ -456,7 +456,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
* metadata, so just stop now
*/
send_eos (tag);
return;
goto cleanup;
} else {
tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT;
}
@ -507,7 +507,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
if (buffer == NULL) {
GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
("Error converting tag list to vorbiscomment buffer"));
return;
goto cleanup;
}
size = GST_BUFFER_SIZE (buffer) - 4;
if ((size > 0xFFFFFF) || (size < 0)) {
@ -517,7 +517,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
*/
GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL),
("Vorbis comment of size %d too long", size));
return;
goto cleanup;
}
/* Get rid of the framing bit at the end of the vorbiscomment buffer
@ -545,12 +545,14 @@ gst_flac_tag_chain (GstPad * pad, GstData * data)
tag->state = GST_FLAC_TAG_STATE_AUDIO_DATA;
}
/* The metadata blocks have been read, now we are reading audio data */
if (tag->state == GST_FLAC_TAG_STATE_AUDIO_DATA) {
gst_pad_push (tag->srcpad, GST_DATA (tag->buffer));
tag->buffer = NULL;
}
cleanup:
gst_object_unref (tag);
}

View file

@ -126,7 +126,7 @@ GST_BOILERPLATE (GstGdkPixbuf, gst_gdk_pixbuf, GstElement, GST_TYPE_ELEMENT)
GST_DEBUG ("got framerate of %d/%d fps => packetized mode",
filter->framerate_numerator, filter->framerate_denominator);
}
gst_object_unref (filter);
return TRUE;
}
@ -184,6 +184,7 @@ gst_gdk_pixbuf_sink_getcaps (GstPad * pad)
filter = GST_GDK_PIXBUF (gst_pad_get_parent (pad));
g_return_val_if_fail (filter != NULL, NULL);
g_return_val_if_fail (GST_IS_GDK_PIXBUF (filter), NULL);
gst_object_unref (filter);
return gst_gdk_pixbuf_get_capslist ();
}

View file

@ -280,6 +280,7 @@ gst_jpegenc_getcaps (GstPad * pad)
GST_STR_FOURCC ("I420"), NULL);
}
}
gst_object_unref (jpegenc);
return caps;
}
@ -322,6 +323,8 @@ gst_jpegenc_setcaps (GstPad * pad, GstCaps * caps)
gst_jpegenc_resync (jpegenc);
}
gst_object_unref (jpegenc);
return ret;
}

View file

@ -183,7 +183,8 @@ gst_smokedec_chain (GstPad * pad, GstBuffer * buf)
if (smokeret != SMOKECODEC_OK)
goto header_error;
return GST_FLOW_OK;
ret = GST_FLOW_OK;
goto done;
}
/* now handle data packets */

View file

@ -228,6 +228,8 @@ gst_smokeenc_getcaps (GstPad * pad)
}
}
gst_object_unref (smokeenc);
return caps;
}
@ -270,6 +272,8 @@ gst_smokeenc_setcaps (GstPad * pad, GstCaps * caps)
gst_smokeenc_resync (smokeenc);
}
gst_object_unref (smokeenc);
return ret;
}

View file

@ -141,6 +141,7 @@ gst_mngdec_sinklink (GstPad * pad, const GstCaps * caps)
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_double (structure, "framerate", &mngdec->fps);
gst_object_unref (mngdec);
return TRUE;
}
@ -227,6 +228,8 @@ gst_mngdec_src_getcaps (GstPad * pad)
}
}
gst_object_unref (mngdec);
return caps;
}

View file

@ -158,6 +158,7 @@ gst_mngenc_sinklink (GstPad * pad, const GstCaps * caps)
GstMngEnc *mngenc;
gdouble fps;
GstStructure *structure;
GstPadLinkReturn result;
mngenc = GST_MNGENC (gst_pad_get_parent (pad));
@ -172,7 +173,10 @@ gst_mngenc_sinklink (GstPad * pad, const GstCaps * caps)
"width", G_TYPE_INT, mngenc->width,
"height", G_TYPE_INT, mngenc->height, NULL);
return gst_pad_try_set_caps (mngenc->srcpad, caps);
result = gst_pad_try_set_caps (mngenc->srcpad, caps);
gst_object_unref (mngenc);
return result;
}
static void
@ -202,6 +206,7 @@ gst_mngenc_chain (GstPad * pad, GstData * _data)
/* FIXME, do something here */
gst_buffer_unref (buf);
gst_object_unref (mngenc);
}

View file

@ -176,6 +176,9 @@ gst_pngenc_setcaps (GstPad * pad, GstCaps * caps)
gst_caps_unref (pcaps);
gst_object_unref (opeer);
}
gst_object_unref (pngenc);
return ret;
}

View file

@ -269,6 +269,7 @@ gst_mikmod_srclink (GstPad * pad, const GstCaps * caps)
GstStructure *structure;
gint depth;
gint channels;
gboolean result;
filter = GST_MIKMOD (gst_pad_get_parent (pad));
@ -280,7 +281,14 @@ gst_mikmod_srclink (GstPad * pad, const GstCaps * caps)
filter->stereo = (channels == 2);
gst_structure_get_int (structure, "rate", &filter->mixfreq);
return gst_mikmod_setup (filter) ? GST_PAD_LINK_OK : GST_PAD_LINK_REFUSED;
result = gst_mikmod_setup (filter);
gst_object_unref (filter);
if (result) {
return GST_PAD_LINK_OK;
} else {
return GST_PAD_LINK_REFUSED;
}
}
static void

View file

@ -158,12 +158,16 @@ speex_dec_convert (GstPad * pad,
dec = GST_SPEEXDEC (gst_pad_get_parent (pad));
if (dec->packetno < 1)
return FALSE;
if (dec->packetno < 1) {
res = FALSE;
goto cleanup;
}
if (pad == dec->sinkpad &&
(src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES))
return FALSE;
(src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES)) {
res = FALSE;
goto cleanup;
}
switch (src_format) {
case GST_FORMAT_TIME:
@ -206,6 +210,8 @@ speex_dec_convert (GstPad * pad,
res = FALSE;
}
cleanup:
gst_object_unref (dec);
return res;
}
@ -289,6 +295,8 @@ speex_dec_src_event (GstPad * pad, GstEvent * event)
break;
}
gst_object_unref (dec);
return res;
}
@ -350,6 +358,7 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf)
{
GstFlowReturn res;
GstSpeexDec *dec;
GstFlowReturn result;
dec = GST_SPEEXDEC (gst_pad_get_parent (pad));
@ -363,14 +372,16 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf)
if (!dec->header) {
GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
(NULL), ("couldn't read header"));
return GST_FLOW_ERROR;
result = GST_FLOW_ERROR;
goto cleanup;
}
if (dec->header->mode >= SPEEX_NB_MODES) {
GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
(NULL),
("Mode number %d does not (yet/any longer) exist in this version",
dec->header->mode));
return GST_FLOW_ERROR;
result = GST_FLOW_ERROR;
goto cleanup;
}
dec->mode = (SpeexMode *) speex_mode_list[dec->header->mode];
@ -381,7 +392,8 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf)
GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE,
(NULL), ("couldn't initialize decoder"));
gst_buffer_unref (buf);
return GST_FLOW_ERROR;
result = GST_FLOW_ERROR;
goto cleanup;
}
speex_decoder_ctl (dec->state, SPEEX_SET_ENH, &dec->enh);
@ -408,7 +420,8 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf)
if (!gst_pad_set_caps (dec->srcpad, caps)) {
gst_caps_unref (caps);
return GST_FLOW_NOT_NEGOTIATED;
result = GST_FLOW_NOT_NEGOTIATED;
goto cleanup;
}
gst_caps_unref (caps);
gst_pad_push_event (dec->srcpad,
@ -511,8 +524,12 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf)
}
}
dec->packetno++;
result = GST_FLOW_OK;
return GST_FLOW_OK;
cleanup:
gst_object_unref (dec);
return result;
}
static void

View file

@ -317,8 +317,10 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps)
ret &= gst_structure_get_int (structure, "height", &avimux->vids.height);
fps = gst_structure_get_value (structure, "framerate");
ret &= (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps));
if (!ret)
if (!ret) {
gst_object_unref (avimux);
return GST_PAD_LINK_REFUSED;
}
avimux->vids_hdr.rate = gst_value_get_fraction_numerator (fps);
avimux->vids_hdr.scale = gst_value_get_fraction_denominator (fps);
@ -388,6 +390,7 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps)
}
if (!avimux->vids.compression) {
gst_object_unref (avimux);
return GST_PAD_LINK_DELAYED;
}
}
@ -397,6 +400,9 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps)
avimux->avi_hdr.width = avimux->vids.width;
avimux->avi_hdr.height = avimux->vids.height;
avimux->avi_hdr.us_frame = avimux->vids_hdr.scale;
gst_object_unref (avimux);
return GST_PAD_LINK_OK;
}
@ -463,6 +469,7 @@ gst_avimux_audsinkconnect (GstPad * pad, const GstCaps * vscaps)
avimux->auds.size = 16;
if (!avimux->auds.format) {
gst_object_unref (avimux);
return GST_PAD_LINK_REFUSED;
}
}
@ -470,6 +477,9 @@ gst_avimux_audsinkconnect (GstPad * pad, const GstCaps * vscaps)
avimux->auds_hdr.rate = avimux->auds.blockalign * avimux->auds.rate;
avimux->auds_hdr.samplesize = avimux->auds.blockalign;
avimux->auds_hdr.scale = 1;
gst_object_unref (avimux);
return GST_PAD_LINK_OK;
}
@ -1089,6 +1099,7 @@ gst_avimux_handle_event (GstPad * pad, GstEvent * event)
}
gst_event_unref (event);
gst_object_unref (avimux);
return TRUE;
}

View file

@ -210,6 +210,7 @@ gst_negotiation_getcaps (GstPad * pad)
GST_PTR_FORMAT, pad, caps);
gst_negotiation_update_caps (negotiation);
gst_object_unref (negotiation);
return caps;
}
@ -228,6 +229,7 @@ gst_negotiation_pad_link (GstPad * pad, const GstCaps * caps)
GST_ERROR ("pad_link called on %" GST_PTR_FORMAT " with caps %"
GST_PTR_FORMAT ", returning %d", pad, caps, ret);
gst_object_unref (negotiation);
return ret;
}
@ -257,6 +259,7 @@ gst_negotiation_chain (GstPad * pad, GstData * _data)
GstNegotiation *negotiation = GST_NEGOTIATION (gst_pad_get_parent (pad));
gst_pad_push (negotiation->srcpad, _data);
gst_object_unref (negotiation);
}
static void

View file

@ -627,7 +627,7 @@ gst_flxdec_chain (GstPad * pad, GstBuffer * buf)
}
}
need_more_data:
gst_object_unref (flxdec);
return res;
/* ERRORS */
@ -635,6 +635,7 @@ wrong_type:
{
GST_ELEMENT_ERROR (flxdec, STREAM, WRONG_TYPE, (NULL),
("not a flx file (type %x)", flxh->type));
gst_object_unref (flxdec);
return GST_FLOW_ERROR;
}
}

View file

@ -126,6 +126,7 @@ mulawenc_setcaps (GstPad * pad, GstCaps * caps)
gst_pad_set_caps (otherpad, base_caps);
gst_object_unref (mulawenc);
gst_caps_unref (base_caps);
return TRUE;

View file

@ -154,6 +154,8 @@ gst_median_link (GstPad * pad, const GstCaps * caps)
filter->height = h;
}
gst_object_unref (filter);
return ret;
}

View file

@ -224,6 +224,8 @@ gst_monoscope_srcconnect (GstPad * pad, const GstCaps * caps)
gst_structure_get_int (structure, "height", &monoscope->height);
gst_structure_get_double (structure, "framerate", &monoscope->fps);
gst_object_unref (monoscope);
return GST_PAD_LINK_OK;
}
@ -250,6 +252,7 @@ gst_monoscope_chain (GstPad * pad, GstData * _data)
GST_DEBUG ("timestamp is %" G_GUINT64_FORMAT ": want >= %" G_GUINT64_FORMAT,
GST_BUFFER_TIMESTAMP (bufin), monoscope->next_time);
gst_buffer_unref (bufin);
gst_object_unref (monoscope);
return;
}
@ -266,6 +269,7 @@ gst_monoscope_chain (GstPad * pad, GstData * _data)
if (!gst_pad_is_negotiated (monoscope->srcpad)) {
if (gst_pad_renegotiate (monoscope->srcpad) <= 0) {
GST_ELEMENT_ERROR (monoscope, CORE, NEGOTIATION, (NULL), (NULL));
gst_object_unref (monoscope);
return;
}
}
@ -284,6 +288,7 @@ gst_monoscope_chain (GstPad * pad, GstData * _data)
gst_pad_push (monoscope->srcpad, GST_DATA (bufout));
gst_buffer_unref (bufin);
gst_object_unref (monoscope);
GST_DEBUG ("Monoscope: exiting chainfunc");

View file

@ -171,13 +171,17 @@ gst_rtpL16pay_sinkconnect (GstPad * pad, const GstCaps * caps)
ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency);
ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels);
if (!ret)
if (!ret) {
gst_object_unref (rtpL16enc);
return GST_PAD_LINK_REFUSED;
}
/* Pre-calculate what we can */
rtpL16enc->time_interval =
GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency);
gst_object_unref (rtpL16enc);
return GST_PAD_LINK_OK;
}

View file

@ -253,9 +253,12 @@ gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps)
gst_wavenc_setup (wavenc);
if (wavenc->setup) {
gst_object_unref (wavenc);
return TRUE;
}
gst_object_unref (wavenc);
return FALSE;
}

View file

@ -168,10 +168,12 @@ gst_osxaudiosink_chain (GstPad * pad, GstData * _data)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
gst_pad_event_default (pad, event);
gst_object_unref (osxaudiosink);
return;
case GST_EVENT_DISCONTINUOUS:
/* pass-through */
default:
gst_object_unref (osxaudiosink);
gst_pad_event_default (pad, event);
return;
}
@ -189,6 +191,7 @@ gst_osxaudiosink_chain (GstPad * pad, GstData * _data)
write_buffer (GST_OSXAUDIOELEMENT (osxaudiosink), data, to_write);
}
gst_buffer_unref (buf);
gst_object_unref (osxaudiosink);
}
static GstStateChangeReturn

View file

@ -159,11 +159,13 @@ gst_osxaudiosrc_get (GstPad * pad)
if (readbytes < 0) {
gst_buffer_unref (buf);
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
gst_object_unref (src);
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
if (readbytes == 0) {
gst_buffer_unref (buf);
gst_object_unref (src);
return GST_DATA (gst_event_new (GST_EVENT_INTERRUPT));
}
@ -174,6 +176,8 @@ gst_osxaudiosrc_get (GstPad * pad)
GST_DEBUG ("pushed buffer from soundcard of %ld bytes", readbytes);
gst_object_unref (src);
return GST_DATA (buf);
}