[0.11] gst-plugins-base: audio, video: init audio/ video format info to UNKNOWN format

René Stadler cymacs at kemper.freedesktop.org
Fri Oct 28 02:25:12 PDT 2011


Module: gst-plugins-base
Branch: 0.11
Commit: 372cf41a6db1e7b77ccef065d980a13273cbae88
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=372cf41a6db1e7b77ccef065d980a13273cbae88

Author: René Stadler <rene.stadler at collabora.co.uk>
Date:   Fri Oct 28 11:11:55 2011 +0200

audio, video: init audio/video format info to UNKNOWN format

This is to prevent e.g. GST_AUDIO_INFO_FORMAT() from crashing on a NULL pointer
dereference when used with an unset info.

---

 gst-libs/gst/audio/audio.c |    2 ++
 gst-libs/gst/video/video.c |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c
index 95d4266..af59121 100644
--- a/gst-libs/gst/audio/audio.c
+++ b/gst-libs/gst/audio/audio.c
@@ -275,6 +275,8 @@ gst_audio_info_init (GstAudioInfo * info)
   g_return_if_fail (info != NULL);
 
   memset (info, 0, sizeof (GstAudioInfo));
+
+  info->finfo = &formats[GST_AUDIO_FORMAT_UNKNOWN];
 }
 
 /**
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c
index 13af592..2efba19 100644
--- a/gst-libs/gst/video/video.c
+++ b/gst-libs/gst/video/video.c
@@ -608,6 +608,9 @@ gst_video_info_init (GstVideoInfo * info)
   g_return_if_fail (info != NULL);
 
   memset (info, 0, sizeof (GstVideoInfo));
+
+  info->finfo = &formats[GST_VIDEO_FORMAT_UNKNOWN].info;
+
   info->views = 1;
   /* arrange for sensible defaults, e.g. if turned into caps */
   info->fps_n = 0;



More information about the gstreamer-commits mailing list