audio/video-info: Initialize the complete struct to 0 in the beginning
authorSebastian Dröge <sebastian@centricular.com>
Mon, 30 Dec 2013 09:14:09 +0000 (10:14 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 30 Dec 2013 09:15:20 +0000 (10:15 +0100)
Instead of only initializing some parts in some code paths. Also
makes it easier to use the reserved bits of the structs later.

https://bugzilla.gnome.org/show_bug.cgi?id=720810

gst-libs/gst/audio/audio-info.c
gst-libs/gst/video/video-info.c

index 53cdd5b..51bbac9 100644 (file)
@@ -96,8 +96,6 @@ gst_audio_info_init (GstAudioInfo * info)
   memset (info, 0, sizeof (GstAudioInfo));
 
   info->finfo = gst_audio_format_get_info (GST_AUDIO_FORMAT_UNKNOWN);
-
-  memset (&info->position, 0xff, sizeof (info->position));
 }
 
 /**
@@ -121,6 +119,8 @@ gst_audio_info_set_format (GstAudioInfo * info, GstAudioFormat format,
   g_return_if_fail (format != GST_AUDIO_FORMAT_UNKNOWN);
   g_return_if_fail (channels <= 64 || position == NULL);
 
+  memset (info, 0, sizeof (GstAudioInfo));
+
   finfo = gst_audio_format_get_info (format);
 
   info->flags = 0;
@@ -131,7 +131,6 @@ gst_audio_info_set_format (GstAudioInfo * info, GstAudioFormat format,
   info->bpf = (finfo->width * channels) / 8;
 
   memset (&info->position, 0xff, sizeof (info->position));
-  memset (&info->_gst_reserved, 0xff, sizeof (info->_gst_reserved));
 
   if (!position && channels == 1) {
     info->position[0] = GST_AUDIO_CHANNEL_POSITION_MONO;
index 8140228..5a961d1 100644 (file)
@@ -89,6 +89,8 @@ gst_video_info_set_format (GstVideoInfo * info, GstVideoFormat format,
   g_return_if_fail (info != NULL);
   g_return_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN);
 
+  memset (info, 0, sizeof (GstVideoInfo));
+
   finfo = gst_video_format_get_info (format);
 
   info->flags = 0;
@@ -110,7 +112,6 @@ gst_video_info_set_format (GstVideoInfo * info, GstVideoFormat format,
   }
 
   fill_planes (info);
-  memset (&info->_gst_reserved, 0xff, sizeof (info->_gst_reserved));
 }
 
 static const gchar *interlace_mode[] = {