From: Matthew Waters Date: Mon, 17 Sep 2012 00:30:01 +0000 (+1000) Subject: [576/906] remove uneeded GstGLMeta (use GstVideoMeta) X-Git-Tag: 1.19.3~511^2~1989^2~1927 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=574612f129638e5313a3d36521bcd3b3a51b1478;p=platform%2Fupstream%2Fgstreamer.git [576/906] remove uneeded GstGLMeta (use GstVideoMeta) --- diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am index e1e1ef2..4ab64d1 100644 --- a/gst-libs/gst/gl/Makefile.am +++ b/gst-libs/gst/gl/Makefile.am @@ -11,12 +11,13 @@ EXTRA_DIST = \ libgstgl_@GST_API_VERSION@_la_SOURCES = \ gstgldisplay.c \ gstglmemory.c \ - gstglmeta.c \ gstglbufferpool.c \ gstglfilter.c \ gstglmixer.c \ gstglshader.c \ - gstglshadervariables.c + gstglshadervariables.c \ + gstgldownload.c \ + gstglupload.c if GL_BACKEND_WIN32 libgstgl_@GST_API_VERSION@_la_SOURCES += gstglwindow_win32.c @@ -36,14 +37,15 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \ gstglwindow.h \ gstgldisplay.h \ gstglmemory.h \ - gstglmeta.h \ gstglbufferpool.h \ gstgles2.h \ gstglfilter.h \ gstglmixer.h \ gstglmixerpad.h \ gstglshadervariables.h \ - gstglshader.h + gstglshader.h \ + gstgldownload.h \ + gstglupload.h libgstgl_@GST_API_VERSION@_la_LIBADD = \ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) \ diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c index 7eed3b6..9ace404 100644 --- a/gst-libs/gst/gl/gstglbufferpool.c +++ b/gst-libs/gst/gl/gstglbufferpool.c @@ -34,8 +34,7 @@ struct _GstGLBufferPoolPrivate GstVideoInfo info; guint padded_width; guint padded_height; - gboolean add_metavideo; - gboolean add_glmeta; + gboolean add_videometa; }; static void gst_gl_buffer_pool_finalize (GObject * object); @@ -98,15 +97,11 @@ gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) priv->caps = gst_caps_ref (caps); priv->info = info; - /* enable metadata based on config of the pool */ - priv->add_metavideo = + priv->add_videometa = gst_buffer_pool_config_has_option (config, + GST_BUFFER_POOL_OPTION_GL_META) || gst_buffer_pool_config_has_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); - /* parse extra alignment info */ - priv->add_glmeta = gst_buffer_pool_config_has_option (config, - GST_BUFFER_POOL_OPTION_GL_META); - return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config); /* ERRORS */ @@ -159,21 +154,14 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, gst_gl_memory_alloc (glpool->display, GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info)))) goto mem_create_failed; - gst_buffer_append_memory (buf, gl_mem); - if (priv->add_metavideo) { - GST_DEBUG_OBJECT (pool, "adding GstVideoMeta"); - /* these are just the defaults for now */ - gst_buffer_add_video_meta (buf, 0, GST_VIDEO_INFO_FORMAT (info), - GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info)); - } - - if (priv->add_glmeta) { - + if (priv->add_videometa) { GST_DEBUG_OBJECT (pool, "adding GstGLMeta"); /* these are just the defaults for now */ - gst_buffer_add_gl_meta (buf, glpool->display); + gst_buffer_add_video_meta (buf, glpool->display, 0, + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), + GST_VIDEO_INFO_HEIGHT (info)); } *buffer = buf; diff --git a/gst-libs/gst/gl/gstgldownload.h b/gst-libs/gst/gl/gstgldownload.h index 6fb9b45..405d33b 100644 --- a/gst-libs/gst/gl/gstgldownload.h +++ b/gst-libs/gst/gl/gstgldownload.h @@ -77,6 +77,15 @@ struct _GstGLDownloadClass GObjectClass object_class; }; +#ifndef OPENGL_ES2 +# define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \ + "xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }" +#else /* OPENGL_ES2 */ +# define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }" +#endif /* !OPENGL_ES2 */ + +#define GST_GL_DOWNLOAD_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_DOWNLOAD_FORMATS) + GstGLDownload * gst_gl_download_new (GstGLDisplay * display); gboolean gst_gl_download_init_format (GstGLDownload * download, GstVideoFormat v_format, diff --git a/gst-libs/gst/gl/gstglmeta.c b/gst-libs/gst/gl/gstglmeta.c deleted file mode 100644 index b60ce63..0000000 --- a/gst-libs/gst/gl/gstglmeta.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * GStreamer - * Copyright (C) 2012 Matthew Waters - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include "gstglmeta.h" - -/* GstVideoMeta map/unmap */ -gboolean -gst_gl_meta_map (GstVideoMeta * meta, guint plane, GstMapInfo * info, - gpointer * data, gint * stride, GstMapFlags flags) -{ - return FALSE; -} - -gboolean -gst_gl_meta_unmap (GstVideoMeta * meta, guint plane, GstMapInfo * info) -{ - return FALSE; -} - -static void -gst_gl_meta_init (GstGLMeta * gl_meta, gpointer params, GstBuffer * buffer) -{ - gl_meta->buffer = buffer; -} - -void -gst_gl_meta_free (GstGLMeta * gl_meta, GstBuffer * buffer) -{ - if (gl_meta->display) { - g_object_unref (gl_meta->display); - gl_meta->display = NULL; - } -} - -static gboolean -gst_gl_meta_transform (GstBuffer * dest, GstMeta * meta, - GstBuffer * buffer, GQuark type, gpointer data) -{ - GstGLMeta *dmeta, *smeta; - - smeta = (GstGLMeta *) meta; - - if (GST_META_TRANSFORM_IS_COPY (type)) { - GstMetaTransformCopy *copy = data; - - if (!copy->region) { - /* only copy if the complete data is copied as well */ - dmeta = - (GstGLMeta *) gst_buffer_add_meta (dest, GST_GL_META_INFO, - smeta->display); - dmeta->buffer = dest; - - dmeta->memory = - (GstGLMemory *) gst_memory_copy (GST_MEMORY_CAST (smeta->memory), 0, - -1); - } - } - return TRUE; -} - -GType -gst_gl_meta_api_get_type (void) -{ - static volatile GType type; - static const gchar *tags[] = { "memory", NULL }; /* don't know what to set here */ - - if (g_once_init_enter (&type)) { - GType _type = gst_meta_api_type_register ("GstGLMetaAPI", tags); - g_once_init_leave (&type, _type); - } - return type; -} - -const GstMetaInfo * -gst_gl_meta_get_info (void) -{ - static const GstMetaInfo *gl_meta_info = NULL; - - if (gl_meta_info == NULL) { - gl_meta_info = - gst_meta_register (GST_GL_META_API_TYPE, "GstGLMeta", - sizeof (GstGLMeta), (GstMetaInitFunction) gst_gl_meta_init, - (GstMetaFreeFunction) gst_gl_meta_free, - (GstMetaTransformFunction) gst_gl_meta_transform); - } - return gl_meta_info; -} - -/** - * gst_buffer_add_gl_meta: - * @buffer: a #GstBuffer - * @display: the #GstGLDisplay to use - * - * Creates and adds a #GstGLMeta to a @buffer. - * - * Returns: (transfer full): a newly created #GstGLMeta - */ -GstGLMeta * -gst_buffer_add_gl_meta (GstBuffer * buffer, GstGLDisplay * display) -{ - GstGLMeta *gl_meta; - - gl_meta = (GstGLMeta *) gst_buffer_add_meta (buffer, GST_GL_META_INFO, NULL); - - gl_meta->display = g_object_ref (display); - - g_assert (gst_buffer_n_memory (buffer) == 1); - - gl_meta->memory = (GstGLMemory *) gst_buffer_get_memory (buffer, 0); - - return gl_meta; -} diff --git a/gst-libs/gst/gl/gstglmeta.h b/gst-libs/gst/gl/gstglmeta.h deleted file mode 100644 index f099f2a..0000000 --- a/gst-libs/gst/gl/gstglmeta.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * GStreame - * Copyright (C) 2007 Matthew Waters - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef _GST_GL_META_H_ -#define _GST_GL_META_H_ - -#include -#include -#include - -#include "gstgldisplay.h" -#include "gstglmemory.h" - -G_BEGIN_DECLS - -typedef struct _GstGLMeta GstGLMeta; - -GType gst_gl_meta_api_get_type (void); -#define GST_GL_META_API_TYPE (gst_gl_meta_api_get_type()) -#define GST_GL_META_INFO (gst_gl_meta_get_info()) -const GstMetaInfo * gst_gl_meta_get_info (void); - -/** - * GstGLMeta: - * @meta: parent #GstMeta - * @buffer: #GstBuffer this meta belongs to - * @video_meta: the #GstVideoMeta associated with this meta - * @display: the #GstGLDisplay - * @texture_id: the GL texture associated with this meta - * - * Extra buffer metadata describing OpenGL objects - */ -struct _GstGLMeta { - GstMeta meta; - GstBuffer *buffer; - - GstGLDisplay *display; - - GstGLMemory *memory; -}; - -#define GST_GL_VIDEO_FORMATS "RGBA" -#define GST_GL_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_VIDEO_FORMATS) - -#ifndef OPENGL_ES2 - -# define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }" -# define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }" -# define GST_GL_UPLOAD_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_UPLOAD_FORMATS) -# define GST_GL_DOWNLOAD_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_DOWNLOAD_FORMATS) - -#else /* OPENGL_ES2 */ - -# define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }" -# define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }" -# define GST_GL_UPLOAD_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_UPLOAD_FORMATS) -# define GST_GL_DOWNLOAD_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_DOWNLOAD_FORMATS) - -#endif /* OPENGL_ES2 */ - -#define gst_buffer_get_gl_meta(b) ((GstGLMeta*)gst_buffer_get_meta((b),GST_GL_META_API_TYPE)) -GstGLMeta * gst_buffer_add_gl_meta (GstBuffer * buffer, GstGLDisplay * display); - -gboolean gst_gl_meta_map (GstVideoMeta *meta, guint plane, GstMapInfo *info, - gpointer *data, gint * stride, GstMapFlags flags); -gboolean gst_gl_meta_unmap (GstVideoMeta *meta, guint plane, GstMapInfo *info); - -G_END_DECLS - -#endif /* _GST_GL_META_H_ */ diff --git a/gst-libs/gst/gl/gstglupload.h b/gst-libs/gst/gl/gstglupload.h index ebe63b0..ad18eaf 100644 --- a/gst-libs/gst/gl/gstglupload.h +++ b/gst-libs/gst/gl/gstglupload.h @@ -78,6 +78,15 @@ struct _GstGLUploadClass GObjectClass object_class; }; +#ifndef OPENGL_ES2 +# define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \ + "xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }" +#else /* OPENGL_ES2 */ +# define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }" +#endif + +#define GST_GL_UPLOAD_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_GL_UPLOAD_FORMATS) + GstGLUpload * gst_gl_upload_new (GstGLDisplay * display); gboolean gst_gl_upload_init_format (GstGLUpload * upload, GstVideoFormat v_format,