meta: Initialize all GstMeta fields

During allocation they are not initialized to all zeroes.

https://bugzilla.gnome.org/show_bug.cgi?id=764902
This commit is contained in:
Sebastian Dröge 2016-04-13 10:17:24 +03:00
parent 768b0c2696
commit ccc068576a
5 changed files with 52 additions and 3 deletions

View file

@ -37,6 +37,7 @@ gst_mpeg_video_meta_init (GstMpegVideoMeta * mpeg_video_meta,
mpeg_video_meta->pichdr = NULL;
mpeg_video_meta->picext = NULL;
mpeg_video_meta->quantext = NULL;
mpeg_video_meta->num_slices = mpeg_video_meta->slice_offset = 0;
return TRUE;
}

View file

@ -19,6 +19,19 @@
#include "coremediabuffer.h"
static gboolean
gst_core_media_meta_init (GstCoreMediaMeta * meta, gpointer params,
GstBuffer * buf)
{
meta->ctx = NULL;
meta->sample_buf = NULL;
meta->image_buf = NULL;
meta->pixel_buf = NULL;
meta->block_buf = NULL;
return TRUE;
}
static void
gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf)
{
@ -52,7 +65,7 @@ gst_core_media_meta_get_info (void)
if (g_once_init_enter (&core_media_meta_info)) {
const GstMetaInfo *meta = gst_meta_register (GST_CORE_MEDIA_META_API_TYPE,
"GstCoreMediaMeta", sizeof (GstCoreMediaMeta),
(GstMetaInitFunction) NULL,
(GstMetaInitFunction) gst_core_media_meta_init,
(GstMetaFreeFunction) gst_core_media_meta_free,
(GstMetaTransformFunction) NULL);
g_once_init_leave (&core_media_meta_info, meta);

View file

@ -19,6 +19,17 @@
#include "corevideobuffer.h"
static gboolean
gst_core_video_meta_init (GstCoreVideoMeta * meta, gpointer params,
GstBuffer * buf)
{
meta->ctx = NULL;
meta->cvbuf = NULL;
meta->pixbuf = NULL;
return TRUE;
}
static void
gst_core_video_meta_free (GstCoreVideoMeta * meta, GstBuffer * buf)
{
@ -54,7 +65,7 @@ gst_core_video_meta_get_info (void)
if (g_once_init_enter (&core_video_meta_info)) {
const GstMetaInfo *meta = gst_meta_register (GST_CORE_VIDEO_META_API_TYPE,
"GstCoreVideoMeta", sizeof (GstCoreVideoMeta),
(GstMetaInitFunction) NULL,
(GstMetaInitFunction) gst_core_video_meta_init,
(GstMetaFreeFunction) gst_core_video_meta_free,
(GstMetaTransformFunction) NULL);
g_once_init_leave (&core_video_meta_info, meta);

View file

@ -48,6 +48,19 @@ gst_core_media_meta_add (GstBuffer * buffer, CMSampleBufferRef sample_buf,
meta->pixel_buf = NULL;
}
static gboolean
gst_core_media_meta_init (GstCoreMediaMeta * meta, gpointer params,
GstBuffer * buf)
{
meta->ctx = NULL;
meta->sample_buf = NULL;
meta->image_buf = NULL;
meta->pixel_buf = NULL;
meta->block_buf = NULL;
return TRUE;
}
static void
gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf)
{
@ -99,7 +112,7 @@ gst_core_media_meta_get_info (void)
if (g_once_init_enter (&core_media_meta_info)) {
const GstMetaInfo *meta = gst_meta_register (GST_CORE_MEDIA_META_API_TYPE,
"GstCoreMediaMeta", sizeof (GstCoreMediaMeta),
(GstMetaInitFunction) NULL,
(GstMetaInitFunction) gst_core_media_meta_init,
(GstMetaFreeFunction) gst_core_media_meta_free,
(GstMetaTransformFunction) gst_core_media_meta_transform);
g_once_init_leave (&core_media_meta_info, meta);

View file

@ -33,6 +33,17 @@ gst_core_video_meta_add (GstBuffer * buffer, CVBufferRef cvbuf)
meta->pixbuf = (CVPixelBufferRef) cvbuf;
}
static gboolean
gst_core_video_meta_init (GstCoreVideoMeta * meta, gpointer params,
GstBuffer * buf)
{
meta->ctx = NULL;
meta->cvbuf = NULL;
meta->pixbuf = NULL;
return TRUE;
}
static void
gst_core_video_meta_free (GstCoreVideoMeta * meta, GstBuffer * buf)
{