Memory leak fixes

Original commit message from CVS:
Memory leak fixes
Allow level to take mono or stereo audio
This commit is contained in:
Iain Holmes 2004-10-26 11:36:53 +00:00
parent a2fc6d6a7d
commit e2dc945577
4 changed files with 53 additions and 33 deletions

View file

@ -1,3 +1,19 @@
2004-10-26 Iain <iaingnome@gmail.com>
* ext/ogg/gstoggdemux.c (gst_ogg_pad_new): Free the tag list.
* gst/audioscale/gstaudioscale.c (gst_audioscale_link): Free the copy
of the caps.
* gst/interleave/interleave.c (interleave_class_init): Hook up release
pad.
(interleave_release_pad): Remove the pad.
* gst/level/gstlevel.c: Allow the level to take 1 or 2 channels.
* sys/sunaudio/gstsunaudio.c (gst_sunaudio_setparams): Pay attention to
the set device.
* sys/xvimage/xvimagesink.c (gst_xvimagesink_get_xv_support): Free the
attrs
(gst_xvimagesink_xcontext_clear): Free the xcontext.
(gst_xvimagesink_finalize): Free the par.
2004-10-26 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/avi/gstavimux.c: (gst_avimux_audsinkconnect),

View file

@ -559,10 +559,12 @@ gst_ogg_demux_src_event (GstPad * pad, GstEvent * event)
GST_OGG_SET_STATE (ogg, GST_OGG_STATE_PLAY);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;
);
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
pad->flags |= GST_OGG_PAD_NEEDS_FLUSH;);
pad->flags |= GST_OGG_PAD_NEEDS_FLUSH;
);
}
GST_DEBUG_OBJECT (ogg,
"initiating seeking to format %d, offset %" G_GUINT64_FORMAT, format,
@ -636,7 +638,8 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event)
gst_event_unref (event);
GST_FLAG_UNSET (ogg, GST_OGG_FLAG_WAIT_FOR_DISCONT);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad,
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;);
pad->flags |= GST_OGG_PAD_NEEDS_DISCONT;
);
break;
default:
gst_pad_event_default (pad, event);
@ -922,7 +925,8 @@ _find_chain_get_unknown_part (GstOggDemux * ogg, gint64 * start, gint64 * end)
*end = G_MAXINT64;
g_assert (ogg->current_chain >= 0);
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset););
FOR_PAD_IN_CURRENT_CHAIN (ogg, pad, *start = MAX (*start, pad->end_offset);
);
if (ogg->setup_state == SETUP_FIND_LAST_CHAIN) {
*end = gst_file_pad_get_length (ogg->sinkpad);
@ -1051,7 +1055,8 @@ _find_streams_check (GstOggDemux * ogg)
} else {
endpos = G_MAXINT64;
FOR_PAD_IN_CHAIN (ogg, pad, ogg->chains->len - 1,
endpos = MIN (endpos, pad->start_offset););
endpos = MIN (endpos, pad->start_offset);
);
}
if (!ogg->seek_skipped || gst_ogg_demux_position (ogg) >= endpos) {
/* have we found the endposition for all streams yet? */
@ -1240,6 +1245,8 @@ gst_ogg_pad_new (GstOggDemux * ogg, int serial)
}
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_SERIAL, serial, NULL);
gst_element_found_tags (GST_ELEMENT (ogg), list);
gst_tag_list_free (list);
GST_LOG_OBJECT (ogg, "created new ogg src %p for stream with serial %d", ret,
serial);
ret->start_offset = ret->end_offset = -1;

View file

@ -84,17 +84,17 @@ enum
{
static GType audioscale_method_type = 0;
static GEnumValue audioscale_methods[] =
{
{
GST_RESAMPLE_NEAREST, "0", "Nearest"}
,
{
GST_RESAMPLE_BILINEAR, "1", "Bilinear"}
, {
GST_RESAMPLE_SINC, "2", "Sinc"}
, {
0, NULL, NULL}
,};
{
{
GST_RESAMPLE_NEAREST, "0", "Nearest"}
,
{
GST_RESAMPLE_BILINEAR, "1", "Bilinear"}
, {
GST_RESAMPLE_SINC, "2", "Sinc"}
, {
0, NULL, NULL}
,};
if (!audioscale_method_type) {
audioscale_method_type = g_enum_register_static ("GstAudioscaleMethod",
@ -127,8 +127,7 @@ GType audioscale_get_type (void)
if (!audioscale_type)
{
static const GTypeInfo audioscale_info =
{
static const GTypeInfo audioscale_info = {
sizeof (AudioscaleClass),
gst_audioscale_base_init,
NULL,
@ -188,8 +187,7 @@ static void gst_audioscale_expand_value (GValue * dest, const GValue * src)
int rate_min, rate_max;
if (G_VALUE_TYPE (src) == G_TYPE_INT ||
G_VALUE_TYPE (src) == GST_TYPE_INT_RANGE)
{
G_VALUE_TYPE (src) == GST_TYPE_INT_RANGE) {
if (G_VALUE_TYPE (src) == G_TYPE_INT) {
rate_min = g_value_get_int (src);
rate_max = rate_min;
@ -213,8 +211,7 @@ static void gst_audioscale_expand_value (GValue * dest, const GValue * src)
g_value_init (dest, GST_TYPE_LIST);
for (i = 0; i < gst_value_list_get_size (src); i++) {
const GValue *s = gst_value_list_get_value (src, i);
GValue d =
{
GValue d = {
0};
int j;
@ -222,8 +219,7 @@ static void gst_audioscale_expand_value (GValue * dest, const GValue * src)
for (j = 0; j < gst_value_list_get_size (dest); j++) {
const GValue *s2 = gst_value_list_get_value (dest, j);
GValue d2 =
{
GValue d2 = {
0};
gst_value_union (&d2, &d, s2);
@ -242,8 +238,7 @@ static void gst_audioscale_expand_value (GValue * dest, const GValue * src)
if (gst_value_list_get_size (dest) == 1) {
const GValue *s = gst_value_list_get_value (dest, 0);
GValue d =
{
GValue d = {
0};
gst_value_init_and_copy (&d, s);
@ -268,8 +263,7 @@ static void gst_audioscale_expand_caps (GstCaps * caps)
for (i = 0; i < gst_caps_get_size (caps); i++) {
GstStructure *structure = gst_caps_get_structure (caps, i);
const GValue *value;
GValue dest =
{
GValue dest = {
0};
value = gst_structure_get_value (structure, "rate");
@ -312,8 +306,7 @@ static GstCaps *gst_audioscale_fixate (GstPad * pad, const GstCaps * caps)
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
r = &(audioscale->gst_resample_template);
if (pad == audioscale->srcpad)
{
if (pad == audioscale->srcpad) {
otherpad = audioscale->sinkpad;
rate = r->i_rate;
} else
@ -351,8 +344,7 @@ static GstPadLinkReturn gst_audioscale_link (GstPad * pad, const GstCaps * caps)
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
r = &(audioscale->gst_resample_template);
if (pad == audioscale->srcpad)
{
if (pad == audioscale->srcpad) {
otherpad = audioscale->sinkpad;
rate = &r->o_rate;
otherrate = &r->i_rate;
@ -372,6 +364,7 @@ static GstPadLinkReturn gst_audioscale_link (GstPad * pad, const GstCaps * caps)
copy = gst_caps_copy (caps);
gst_audioscale_expand_caps (copy);
link_ret = gst_pad_try_set_caps_nonfixed (otherpad, copy);
gst_caps_free (copy);
if (GST_PAD_LINK_FAILED (link_ret))
return link_ret;

View file

@ -736,7 +736,7 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
/* Set XV_AUTOPAINT_COLORKEY */
{
int count;
const XvAttribute *const attr = XvQueryPortAttributes (xcontext->disp,
XvAttribute *const attr = XvQueryPortAttributes (xcontext->disp,
xcontext->xv_port_id, &count);
static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
@ -747,6 +747,8 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom, 1);
break;
}
XFree (attr);
}
/* We get all image formats supported by our port */
@ -1090,6 +1092,7 @@ gst_xvimagesink_xcontext_clear (GstXvImageSink * xvimagesink)
g_mutex_unlock (xvimagesink->x_lock);
g_free (xvimagesink->xcontext);
xvimagesink->xcontext = NULL;
}
@ -1887,6 +1890,7 @@ gst_xvimagesink_finalize (GObject * object)
xvimagesink->display_name = NULL;
}
g_free (xvimagesink->par);
g_mutex_free (xvimagesink->x_lock);
g_mutex_free (xvimagesink->pool_lock);