Fix a whole set of pad template leaks
authorThomas Vander Stichele <thomas@apestaart.org>
Wed, 16 Nov 2005 18:21:46 +0000 (18:21 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Wed, 16 Nov 2005 18:21:46 +0000 (18:21 +0000)
Original commit message from CVS:
Fix a whole set of pad template leaks

13 files changed:
ChangeLog
ext/libvisual/visual.c
ext/ogg/gstoggdemux.c
ext/ogg/gstoggparse.c
ext/ogg/gstogmparse.c
ext/theora/theoradec.c
ext/theora/theoraenc.c
ext/vorbis/vorbisdec.c
ext/vorbis/vorbisparse.c
gst/adder/gstadder.c
gst/audiorate/gstaudiorate.c
gst/subparse/gstsubparse.c
gst/videorate/gstvideorate.c

index 8f467cb..c356bbf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 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>
+
        * check/generic/states.c: (GST_START_TEST):
          fix the test so that it only checks for elements that are part of
          this source module
index a46fb96..07526f5 100644 (file)
@@ -185,16 +185,12 @@ static void
 gst_visual_init (GstVisual * visual)
 {
   /* create the sink and src pads */
-  visual->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
-      "sink");
+  visual->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
   gst_pad_set_setcaps_function (visual->sinkpad, gst_visual_sink_setcaps);
   gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain);
   gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad);
 
-  visual->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
-      "src");
+  visual->srcpad = gst_pad_new_from_static_template (&src_template, "src");
   gst_pad_set_setcaps_function (visual->srcpad, gst_visual_src_setcaps);
   gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps);
   gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad);
index 78dd2ac..be92b6c 100644 (file)
@@ -1132,9 +1132,9 @@ static void
 gst_ogg_demux_init (GstOggDemux * ogg, GstOggDemuxClass * g_class)
 {
   /* create the sink pad */
-  GstPadTemplate *template = gst_static_pad_template_get
-      (&ogg_demux_sink_template_factory);
-  ogg->sinkpad = gst_pad_new_from_template (template, "sink");
+  ogg->sinkpad =
+      gst_pad_new_from_static_template (&ogg_demux_sink_template_factory,
+      "sink");
 
   gst_pad_set_event_function (ogg->sinkpad, gst_ogg_demux_handle_event);
   gst_pad_set_chain_function (ogg->sinkpad, gst_ogg_demux_chain);
index d2c9217..11edb33 100644 (file)
@@ -243,11 +243,10 @@ gst_ogg_parse_init (GstOggParse * ogg)
 {
   /* create the sink and source pads */
   ogg->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&ogg_parse_sink_template_factory), "sink");
+      gst_pad_new_from_static_template (&ogg_parse_sink_template_factory,
+      "sink");
   ogg->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&ogg_parse_src_template_factory), "src");
+      gst_pad_new_from_static_template (&ogg_parse_src_template_factory, "src");
 
   /* TODO: Are there any events we must handle? */
   /* gst_pad_set_event_function (ogg->sinkpad, gst_ogg_parse_handle_event); */
index 0a1a338..6d4681a 100644 (file)
@@ -344,8 +344,9 @@ gst_ogm_audio_parse_init (GstOgmParse * ogm)
   GstPadTemplate *templ;
 
   /* create the pads */
-  templ = gst_static_pad_template_get (&ogm_audio_parse_sink_template_factory);
-  ogm->sinkpad = gst_pad_new_from_template (templ, "sink");
+  ogm->sinkpad =
+      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_chain_function (ogm->sinkpad, gst_ogm_parse_chain);
   gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad);
@@ -361,11 +362,10 @@ gst_ogm_audio_parse_init (GstOgmParse * ogm)
 static void
 gst_ogm_video_parse_init (GstOgmParse * ogm)
 {
-  GstPadTemplate *templ;
-
   /* create the pads */
-  templ = gst_static_pad_template_get (&ogm_video_parse_sink_template_factory);
-  ogm->sinkpad = gst_pad_new_from_template (templ, "sink");
+  ogm->sinkpad =
+      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_chain_function (ogm->sinkpad, gst_ogm_parse_chain);
   gst_element_add_pad (GST_ELEMENT (ogm), ogm->sinkpad);
@@ -381,11 +381,10 @@ gst_ogm_video_parse_init (GstOgmParse * ogm)
 static void
 gst_ogm_text_parse_init (GstOgmParse * ogm)
 {
-  GstPadTemplate *templ;
-
   /* create the pads */
-  templ = gst_static_pad_template_get (&ogm_text_parse_sink_template_factory);
-  ogm->sinkpad = gst_pad_new_from_template (templ, "sink");
+  ogm->sinkpad =
+      gst_pad_new_from_static_template (&ogm_text_parse_sink_template_factory,
+      "sink");
   gst_pad_set_query_type_function (ogm->sinkpad,
       gst_ogm_parse_get_sink_querytypes);
   gst_pad_set_query_function (ogm->sinkpad, gst_ogm_parse_sink_query);
index 46532fb..a52db17 100644 (file)
@@ -176,16 +176,14 @@ static void
 gst_theora_dec_init (GstTheoraDec * dec, GstTheoraDecClass * g_class)
 {
   dec->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&theora_dec_sink_factory), "sink");
+      gst_pad_new_from_static_template (&theora_dec_sink_factory, "sink");
   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_chain_function (dec->sinkpad, theora_dec_chain);
   gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
 
   dec->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&theora_dec_src_factory), "src");
+      gst_pad_new_from_static_template (&theora_dec_src_factory, "src");
   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_query_type_function (dec->srcpad, theora_get_query_types);
index cbf20d1..dee6e87 100644 (file)
@@ -213,16 +213,14 @@ static void
 gst_theora_enc_init (GstTheoraEnc * enc, GstTheoraEncClass * g_class)
 {
   enc->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&theora_enc_sink_factory), "sink");
+      gst_pad_new_from_static_template (&theora_enc_sink_factory, "sink");
   gst_pad_set_chain_function (enc->sinkpad, theora_enc_chain);
   gst_pad_set_event_function (enc->sinkpad, theora_enc_sink_event);
   gst_pad_set_setcaps_function (enc->sinkpad, theora_enc_sink_setcaps);
   gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
 
   enc->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&theora_enc_src_factory), "src");
+      gst_pad_new_from_static_template (&theora_enc_src_factory, "src");
   gst_element_add_pad (GST_ELEMENT (enc), enc->srcpad);
 
   enc->center = THEORA_DEF_CENTER;
index feccc02..9b3a48d 100644 (file)
@@ -165,18 +165,16 @@ vorbis_get_query_types (GstPad * pad)
 static void
 gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class)
 {
-  GstPadTemplate *template;
-
-  template = gst_static_pad_template_get (&vorbis_dec_sink_factory);
-  dec->sinkpad = gst_pad_new_from_template (template, "sink");
+  dec->sinkpad = gst_pad_new_from_static_template (&vorbis_dec_sink_factory,
+      "sink");
 
   gst_pad_set_event_function (dec->sinkpad, vorbis_dec_sink_event);
   gst_pad_set_chain_function (dec->sinkpad, vorbis_dec_chain);
   gst_pad_set_query_function (dec->sinkpad, vorbis_dec_sink_query);
   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_template (template, "src");
+  dec->srcpad = gst_pad_new_from_static_template (&vorbis_dec_src_factory,
+      "src");
 
   gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event);
   gst_pad_set_query_type_function (dec->srcpad, vorbis_get_query_types);
index a9d605a..ca15c76 100644 (file)
@@ -90,16 +90,15 @@ static void
 gst_vorbis_parse_init (GstVorbisParse * parse, GstVorbisParseClass * g_class)
 {
   parse->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&vorbis_parse_sink_factory), "sink");
+      gst_pad_new_from_static_template (&vorbis_parse_sink_factory, "sink");
   gst_pad_set_chain_function (parse->sinkpad, vorbis_parse_chain);
   gst_element_add_pad (GST_ELEMENT (parse), parse->sinkpad);
 
   parse->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&vorbis_parse_src_factory), "src");
+      gst_pad_new_from_static_template (&vorbis_parse_src_factory, "src");
   gst_element_add_pad (GST_ELEMENT (parse), parse->srcpad);
 }
+
 static void
 vorbis_parse_set_header_on_caps (GstVorbisParse * parse, GstCaps * caps)
 {
index 2a3d66c..2835f78 100644 (file)
@@ -71,6 +71,7 @@ static GstStaticPadTemplate gst_adder_sink_template =
 
 static void gst_adder_class_init (GstAdderClass * klass);
 static void gst_adder_init (GstAdder * adder);
+static void gst_adder_dispose (GObject * object);
 
 static GstPad *gst_adder_request_new_pad (GstElement * element,
     GstPadTemplate * temp, const gchar * unused);
@@ -249,6 +250,9 @@ gst_adder_class_init (GstAdderClass * klass)
   GstElementClass *gstelement_class;
 
   gobject_class = (GObjectClass *) klass;
+
+  gobject_class->dispose = gst_adder_dispose;
+
   gstelement_class = (GstElementClass *) klass;
 
   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);
 }
 
+static void
+gst_adder_dispose (GObject * object)
+{
+  GstAdder *adder = GST_ADDER (object);
+
+  gst_object_unref (adder->collect);
+  adder->collect = NULL;
+}
+
 static GstPad *
 gst_adder_request_new_pad (GstElement * element, GstPadTemplate * templ,
     const gchar * unused)
index 96dd436..3959f04 100644 (file)
@@ -220,16 +220,14 @@ static void
 gst_audiorate_init (GstAudiorate * audiorate)
 {
   audiorate->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&gst_audiorate_sink_template), "sink");
+      gst_pad_new_from_static_template (&gst_audiorate_sink_template, "sink");
   gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->sinkpad);
   gst_pad_set_chain_function (audiorate->sinkpad, gst_audiorate_chain);
   gst_pad_set_setcaps_function (audiorate->sinkpad, gst_audiorate_setcaps);
   gst_pad_set_getcaps_function (audiorate->sinkpad, gst_pad_proxy_getcaps);
 
   audiorate->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&gst_audiorate_src_template), "src");
+      gst_pad_new_from_static_template (&gst_audiorate_src_template, "src");
   gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->srcpad);
   gst_pad_set_setcaps_function (audiorate->srcpad, gst_audiorate_setcaps);
   gst_pad_set_getcaps_function (audiorate->srcpad, gst_pad_proxy_getcaps);
index 77607b6..de3420e 100644 (file)
@@ -125,15 +125,11 @@ gst_subparse_class_init (GstSubparseClass * klass)
 static void
 gst_subparse_init (GstSubparse * subparse)
 {
-  subparse->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get (&sink_templ),
-      "sink");
+  subparse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
   gst_pad_set_chain_function (subparse->sinkpad, gst_subparse_chain);
   gst_element_add_pad (GST_ELEMENT (subparse), subparse->sinkpad);
 
-  subparse->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get (&src_templ),
-      "src");
+  subparse->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
   gst_pad_set_event_function (subparse->srcpad, gst_subparse_src_event);
   gst_element_add_pad (GST_ELEMENT (subparse), subparse->srcpad);
 
index 51cd1ae..8f1b441 100644 (file)
@@ -361,8 +361,7 @@ gst_videorate_init (GstVideorate * videorate)
 {
   GST_DEBUG ("gst_videorate_init");
   videorate->sinkpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&gst_videorate_sink_template), "sink");
+      gst_pad_new_from_static_template (&gst_videorate_sink_template, "sink");
   gst_element_add_pad (GST_ELEMENT (videorate), videorate->sinkpad);
   gst_pad_set_event_function (videorate->sinkpad, gst_videorate_event);
   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);
 
   videorate->srcpad =
-      gst_pad_new_from_template (gst_static_pad_template_get
-      (&gst_videorate_src_template), "src");
+      gst_pad_new_from_static_template (&gst_videorate_src_template, "src");
   gst_element_add_pad (GST_ELEMENT (videorate), videorate->srcpad);
   gst_pad_set_getcaps_function (videorate->srcpad, gst_videorate_getcaps);
   gst_pad_set_setcaps_function (videorate->srcpad, gst_videorate_setcaps);