+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),
overlay->fps_n = gst_value_get_fraction_numerator (fps);
overlay->fps_d = gst_value_get_fraction_denominator (fps);
+ gst_object_unref (overlay);
+
return ret;
}
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);
}
/* 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,
* 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
if (tag->only_output_tags) {
send_eos (tag);
- return;
+ goto cleanup;
}
}
* metadata, so just stop now
*/
send_eos (tag);
- return;
+ goto cleanup;
} else {
tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT;
}
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)) {
*/
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
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);
}
GST_DEBUG ("got framerate of %d/%d fps => packetized mode",
filter->framerate_numerator, filter->framerate_denominator);
}
-
+ gst_object_unref (filter);
return TRUE;
}
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 ();
}
GST_STR_FOURCC ("I420"), NULL);
}
}
+ gst_object_unref (jpegenc);
return caps;
}
gst_jpegenc_resync (jpegenc);
}
+ gst_object_unref (jpegenc);
+
return ret;
}
if (smokeret != SMOKECODEC_OK)
goto header_error;
- return GST_FLOW_OK;
+ ret = GST_FLOW_OK;
+ goto done;
}
/* now handle data packets */
}
}
+ gst_object_unref (smokeenc);
+
return caps;
}
gst_smokeenc_resync (smokeenc);
}
+ gst_object_unref (smokeenc);
+
return ret;
}
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_double (structure, "framerate", &mngdec->fps);
+ gst_object_unref (mngdec);
return TRUE;
}
}
}
+ gst_object_unref (mngdec);
+
return caps;
}
GstMngEnc *mngenc;
gdouble fps;
GstStructure *structure;
+ GstPadLinkReturn result;
mngenc = GST_MNGENC (gst_pad_get_parent (pad));
"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
/* FIXME, do something here */
gst_buffer_unref (buf);
+ gst_object_unref (mngenc);
}
gst_caps_unref (pcaps);
gst_object_unref (opeer);
}
+
+ gst_object_unref (pngenc);
+
return ret;
}
GstStructure *structure;
gint depth;
gint channels;
+ gboolean result;
filter = GST_MIKMOD (gst_pad_get_parent (pad));
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
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:
res = FALSE;
}
+cleanup:
+ gst_object_unref (dec);
return res;
}
break;
}
+ gst_object_unref (dec);
+
return res;
}
{
GstFlowReturn res;
GstSpeexDec *dec;
+ GstFlowReturn result;
dec = GST_SPEEXDEC (gst_pad_get_parent (pad));
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];
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);
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,
}
}
dec->packetno++;
+ result = GST_FLOW_OK;
+
+cleanup:
+ gst_object_unref (dec);
- return GST_FLOW_OK;
+ return result;
}
static void
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);
}
if (!avimux->vids.compression) {
+ gst_object_unref (avimux);
return GST_PAD_LINK_DELAYED;
}
}
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;
}
avimux->auds.size = 16;
if (!avimux->auds.format) {
+ gst_object_unref (avimux);
return GST_PAD_LINK_REFUSED;
}
}
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;
}
}
gst_event_unref (event);
+ gst_object_unref (avimux);
return TRUE;
}
GST_PTR_FORMAT, pad, caps);
gst_negotiation_update_caps (negotiation);
+ gst_object_unref (negotiation);
return 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;
}
GstNegotiation *negotiation = GST_NEGOTIATION (gst_pad_get_parent (pad));
gst_pad_push (negotiation->srcpad, _data);
+ gst_object_unref (negotiation);
}
static void
}
}
need_more_data:
-
+ gst_object_unref (flxdec);
return res;
/* ERRORS */
{
GST_ELEMENT_ERROR (flxdec, STREAM, WRONG_TYPE, (NULL),
("not a flx file (type %x)", flxh->type));
+ gst_object_unref (flxdec);
return GST_FLOW_ERROR;
}
}
gst_pad_set_caps (otherpad, base_caps);
+ gst_object_unref (mulawenc);
gst_caps_unref (base_caps);
return TRUE;
filter->height = h;
}
+ gst_object_unref (filter);
+
return ret;
}
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;
}
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;
}
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;
}
}
gst_pad_push (monoscope->srcpad, GST_DATA (bufout));
gst_buffer_unref (bufin);
+ gst_object_unref (monoscope);
GST_DEBUG ("Monoscope: exiting chainfunc");
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;
}
gst_wavenc_setup (wavenc);
if (wavenc->setup) {
+ gst_object_unref (wavenc);
return TRUE;
}
+ gst_object_unref (wavenc);
+
return FALSE;
}
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;
}
write_buffer (GST_OSXAUDIOELEMENT (osxaudiosink), data, to_write);
}
gst_buffer_unref (buf);
+ gst_object_unref (osxaudiosink);
}
static GstStateChangeReturn
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));
}
GST_DEBUG ("pushed buffer from soundcard of %ld bytes", readbytes);
+ gst_object_unref (src);
+
return GST_DATA (buf);
}