+2006-03-07 Tim-Philipp Müller <tim at centricular dot net>
+
+ * ext/libvisual/visual.c: (gst_visual_getcaps),
+ (gst_visual_src_setcaps), (gst_visual_sink_setcaps):
+ * ext/ogg/gstoggmux.c: (gst_ogg_mux_sinkconnect):
+ * ext/vorbis/vorbisenc.c: (gst_vorbisenc_convert_src),
+ (gst_vorbisenc_convert_sink):
+ * gst-libs/gst/audio/audio.c: (gst_audio_frame_byte_size),
+ (gst_audio_duration_from_pad_buffer):
+ * gst-libs/gst/audio/gstaudiofilter.c: (gst_audio_filter_link),
+ (gst_audio_filter_chain):
+ * gst-libs/gst/rtp/gstbasertpdepayload.c:
+ (gst_base_rtp_depayload_setcaps):
+ * gst-libs/gst/video/video.c: (gst_video_frame_rate),
+ (gst_video_get_size):
+ * gst/audiorate/gstaudiorate.c: (gst_audio_rate_setcaps):
+ Don't leak references returned by gst_pad_get_parent()
+ (#333663, based on patch by: Christophe Fergeau).
+
2006-03-06 Stefan Kost <ensonic@users.sf.net>
* ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_class_init):
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
int depths;
- if (!visual->actor)
- return gst_caps_copy (gst_pad_get_pad_template_caps (visual->srcpad));
+ if (!visual->actor) {
+ ret = gst_caps_copy (gst_pad_get_pad_template_caps (visual->srcpad));
+ goto beach;
+ }
ret = gst_caps_new_empty ();
depths = visual_actor_get_supported_depth (visual->actor);
if (depths < 0) {
/* FIXME: set an error */
- return ret;
+ goto beach;
}
if (depths == VISUAL_VIDEO_DEPTH_GL) {
/* We can't handle GL only plugins */
- return ret;
+ goto beach;
}
GST_DEBUG_OBJECT (visual, "libvisual plugin supports depths %u (0x%04x)",
gst_caps_append (ret, gst_caps_from_string (GST_VIDEO_CAPS_RGB_16));
}
+beach:
+
GST_DEBUG_OBJECT (visual, "returning caps %" GST_PTR_FORMAT, ret);
+ gst_object_unref (visual);
return ret;
}
GST_DEBUG_OBJECT (visual, "src pad got caps %" GST_PTR_FORMAT, caps);
if (!gst_structure_get_int (structure, "width", &visual->width))
- return FALSE;
+ goto error;
if (!gst_structure_get_int (structure, "height", &visual->height))
- return FALSE;
+ goto error;
if (!gst_structure_get_int (structure, "bpp", &depth))
- return FALSE;
+ goto error;
if (!gst_structure_get_fraction (structure, "framerate", &visual->fps_n,
&visual->fps_d))
- return FALSE;
+ goto error;
visual_video_set_depth (visual->video,
visual_video_depth_enum_from_value (depth));
visual_video_set_dimension (visual->video, visual->width, visual->height);
visual_actor_video_negotiate (visual->actor, 0, FALSE, FALSE);
+ gst_object_unref (visual);
return TRUE;
+
+error:
+ {
+ gst_object_unref (visual);
+ return FALSE;
+ }
}
static gboolean
gst_structure_get_int (structure, "rate", &visual->rate);
+ gst_object_unref (visual);
return TRUE;
}
gst_ogg_mux_sinkconnect (GstPad * pad, GstPad * peer)
{
GstOggMux *ogg_mux;
- gchar *name;
ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
- name = gst_pad_get_name (pad);
+ GST_DEBUG_OBJECT (ogg_mux, "sinkconnect triggered on %s", GST_PAD_NAME (pad));
- GST_DEBUG_OBJECT (ogg_mux, "sinkconnect triggered on %s", name);
-
- g_free (name);
+ gst_object_unref (ogg_mux);
return GST_PAD_LINK_OK;
}
vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
if (vorbisenc->samples_in == 0 ||
- vorbisenc->bytes_out == 0 || vorbisenc->frequency == 0)
+ vorbisenc->bytes_out == 0 || vorbisenc->frequency == 0) {
+ gst_object_unref (vorbisenc);
return FALSE;
+ }
avg = (vorbisenc->bytes_out * vorbisenc->frequency) / (vorbisenc->samples_in);
default:
res = FALSE;
}
+ gst_object_unref (vorbisenc);
return res;
}
default:
res = FALSE;
}
+ gst_object_unref (vorbisenc);
return res;
}
if (caps == NULL) {
/* ERROR: could not get caps of pad */
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ GST_DEBUG_PAD_NAME (pad));
return 0;
}
if (caps == NULL) {
/* ERROR: could not get caps of pad */
g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ GST_DEBUG_PAD_NAME (pad));
length = GST_CLOCK_TIME_NONE;
} else {
structure = gst_caps_get_structure (caps, 0);
}
if (GST_PAD_LINK_FAILED (link_ret)) {
+ gst_object_unref (audiofilter);
return link_ret;
}
ret &= gst_structure_get_int (structure, "rate", &audiofilter->rate);
ret &= gst_structure_get_int (structure, "channels", &audiofilter->channels);
- if (!ret)
+ if (!ret) {
+ gst_object_unref (audiofilter);
return GST_PAD_LINK_REFUSED;
+ }
audiofilter->bytes_per_sample = (audiofilter->width / 8) *
audiofilter->channels;
(audio_filter_class->setup) (audiofilter);
#endif
+ gst_object_unref (audiofilter);
return GST_PAD_LINK_OK;
}
g_return_val_if_fail (inbuf != NULL, GST_FLOW_ERROR);
audiofilter = GST_AUDIO_FILTER (gst_pad_get_parent (pad));
- //g_return_if_fail (audiofilter->inited);
+ /* g_return_if_fail (audiofilter->inited); */
audio_filter_class =
GST_AUDIO_FILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter));
if (audiofilter->passthru) {
gst_pad_push (audiofilter->srcpad, buffer);
+ gst_object_unref (audiofilter);
return GST_FLOW_OK;
}
gst_pad_push (audiofilter->srcpad, outbuf);
+ gst_object_unref (audiofilter);
return GST_FLOW_OK;
}
{
GstBaseRTPDepayload *filter;
GstBaseRTPDepayloadClass *bclass;
+ gboolean res;
filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad));
g_return_val_if_fail (filter != NULL, FALSE);
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
if (bclass->set_caps)
- return bclass->set_caps (filter, caps);
+ res = bclass->set_caps (filter, caps);
else
- return TRUE;
+ res = TRUE;
+
+ gst_object_unref (filter);
+ return res;
}
static GstFlowReturn
caps = GST_PAD_CAPS (pad);
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ GST_DEBUG_PAD_NAME (pad));
return NULL;
}
structure = gst_caps_get_structure (caps, 0);
if ((fps = gst_structure_get_value (structure, "framerate")) == NULL) {
g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ GST_DEBUG_PAD_NAME (pad));
return NULL;
}
if (!GST_VALUE_HOLDS_FRACTION (fps)) {
g_warning
("gstvideo: framerate property of pad %s:%s is not of type Fraction",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ GST_DEBUG_PAD_NAME (pad));
return NULL;
}
fps_string = gst_value_serialize (fps);
GST_DEBUG ("Framerate request on pad %s:%s: %s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad),
- fps_string);
+ GST_DEBUG_PAD_NAME (pad), fps_string);
g_free (fps_string);
return fps;
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ GST_DEBUG_PAD_NAME (pad));
return FALSE;
}
if (!ret) {
g_warning ("gstvideo: failed to get size properties on pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ GST_DEBUG_PAD_NAME (pad));
return FALSE;
}
GST_DEBUG ("size request on pad %s:%s: %dx%d",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
- GST_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
+ GST_DEBUG_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
return TRUE;
}
GstAudioRate *audiorate;
GstStructure *structure;
GstPad *otherpad;
- gint ret, channels, width;
+ gboolean ret = FALSE;
+ gint channels, width;
audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
audiorate->srcpad;
if (!gst_pad_set_caps (otherpad, caps))
- return FALSE;
+ goto beach;
structure = gst_caps_get_structure (caps, 0);
- ret = gst_structure_get_int (structure, "channels", &channels);
- ret &= gst_structure_get_int (structure, "width", &width);
-
- if (!ret)
- return FALSE;
+ if (!gst_structure_get_int (structure, "channels", &channels) ||
+ !gst_structure_get_int (structure, "width", &width)) {
+ goto beach;
+ }
audiorate->bytes_per_sample = channels * (width / 8);
if (audiorate->bytes_per_sample == 0)
audiorate->bytes_per_sample = 1;
+ ret = TRUE;
- return TRUE;
+beach:
+ gst_object_unref (audiorate);
+ return ret;
}
static void