From 0556f090e551cbac6b974abb90c4e32c55592f6c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 11 Feb 2004 08:38:26 +0000 Subject: [PATCH] ext/ffmpeg/: fix memleaks Original commit message from CVS: 2004-02-11 Benjamin Otte * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_base_init): * ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init): * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_base_init): * ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init): fix memleaks --- common | 2 +- ext/ffmpeg/gstffmpegdec.c | 18 ++++++++++-------- ext/ffmpeg/gstffmpegdemux.c | 18 ++++++++++-------- ext/ffmpeg/gstffmpegenc.c | 18 ++++++++++-------- ext/ffmpeg/gstffmpegmux.c | 18 ++++++++++-------- 5 files changed, 41 insertions(+), 33 deletions(-) diff --git a/common b/common index 90e64b9..9009733 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 90e64b98d566fd8df793cfc0a9b08b8e5fb356d3 +Subproject commit 90097339543fb0a705447b599d7a36138cba4232 diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index ddb4372..d729de2 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -119,7 +119,7 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstFFMpegDecClassParams *params; - GstElementDetails *details; + GstElementDetails details; GstPadTemplate *sinktempl, *srctempl; params = g_hash_table_lookup (global_plugins, @@ -130,16 +130,19 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass) g_assert (params); /* construct the element details struct */ - details = g_new0 (GstElementDetails, 1); - details->longname = g_strdup_printf("FFMPEG %s decoder", + details.longname = g_strdup_printf("FFMPEG %s decoder", params->in_plugin->name); - details->klass = g_strdup_printf("Codec/Decoder/%s", + details.klass = g_strdup_printf("Codec/Decoder/%s", (params->in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio"); - details->description = g_strdup_printf("FFMPEG %s decoder", + details.description = g_strdup_printf("FFMPEG %s decoder", params->in_plugin->name); - details->author = g_strdup("Wim Taymans \n" - "Ronald Bultje "); + details.author = "Wim Taymans , " + "Ronald Bultje "; + gst_element_class_set_details (element_class, &details); + g_free (details.longname); + g_free (details.klass); + g_free (details.description); /* pad templates */ sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK, @@ -149,7 +152,6 @@ gst_ffmpegdec_base_init (GstFFMpegDecClass *klass) gst_element_class_add_pad_template (element_class, srctempl); gst_element_class_add_pad_template (element_class, sinktempl); - gst_element_class_set_details (element_class, details); klass->in_plugin = params->in_plugin; klass->srctempl = srctempl; diff --git a/ext/ffmpeg/gstffmpegdemux.c b/ext/ffmpeg/gstffmpegdemux.c index fc52b04..8a9e75d 100644 --- a/ext/ffmpeg/gstffmpegdemux.c +++ b/ext/ffmpeg/gstffmpegdemux.c @@ -109,7 +109,7 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstFFMpegDemuxClassParams *params; - GstElementDetails *details; + GstElementDetails details; GstPadTemplate *sinktempl, *audiosrctempl, *videosrctempl; params = g_hash_table_lookup (global_plugins, @@ -120,14 +120,17 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass *klass) g_assert (params); /* construct the element details struct */ - details = g_new0 (GstElementDetails, 1); - details->longname = g_strdup_printf("FFMPEG %s demuxer", + details.longname = g_strdup_printf("FFMPEG %s demuxer", params->in_plugin->name); - details->klass = g_strdup("Codec/Demuxer"); - details->description = g_strdup_printf("FFMPEG %s decoder", + details.klass = g_strdup("Codec/Demuxer"); + details.description = g_strdup_printf("FFMPEG %s decoder", params->in_plugin->name); - details->author = g_strdup("Wim Taymans \n" - "Ronald Bultje "); + details.author = "Wim Taymans , " + "Ronald Bultje "; + gst_element_class_set_details (element_class, &details); + g_free (details.longname); + g_free (details.klass); + g_free (details.description); /* pad templates */ sinktempl = gst_pad_template_new ("sink", @@ -146,7 +149,6 @@ gst_ffmpegdemux_base_init (GstFFMpegDemuxClass *klass) gst_element_class_add_pad_template (element_class, videosrctempl); gst_element_class_add_pad_template (element_class, audiosrctempl); gst_element_class_add_pad_template (element_class, sinktempl); - gst_element_class_set_details (element_class, details); klass->in_plugin = params->in_plugin; klass->videosrctempl = videosrctempl; diff --git a/ext/ffmpeg/gstffmpegenc.c b/ext/ffmpeg/gstffmpegenc.c index 87609be..5cbf0d9 100644 --- a/ext/ffmpeg/gstffmpegenc.c +++ b/ext/ffmpeg/gstffmpegenc.c @@ -151,7 +151,7 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstFFMpegEncClassParams *params; - GstElementDetails *details; + GstElementDetails details; GstPadTemplate *srctempl, *sinktempl; params = g_hash_table_lookup (enc_global_plugins, @@ -164,16 +164,19 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass *klass) g_assert (params); /* construct the element details struct */ - details = g_new0 (GstElementDetails, 1); - details->longname = g_strdup_printf("FFMPEG %s encoder", + details.longname = g_strdup_printf("FFMPEG %s encoder", params->in_plugin->name); - details->klass = g_strdup_printf("Codec/Encoder/%s", + details.klass = g_strdup_printf("Codec/Encoder/%s", (params->in_plugin->type == CODEC_TYPE_VIDEO) ? "Video" : "Audio"); - details->description = g_strdup_printf("FFMPEG %s encoder", + details.description = g_strdup_printf("FFMPEG %s encoder", params->in_plugin->name); - details->author = g_strdup("Wim Taymans \n" - "Ronald Bultje "); + details.author = "Wim Taymans , " + "Ronald Bultje "; + gst_element_class_set_details (element_class, &details); + g_free (details.longname); + g_free (details.klass); + g_free (details.description); /* pad templates */ sinktempl = gst_pad_template_new ("sink", GST_PAD_SINK, @@ -183,7 +186,6 @@ gst_ffmpegenc_base_init (GstFFMpegEncClass *klass) gst_element_class_add_pad_template (element_class, srctempl); gst_element_class_add_pad_template (element_class, sinktempl); - gst_element_class_set_details (element_class, details); klass->in_plugin = params->in_plugin; klass->srctempl = srctempl; diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index b9bce61..920c7db 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c @@ -114,8 +114,8 @@ gst_ffmpegmux_base_init (GstFFMpegMuxClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + GstElementDetails details; GstFFMpegMuxClassParams *params; - GstElementDetails *details; GstPadTemplate *videosinktempl, *audiosinktempl, *srctempl; params = g_hash_table_lookup (global_plugins, @@ -126,14 +126,17 @@ gst_ffmpegmux_base_init (GstFFMpegMuxClass *klass) g_assert (params); /* construct the element details struct */ - details = g_new0 (GstElementDetails, 1); - details->longname = g_strdup_printf ("FFMPEG %s Muxer", + details.longname = g_strdup_printf ("FFMPEG %s Muxer", params->in_plugin->name); - details->klass = g_strdup ("Codec/Muxer"); - details->description = g_strdup_printf ("FFMPEG %s Muxer", + details.klass = g_strdup ("Codec/Muxer"); + details.description = g_strdup_printf ("FFMPEG %s Muxer", params->in_plugin->name); - details->author = g_strdup ("Wim Taymans \n" - "Ronald Bultje "); + details.author = "Wim Taymans , " + "Ronald Bultje "; + gst_element_class_set_details (element_class, &details); + g_free (details.longname); + g_free (details.klass); + g_free (details.description); /* pad templates */ srctempl = gst_pad_template_new ("sink", GST_PAD_SRC, @@ -151,7 +154,6 @@ gst_ffmpegmux_base_init (GstFFMpegMuxClass *klass) gst_element_class_add_pad_template (element_class, srctempl); gst_element_class_add_pad_template (element_class, videosinktempl); gst_element_class_add_pad_template (element_class, audiosinktempl); - gst_element_class_set_details (element_class, details); klass->in_plugin = params->in_plugin; klass->srctempl = srctempl; -- 2.7.4