From 8ef490a3dec18c8dbc770a0d25e4f80563bc613d Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 24 Jul 2012 14:31:25 +0200 Subject: videobuffer: drop deprecated functions. Move video buffer creation routines to plugin elements. That exclusively uses *_typed_new*() variants. --- gst/vaapi/Makefile.am | 2 + gst/vaapi/gstvaapidecode.c | 7 +-- gst/vaapi/gstvaapidownload.c | 11 +--- gst/vaapi/gstvaapipluginbuffer.c | 124 +++++++++++++++++++++++++++++++++++++++ gst/vaapi/gstvaapipluginbuffer.h | 49 ++++++++++++++++ gst/vaapi/gstvaapipostproc.c | 3 +- gst/vaapi/gstvaapiupload.c | 11 +--- 7 files changed, 182 insertions(+), 25 deletions(-) create mode 100644 gst/vaapi/gstvaapipluginbuffer.c create mode 100644 gst/vaapi/gstvaapipluginbuffer.h (limited to 'gst') diff --git a/gst/vaapi/Makefile.am b/gst/vaapi/Makefile.am index 6a4175a..e3c3ddb 100644 --- a/gst/vaapi/Makefile.am +++ b/gst/vaapi/Makefile.am @@ -23,6 +23,7 @@ libgstvaapi_la_SOURCES = \ gstvaapi.c \ gstvaapidecode.c \ gstvaapidownload.c \ + gstvaapipluginbuffer.c \ gstvaapipluginutil.c \ gstvaapipostproc.c \ gstvaapisink.c \ @@ -32,6 +33,7 @@ libgstvaapi_la_SOURCES = \ noinst_HEADERS = \ gstvaapidecode.h \ gstvaapidownload.h \ + gstvaapipluginbuffer.h \ gstvaapipluginutil.h \ gstvaapipostproc.h \ gstvaapisink.h \ diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index b2f3113..6c303f9 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -35,14 +35,9 @@ #include #include -#if USE_GLX -#include -#define gst_vaapi_video_buffer_new(display) \ - gst_vaapi_video_buffer_glx_new(GST_VAAPI_DISPLAY_GLX(display)) -#endif - #include "gstvaapidecode.h" #include "gstvaapipluginutil.h" +#include "gstvaapipluginbuffer.h" #include #include diff --git a/gst/vaapi/gstvaapidownload.c b/gst/vaapi/gstvaapidownload.c index 4908e52..f3e9caa 100644 --- a/gst/vaapi/gstvaapidownload.c +++ b/gst/vaapi/gstvaapidownload.c @@ -35,16 +35,9 @@ #include #include -#if USE_GLX -#include -#define gst_vaapi_video_buffer_new_from_pool(pool) \ - gst_vaapi_video_buffer_glx_new_from_pool(pool) -#define gst_vaapi_video_buffer_new_from_buffer(buffer) \ - gst_vaapi_video_buffer_glx_new_from_buffer(buffer) -#endif - -#include "gstvaapipluginutil.h" #include "gstvaapidownload.h" +#include "gstvaapipluginutil.h" +#include "gstvaapipluginbuffer.h" #define GST_PLUGIN_NAME "vaapidownload" #define GST_PLUGIN_DESC "A VA to video flow filter" diff --git a/gst/vaapi/gstvaapipluginbuffer.c b/gst/vaapi/gstvaapipluginbuffer.c new file mode 100644 index 0000000..225318e --- /dev/null +++ b/gst/vaapi/gstvaapipluginbuffer.c @@ -0,0 +1,124 @@ +/* + * gstvaapipluginbuffer.c - Private GStreamer/VA video buffers + * + * Copyright (C) 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#if USE_GLX +# include +#endif +#include "gstvaapipluginbuffer.h" + +static inline GType +get_type(GstVaapiDisplay *display) +{ +#if USE_GLX + if (GST_VAAPI_IS_DISPLAY_GLX(display)) + return GST_VAAPI_TYPE_VIDEO_BUFFER_GLX; +#endif + return GST_VAAPI_TYPE_VIDEO_BUFFER; +} + +GstBuffer * +gst_vaapi_video_buffer_new(GstVaapiDisplay *display) +{ + g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), NULL); + + return gst_vaapi_video_buffer_typed_new(get_type(display), display); +} + +GstBuffer * +gst_vaapi_video_buffer_new_from_pool(GstVaapiVideoPool *pool) +{ + GstVaapiDisplay *display; + + g_return_val_if_fail(GST_VAAPI_IS_VIDEO_POOL(pool), NULL); + + display = gst_vaapi_video_pool_get_display(pool); + if (!display) + return NULL; + return gst_vaapi_video_buffer_typed_new_from_pool(get_type(display), pool); +} + +GstBuffer * +gst_vaapi_video_buffer_new_from_buffer(GstBuffer *buffer) +{ + GstVaapiVideoBuffer *vbuffer; + GstVaapiDisplay *display; + + g_return_val_if_fail(GST_VAAPI_IS_VIDEO_BUFFER(buffer), NULL); + + vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer); + display = gst_vaapi_video_buffer_get_display(vbuffer); + if (!display) + return NULL; + + return gst_vaapi_video_buffer_typed_new_from_buffer( + get_type(display), buffer); +} + +GstBuffer * +gst_vaapi_video_buffer_new_with_image(GstVaapiImage *image) +{ + GstVaapiDisplay *display; + + g_return_val_if_fail(GST_VAAPI_IS_IMAGE(image), NULL); + + display = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(image)); + if (!display) + return NULL; + + return gst_vaapi_video_buffer_typed_new_with_image( + get_type(display), image); +} + +GstBuffer * +gst_vaapi_video_buffer_new_with_surface(GstVaapiSurface *surface) +{ + GstVaapiDisplay *display; + + g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), NULL); + + display = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface)); + if (!display) + return NULL; + + return gst_vaapi_video_buffer_typed_new_with_surface( + get_type(display), surface); +} + +GstBuffer * +gst_vaapi_video_buffer_new_with_surface_proxy(GstVaapiSurfaceProxy *proxy) +{ + GstVaapiDisplay *display; + + g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), NULL); + + display = gst_vaapi_object_get_display(GST_VAAPI_OBJECT(proxy)); + if (!display) + return NULL; + + return gst_vaapi_video_buffer_typed_new_with_surface_proxy( + get_type(display), proxy); +} diff --git a/gst/vaapi/gstvaapipluginbuffer.h b/gst/vaapi/gstvaapipluginbuffer.h new file mode 100644 index 0000000..d6798d5 --- /dev/null +++ b/gst/vaapi/gstvaapipluginbuffer.h @@ -0,0 +1,49 @@ +/* + * gstvaapipluginbuffer.h - Private GStreamer/VA video buffers + * + * Copyright (C) 2012 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef GST_VAAPI_PLUGIN_BUFFER_H +#define GST_VAAPI_PLUGIN_BUFFER_H + +G_GNUC_INTERNAL +GstBuffer * +gst_vaapi_video_buffer_new(GstVaapiDisplay *display); + +G_GNUC_INTERNAL +GstBuffer * +gst_vaapi_video_buffer_new_from_pool(GstVaapiVideoPool *pool); + +G_GNUC_INTERNAL +GstBuffer * +gst_vaapi_video_buffer_new_from_buffer(GstBuffer *buffer); + +G_GNUC_INTERNAL +GstBuffer * +gst_vaapi_video_buffer_new_with_image(GstVaapiImage *image); + +G_GNUC_INTERNAL +GstBuffer * +gst_vaapi_video_buffer_new_with_surface(GstVaapiSurface *surface); + +G_GNUC_INTERNAL +GstBuffer * +gst_vaapi_video_buffer_new_with_surface_proxy(GstVaapiSurfaceProxy *proxy); + +#endif /* GST_VAAPI_PLUGIN_BUFFER_H */ diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index bfd18c0..59bd1b3 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -34,8 +34,9 @@ #include #include -#include "gstvaapipluginutil.h" #include "gstvaapipostproc.h" +#include "gstvaapipluginutil.h" +#include "gstvaapipluginbuffer.h" #define GST_PLUGIN_NAME "vaapipostproc" #define GST_PLUGIN_DESC "A video postprocessing filter" diff --git a/gst/vaapi/gstvaapiupload.c b/gst/vaapi/gstvaapiupload.c index fac9a7d..d66b21d 100644 --- a/gst/vaapi/gstvaapiupload.c +++ b/gst/vaapi/gstvaapiupload.c @@ -36,16 +36,9 @@ #include #include -#if USE_GLX -#include -#define gst_vaapi_video_buffer_new_from_pool(pool) \ - gst_vaapi_video_buffer_glx_new_from_pool(pool) -#define gst_vaapi_video_buffer_new_from_buffer(buffer) \ - gst_vaapi_video_buffer_glx_new_from_buffer(buffer) -#endif - -#include "gstvaapipluginutil.h" #include "gstvaapiupload.h" +#include "gstvaapipluginutil.h" +#include "gstvaapipluginbuffer.h" #define GST_PLUGIN_NAME "vaapiupload" #define GST_PLUGIN_DESC "A video to VA flow filter" -- cgit v1.2.3