ffmpeg: fix pad template ref leaks
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 28 Nov 2011 13:23:42 +0000 (13:23 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 28 Nov 2011 13:23:42 +0000 (13:23 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=662664

ext/ffmpeg/gstffmpegaudioresample.c
ext/ffmpeg/gstffmpegdeinterlace.c
ext/ffmpeg/gstffmpegmux.c
ext/ffmpeg/gstffmpegscale.c
ext/libpostproc/gstpostproc.c
ext/libswscale/gstffmpegscale.c

index 321a008..b63068d 100644 (file)
@@ -103,10 +103,8 @@ gst_ffmpegaudioresample_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class,
       "FFMPEG Audio resampling element", "Filter/Converter/Audio",
       "Converts audio from one samplerate to another",
index de95314..40fea5e 100644 (file)
@@ -145,10 +145,8 @@ gst_ffmpegdeinterlace_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class,
       "FFMPEG Deinterlace element", "Filter/Effect/Video/Deinterlace",
       "Deinterlace video", "Luca Ognibene <luogni@tin.it>");
index 538aeed..a041761 100644 (file)
@@ -272,17 +272,20 @@ gst_ffmpegmux_base_init (gpointer g_class)
   /* pad templates */
   srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
   gst_element_class_add_pad_template (element_class, srctempl);
+  gst_object_unref (srctempl);
 
   if (audiosinkcaps) {
     audiosinktempl = gst_pad_template_new ("audio_%d",
         GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
     gst_element_class_add_pad_template (element_class, audiosinktempl);
+    gst_object_unref (audiosinktempl);
   }
 
   if (videosinkcaps) {
     videosinktempl = gst_pad_template_new ("video_%d",
         GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
     gst_element_class_add_pad_template (element_class, videosinktempl);
+    gst_object_unref (videosinktempl);
   }
 
 beach:
index a8678ae..ac5c7e1 100644 (file)
@@ -103,10 +103,8 @@ gst_ffmpegscale_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
       "Filter/Converter/Video/Scaler",
       "Converts video from one resolution to another",
index f9ddcdd..963b77d 100644 (file)
@@ -381,10 +381,10 @@ gst_post_proc_base_init (GstPostProcClass * klass)
   g_free (longname);
   g_free (description);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_post_proc_src_template));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&gst_post_proc_sink_template));
+  gst_element_class_add_static_pad_template (element_class,
+      &gst_post_proc_src_template);
+  gst_element_class_add_static_pad_template (element_class,
+      &gst_post_proc_sink_template);
 
   klass->filterid = ppidx;
 }
index 202fda8..050a962 100644 (file)
@@ -190,10 +190,8 @@ gst_ffmpegscale_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&src_factory));
-  gst_element_class_add_pad_template (element_class,
-      gst_static_pad_template_get (&sink_factory));
+  gst_element_class_add_static_pad_template (element_class, &src_factory);
+  gst_element_class_add_static_pad_template (element_class, &sink_factory);
   gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
       "Filter/Converter/Video",
       "Converts video from one resolution to another",