Fix a whole set of pad template leaks

Original commit message from CVS:
Fix a whole set of pad template leaks
This commit is contained in:
Thomas Vander Stichele 2005-11-16 18:21:46 +00:00
parent 8097926306
commit 44ae8114e6
13 changed files with 66 additions and 55 deletions

View file

@ -1,3 +1,22 @@
2005-11-16 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/libvisual/visual.c: (gst_visual_init):
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_init):
* ext/ogg/gstoggparse.c: (gst_ogg_parse_init),
(gst_ogg_parse_chain):
* ext/ogg/gstogmparse.c: (gst_ogm_audio_parse_init),
(gst_ogm_video_parse_init), (gst_ogm_text_parse_init):
* ext/theora/theoradec.c: (gst_theora_dec_init):
* ext/theora/theoraenc.c: (gst_theora_enc_init):
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init):
* ext/vorbis/vorbisparse.c: (gst_vorbis_parse_init):
* gst/adder/gstadder.c: (gst_adder_class_init),
(gst_adder_dispose):
* gst/audiorate/gstaudiorate.c: (gst_audiorate_init):
* gst/subparse/gstsubparse.c: (gst_subparse_init):
* gst/videorate/gstvideorate.c: (gst_videorate_init):
Fix a whole set of pad template leaks
2005-11-16 Thomas Vander Stichele <thomas at apestaart dot org> 2005-11-16 Thomas Vander Stichele <thomas at apestaart dot org>
* check/generic/states.c: (GST_START_TEST): * check/generic/states.c: (GST_START_TEST):

View file

@ -185,16 +185,12 @@ static void
gst_visual_init (GstVisual * visual) gst_visual_init (GstVisual * visual)
{ {
/* create the sink and src pads */ /* create the sink and src pads */
visual->sinkpad = visual->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
"sink");
gst_pad_set_setcaps_function (visual->sinkpad, gst_visual_sink_setcaps); gst_pad_set_setcaps_function (visual->sinkpad, gst_visual_sink_setcaps);
gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain); gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain);
gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad); gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad);
visual->srcpad = visual->srcpad = gst_pad_new_from_static_template (&src_template, "src");
gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
"src");
gst_pad_set_setcaps_function (visual->srcpad, gst_visual_src_setcaps); gst_pad_set_setcaps_function (visual->srcpad, gst_visual_src_setcaps);
gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps); gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps);
gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad); gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad);

View file

@ -1132,9 +1132,9 @@ static void
gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class) gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class)
{ {
/* create the sink pad */ /* create the sink pad */
GstPadTemplate *template = gst_static_pad_template_get ogg->sinkpad =
(&ogg_demux_sink_template_factory); gst_pad_new_from_static_template (&ogg_demux_sink_template_factory,
ogg->sinkpad = gst_pad_new_from_template (template, "sink"); "sink");
gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_handle_event); gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_handle_event);
gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain); gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain);

View file

@ -243,11 +243,10 @@ gst_ogg_parse_init (GstOggParse * ogg)
{ {
/* create the sink and source pads */ /* create the sink and source pads */
ogg->sinkpad = ogg->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&ogg_parse_sink_template_factory,
(&ogg_parse_sink_template_factory), "sink"); "sink");
ogg->srcpad = ogg->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&ogg_parse_src_template_factory, "src");
(&ogg_parse_src_template_factory), "src");
/* TODO: Are there any events we must handle? */ /* TODO: Are there any events we must handle? */
/* gst_pad_set_event_function (ogg->sinkpad, gst_ogg_parse_handle_event); */ /* gst_pad_set_event_function (ogg->sinkpad, gst_ogg_parse_handle_event); */

View file

@ -344,8 +344,9 @@ gst_ogm_audio_parse_init (GstOgmParse * ogm)
GstPadTemplate *templ; GstPadTemplate *templ;
/* create the pads */ /* create the pads */
templ = gst_static_pad_template_get (&ogm_audio_parse_sink_template_factory); ogm->sinkpad =
ogm->sinkpad = gst_pad_new_from_template (templ, "sink"); gst_pad_new_from_template (&ogm_audio_parse_sink_template_factory,
"sink");
gst_pad_set_query_function (ogm->sinkpad, gst_ogm_parse_sink_query); gst_pad_set_query_function (ogm->sinkpad, gst_ogm_parse_sink_query);
gst_pad_set_chain_function (ogm->sinkpad, gst_ogm_parse_chain); gst_pad_set_chain_function (ogm->sinkpad, gst_ogm_parse_chain);
gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad); gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad);
@ -361,11 +362,10 @@ gst_ogm_audio_parse_init (GstOgmParse * ogm)
static void static void
gst_ogm_video_parse_init (GstOgmParse * ogm) gst_ogm_video_parse_init (GstOgmParse * ogm)
{ {
GstPadTemplate *templ;
/* create the pads */ /* create the pads */
templ = gst_static_pad_template_get (&ogm_video_parse_sink_template_factory); ogm->sinkpad =
ogm->sinkpad = gst_pad_new_from_template (templ, "sink"); gst_pad_new_from_static_template (&ogm_video_parse_sink_template_factory,
"sink");
gst_pad_set_query_function (ogm->sinkpad, gst_ogm_parse_sink_query); gst_pad_set_query_function (ogm->sinkpad, gst_ogm_parse_sink_query);
gst_pad_set_chain_function (ogm->sinkpad, gst_ogm_parse_chain); gst_pad_set_chain_function (ogm->sinkpad, gst_ogm_parse_chain);
gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad); gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad);
@ -381,11 +381,10 @@ gst_ogm_video_parse_init (GstOgmParse * ogm)
static void static void
gst_ogm_text_parse_init (GstOgmParse * ogm) gst_ogm_text_parse_init (GstOgmParse * ogm)
{ {
GstPadTemplate *templ;
/* create the pads */ /* create the pads */
templ = gst_static_pad_template_get (&ogm_text_parse_sink_template_factory); ogm->sinkpad =
ogm->sinkpad = gst_pad_new_from_template (templ, "sink"); gst_pad_new_from_static_template (&ogm_text_parse_sink_template_factory,
"sink");
gst_pad_set_query_type_function (ogm->sinkpad, gst_pad_set_query_type_function (ogm->sinkpad,
gst_ogm_parse_get_sink_querytypes); gst_ogm_parse_get_sink_querytypes);
gst_pad_set_query_function (ogm->sinkpad, gst_ogm_parse_sink_query); gst_pad_set_query_function (ogm->sinkpad, gst_ogm_parse_sink_query);

View file

@ -176,16 +176,14 @@ static void
gst_theora_dec_init (GstTheoraDec * dec, GstTheoraDecClass * g_class) gst_theora_dec_init (GstTheoraDec * dec, GstTheoraDecClass * g_class)
{ {
dec->sinkpad = dec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&theora_dec_sink_factory, "sink");
(&theora_dec_sink_factory), "sink");
gst_pad_set_query_function (dec->sinkpad, theora_dec_sink_query); gst_pad_set_query_function (dec->sinkpad, theora_dec_sink_query);
gst_pad_set_event_function (dec->sinkpad, theora_dec_sink_event); gst_pad_set_event_function (dec->sinkpad, theora_dec_sink_event);
gst_pad_set_chain_function (dec->sinkpad, theora_dec_chain); gst_pad_set_chain_function (dec->sinkpad, theora_dec_chain);
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad); gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
dec->srcpad = dec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&theora_dec_src_factory, "src");
(&theora_dec_src_factory), "src");
gst_pad_set_getcaps_function (dec->srcpad, theora_dec_src_getcaps); gst_pad_set_getcaps_function (dec->srcpad, theora_dec_src_getcaps);
gst_pad_set_event_function (dec->srcpad, theora_dec_src_event); gst_pad_set_event_function (dec->srcpad, theora_dec_src_event);
gst_pad_set_query_type_function (dec->srcpad, theora_get_query_types); gst_pad_set_query_type_function (dec->srcpad, theora_get_query_types);

View file

@ -213,16 +213,14 @@ static void
gst_theora_enc_init (GstTheoraEnc * enc, GstTheoraEncClass * g_class) gst_theora_enc_init (GstTheoraEnc * enc, GstTheoraEncClass * g_class)
{ {
enc->sinkpad = enc->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&theora_enc_sink_factory, "sink");
(&theora_enc_sink_factory), "sink");
gst_pad_set_chain_function (enc->sinkpad, theora_enc_chain); gst_pad_set_chain_function (enc->sinkpad, theora_enc_chain);
gst_pad_set_event_function (enc->sinkpad, theora_enc_sink_event); gst_pad_set_event_function (enc->sinkpad, theora_enc_sink_event);
gst_pad_set_setcaps_function (enc->sinkpad, theora_enc_sink_setcaps); gst_pad_set_setcaps_function (enc->sinkpad, theora_enc_sink_setcaps);
gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad); gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
enc->srcpad = enc->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&theora_enc_src_factory, "src");
(&theora_enc_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (enc), enc->srcpad); gst_element_add_pad (GST_ELEMENT (enc), enc->srcpad);
enc->center = THEORA_DEF_CENTER; enc->center = THEORA_DEF_CENTER;

View file

@ -165,18 +165,16 @@ vorbis_get_query_types (GstPad * pad)
static void static void
gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class) gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class)
{ {
GstPadTemplate *template; dec->sinkpad = gst_pad_new_from_static_template (&vorbis_dec_sink_factory,
"sink");
template = gst_static_pad_template_get (&vorbis_dec_sink_factory);
dec->sinkpad = gst_pad_new_from_template (template, "sink");
gst_pad_set_event_function (dec->sinkpad, vorbis_dec_sink_event); gst_pad_set_event_function (dec->sinkpad, vorbis_dec_sink_event);
gst_pad_set_chain_function (dec->sinkpad, vorbis_dec_chain); gst_pad_set_chain_function (dec->sinkpad, vorbis_dec_chain);
gst_pad_set_query_function (dec->sinkpad, vorbis_dec_sink_query); gst_pad_set_query_function (dec->sinkpad, vorbis_dec_sink_query);
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad); gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
template = gst_static_pad_template_get (&vorbis_dec_src_factory); dec->srcpad = gst_pad_new_from_static_template (&vorbis_dec_src_factory,
dec->srcpad = gst_pad_new_from_template (template, "src"); "src");
gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event); gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event);
gst_pad_set_query_type_function (dec->srcpad, vorbis_get_query_types); gst_pad_set_query_type_function (dec->srcpad, vorbis_get_query_types);

View file

@ -90,16 +90,15 @@ static void
gst_vorbis_parse_init (GstVorbisParse * parse, GstVorbisParseClass * g_class) gst_vorbis_parse_init (GstVorbisParse * parse, GstVorbisParseClass * g_class)
{ {
parse->sinkpad = parse->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&vorbis_parse_sink_factory, "sink");
(&vorbis_parse_sink_factory), "sink");
gst_pad_set_chain_function (parse->sinkpad, vorbis_parse_chain); gst_pad_set_chain_function (parse->sinkpad, vorbis_parse_chain);
gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad); gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad);
parse->srcpad = parse->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&vorbis_parse_src_factory, "src");
(&vorbis_parse_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad); gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad);
} }
static void static void
vorbis_parse_set_header_on_caps (GstVorbisParse * parse, GstCaps * caps) vorbis_parse_set_header_on_caps (GstVorbisParse * parse, GstCaps * caps)
{ {

View file

@ -71,6 +71,7 @@ static GstStaticPadTemplate gst_adder_sink_template =
static void gst_adder_class_init (GstAdderClass * klass); static void gst_adder_class_init (GstAdderClass * klass);
static void gst_adder_init (GstAdder * adder); static void gst_adder_init (GstAdder * adder);
static void gst_adder_dispose (GObject * object);
static GstPad *gst_adder_request_new_pad (GstElement * element, static GstPad *gst_adder_request_new_pad (GstElement * element,
GstPadTemplate * temp, const gchar * unused); GstPadTemplate * temp, const gchar * unused);
@ -249,6 +250,9 @@ gst_adder_class_init (GstAdderClass * klass)
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gobject_class->dispose = gst_adder_dispose;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gst_element_class_add_pad_template (gstelement_class, gst_element_class_add_pad_template (gstelement_class,
@ -286,6 +290,15 @@ gst_adder_init (GstAdder * adder)
gst_collectpads_set_function (adder->collect, gst_adder_collected, adder); gst_collectpads_set_function (adder->collect, gst_adder_collected, adder);
} }
static void
gst_adder_dispose (GObject * object)
{
GstAdder *adder = GST_ADDER (object);
gst_object_unref (adder->collect);
adder->collect = NULL;
}
static GstPad * static GstPad *
gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ, gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ,
const gchar * unused) const gchar * unused)

View file

@ -220,16 +220,14 @@ static void
gst_audiorate_init (GstAudiorate * audiorate) gst_audiorate_init (GstAudiorate * audiorate)
{ {
audiorate->sinkpad = audiorate->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&gst_audiorate_sink_template, "sink");
(&gst_audiorate_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->sinkpad); gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->sinkpad);
gst_pad_set_chain_function (audiorate->sinkpad, gst_audiorate_chain); gst_pad_set_chain_function (audiorate->sinkpad, gst_audiorate_chain);
gst_pad_set_setcaps_function (audiorate->sinkpad, gst_audiorate_setcaps); gst_pad_set_setcaps_function (audiorate->sinkpad, gst_audiorate_setcaps);
gst_pad_set_getcaps_function (audiorate->sinkpad, gst_pad_proxy_getcaps); gst_pad_set_getcaps_function (audiorate->sinkpad, gst_pad_proxy_getcaps);
audiorate->srcpad = audiorate->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&gst_audiorate_src_template, "src");
(&gst_audiorate_src_template), "src");
gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->srcpad); gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->srcpad);
gst_pad_set_setcaps_function (audiorate->srcpad, gst_audiorate_setcaps); gst_pad_set_setcaps_function (audiorate->srcpad, gst_audiorate_setcaps);
gst_pad_set_getcaps_function (audiorate->srcpad, gst_pad_proxy_getcaps); gst_pad_set_getcaps_function (audiorate->srcpad, gst_pad_proxy_getcaps);

View file

@ -125,15 +125,11 @@ gst_subparse_class_init (GstSubparseClass * klass)
static void static void
gst_subparse_init (GstSubparse * subparse) gst_subparse_init (GstSubparse * subparse)
{ {
subparse->sinkpad = subparse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
gst_pad_new_from_template (gst_static_pad_template_get (&sink_templ),
"sink");
gst_pad_set_chain_function (subparse->sinkpad, gst_subparse_chain); gst_pad_set_chain_function (subparse->sinkpad, gst_subparse_chain);
gst_element_add_pad (GST_ELEMENT (subparse), subparse->sinkpad); gst_element_add_pad (GST_ELEMENT (subparse), subparse->sinkpad);
subparse->srcpad = subparse->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
gst_pad_new_from_template (gst_static_pad_template_get (&src_templ),
"src");
gst_pad_set_event_function (subparse->srcpad, gst_subparse_src_event); gst_pad_set_event_function (subparse->srcpad, gst_subparse_src_event);
gst_element_add_pad (GST_ELEMENT (subparse), subparse->srcpad); gst_element_add_pad (GST_ELEMENT (subparse), subparse->srcpad);

View file

@ -361,8 +361,7 @@ gst_videorate_init (GstVideorate * videorate)
{ {
GST_DEBUG ("gst_videorate_init"); GST_DEBUG ("gst_videorate_init");
videorate->sinkpad = videorate->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&gst_videorate_sink_template, "sink");
(&gst_videorate_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (videorate), videorate->sinkpad); gst_element_add_pad (GST_ELEMENT (videorate), videorate->sinkpad);
gst_pad_set_event_function (videorate->sinkpad, gst_videorate_event); gst_pad_set_event_function (videorate->sinkpad, gst_videorate_event);
gst_pad_set_chain_function (videorate->sinkpad, gst_videorate_chain); gst_pad_set_chain_function (videorate->sinkpad, gst_videorate_chain);
@ -370,8 +369,7 @@ gst_videorate_init (GstVideorate * videorate)
gst_pad_set_setcaps_function (videorate->sinkpad, gst_videorate_setcaps); gst_pad_set_setcaps_function (videorate->sinkpad, gst_videorate_setcaps);
videorate->srcpad = videorate->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_static_template (&gst_videorate_src_template, "src");
(&gst_videorate_src_template), "src");
gst_element_add_pad (GST_ELEMENT (videorate), videorate->srcpad); gst_element_add_pad (GST_ELEMENT (videorate), videorate->srcpad);
gst_pad_set_getcaps_function (videorate->srcpad, gst_videorate_getcaps); gst_pad_set_getcaps_function (videorate->srcpad, gst_videorate_getcaps);
gst_pad_set_setcaps_function (videorate->srcpad, gst_videorate_setcaps); gst_pad_set_setcaps_function (videorate->srcpad, gst_videorate_setcaps);