From 8ef490a3dec18c8dbc770a0d25e4f80563bc613d Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 24 Jul 2012 14:31:25 +0200 Subject: [PATCH] videobuffer: drop deprecated functions. Move video buffer creation routines to plugin elements. That exclusively uses *_typed_new*() variants. --- docs/reference/libs/libs-sections.txt | 12 +-- gst-libs/gst/vaapi/gstvaapivideobuffer.c | 69 +++++---------- gst-libs/gst/vaapi/gstvaapivideobuffer.h | 29 ------- gst-libs/gst/vaapi/gstvaapivideobuffer_glx.c | 54 ------------ gst-libs/gst/vaapi/gstvaapivideobuffer_glx.h | 14 --- 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 +-- 12 files changed, 209 insertions(+), 176 deletions(-) create mode 100644 gst/vaapi/gstvaapipluginbuffer.c create mode 100644 gst/vaapi/gstvaapipluginbuffer.h diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index 8da7246..435f6e8 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -185,12 +185,12 @@ GST_VAAPI_IMAGE_POOL_GET_CLASS GstVaapiVideoBuffer GstVaapiVideoBuffer GstVaapiVideoBufferClass -gst_vaapi_video_buffer_new -gst_vaapi_video_buffer_new_from_pool -gst_vaapi_video_buffer_new_from_buffer -gst_vaapi_video_buffer_new_with_image -gst_vaapi_video_buffer_new_with_surface -gst_vaapi_video_buffer_new_with_surface_proxy +gst_vaapi_video_buffer_typed_new +gst_vaapi_video_buffer_typed_new_from_pool +gst_vaapi_video_buffer_typed_new_from_buffer +gst_vaapi_video_buffer_typed_new_with_image +gst_vaapi_video_buffer_typed_new_with_surface +gst_vaapi_video_buffer_typed_new_with_surface_proxy gst_vaapi_video_buffer_get_display gst_vaapi_video_buffer_get_image gst_vaapi_video_buffer_set_image diff --git a/gst-libs/gst/vaapi/gstvaapivideobuffer.c b/gst-libs/gst/vaapi/gstvaapivideobuffer.c index ef4f235..18b58ef 100644 --- a/gst-libs/gst/vaapi/gstvaapivideobuffer.c +++ b/gst-libs/gst/vaapi/gstvaapivideobuffer.c @@ -175,13 +175,16 @@ _gst_vaapi_video_buffer_typed_new(GType type) } /** - * gst_vaapi_video_buffer_new: + * gst_vaapi_video_buffer_typed_new: * @display: a #GstVaapiDisplay * * Creates an empty #GstBuffer. The caller is responsible for completing * the initialization of the buffer with the gst_vaapi_video_buffer_set_*() * functions. * + * This function shall only be called from within gstreamer-vaapi + * plugin elements. + * * Return value: the newly allocated #GstBuffer, or %NULL or error */ GstBuffer * @@ -199,15 +202,8 @@ gst_vaapi_video_buffer_typed_new(GType type, GstVaapiDisplay *display) return buffer; } -GstBuffer * -gst_vaapi_video_buffer_new(GstVaapiDisplay *display) -{ - return gst_vaapi_video_buffer_typed_new( - GST_VAAPI_TYPE_VIDEO_BUFFER, display); -} - /** - * gst_vaapi_video_buffer_new_from_pool: + * gst_vaapi_video_buffer_typed_new_from_pool: * @pool: a #GstVaapiVideoPool * * Creates a #GstBuffer with a video object allocated from a @pool. @@ -246,20 +242,16 @@ gst_vaapi_video_buffer_typed_new_from_pool(GType type, GstVaapiVideoPool *pool) return NULL; } -GstBuffer * -gst_vaapi_video_buffer_new_from_pool(GstVaapiVideoPool *pool) -{ - return gst_vaapi_video_buffer_typed_new_from_pool( - GST_VAAPI_TYPE_VIDEO_BUFFER, pool); -} - /** - * gst_vaapi_video_buffer_new_from_buffer: + * gst_vaapi_video_buffer_typed_new_from_buffer: * @buffer: a #GstBuffer * * Creates a #GstBuffer with video objects bound to @buffer video * objects, if any. * + * This function shall only be called from within gstreamer-vaapi + * plugin elements. + * * Return value: the newly allocated #GstBuffer, or %NULL on error */ GstBuffer * @@ -290,20 +282,16 @@ gst_vaapi_video_buffer_typed_new_from_buffer(GType type, GstBuffer *buffer) return GST_BUFFER(outbuf); } -GstBuffer * -gst_vaapi_video_buffer_new_from_buffer(GstBuffer *buffer) -{ - return gst_vaapi_video_buffer_typed_new_from_buffer( - GST_VAAPI_TYPE_VIDEO_BUFFER, buffer); -} - /** - * gst_vaapi_video_buffer_new_with_image: + * gst_vaapi_video_buffer_typed_new_with_image: * @image: a #GstVaapiImage * * Creates a #GstBuffer with the specified @image. The resulting * buffer holds an additional reference to the @image. * + * This function shall only be called from within gstreamer-vaapi + * plugin elements. + * * Return value: the newly allocated #GstBuffer, or %NULL on error */ GstBuffer * @@ -319,20 +307,16 @@ gst_vaapi_video_buffer_typed_new_with_image(GType type, GstVaapiImage *image) return GST_BUFFER(buffer); } -GstBuffer * -gst_vaapi_video_buffer_new_with_image(GstVaapiImage *image) -{ - return gst_vaapi_video_buffer_typed_new_with_image( - GST_VAAPI_TYPE_VIDEO_BUFFER, image); -} - /** - * gst_vaapi_video_buffer_new_with_surface: + * gst_vaapi_video_buffer_typed_new_with_surface: * @surface: a #GstVaapiSurface * * Creates a #GstBuffer with the specified @surface. The resulting * buffer holds an additional reference to the @surface. * + * This function shall only be called from within gstreamer-vaapi + * plugin elements. + * * Return value: the newly allocated #GstBuffer, or %NULL on error */ GstBuffer * @@ -351,20 +335,16 @@ gst_vaapi_video_buffer_typed_new_with_surface( return GST_BUFFER(buffer); } -GstBuffer * -gst_vaapi_video_buffer_new_with_surface(GstVaapiSurface *surface) -{ - return gst_vaapi_video_buffer_typed_new_with_surface( - GST_VAAPI_TYPE_VIDEO_BUFFER, surface); -} - /** - * gst_vaapi_video_buffer_new_with_surface_proxy: + * gst_vaapi_video_buffer_typed_new_with_surface_proxy: * @proxy: a #GstVaapiSurfaceProxy * * Creates a #GstBuffer with the specified surface @proxy. The * resulting buffer holds an additional reference to the @proxy. * + * This function shall only be called from within gstreamer-vaapi + * plugin elements. + * * Return value: the newly allocated #GstBuffer, or %NULL on error */ GstBuffer * @@ -383,13 +363,6 @@ gst_vaapi_video_buffer_typed_new_with_surface_proxy( return GST_BUFFER(buffer); } -GstBuffer * -gst_vaapi_video_buffer_new_with_surface_proxy(GstVaapiSurfaceProxy *proxy) -{ - return gst_vaapi_video_buffer_typed_new_with_surface_proxy( - GST_VAAPI_TYPE_VIDEO_BUFFER, proxy); -} - /** * gst_vaapi_video_buffer_get_display: * @buffer: a #GstVaapiVideoBuffer diff --git a/gst-libs/gst/vaapi/gstvaapivideobuffer.h b/gst-libs/gst/vaapi/gstvaapivideobuffer.h index 118ea35..5d479b2 100644 --- a/gst-libs/gst/vaapi/gstvaapivideobuffer.h +++ b/gst-libs/gst/vaapi/gstvaapivideobuffer.h @@ -85,35 +85,6 @@ struct _GstVaapiVideoBufferClass { GType gst_vaapi_video_buffer_get_type(void) G_GNUC_CONST; -/* Deprecated API. Client applications shall not use the following functions */ -#ifndef GST_VAAPI_DISABLE_DEPRECATED - -G_GNUC_DEPRECATED -GstBuffer * -gst_vaapi_video_buffer_new(GstVaapiDisplay *display); - -G_GNUC_DEPRECATED -GstBuffer * -gst_vaapi_video_buffer_new_from_pool(GstVaapiVideoPool *pool); - -G_GNUC_DEPRECATED -GstBuffer * -gst_vaapi_video_buffer_new_from_buffer(GstBuffer *buffer); - -G_GNUC_DEPRECATED -GstBuffer * -gst_vaapi_video_buffer_new_with_image(GstVaapiImage *image); - -G_GNUC_DEPRECATED -GstBuffer * -gst_vaapi_video_buffer_new_with_surface(GstVaapiSurface *surface); - -G_GNUC_DEPRECATED -GstBuffer * -gst_vaapi_video_buffer_new_with_surface_proxy(GstVaapiSurfaceProxy *proxy); - -#endif /* GST_VAAPI_DISABLE_DEPRECATED */ - GstVaapiDisplay * gst_vaapi_video_buffer_get_display(GstVaapiVideoBuffer *buffer); diff --git a/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.c b/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.c index 4f3ef43..c531f79 100644 --- a/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.c +++ b/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.c @@ -53,57 +53,3 @@ static void gst_vaapi_video_buffer_glx_init(GstVaapiVideoBufferGLX *buffer) { } - -/** - * gst_vaapi_video_buffer_glx_new: - * @display: a #GstVaapiDisplayGLX - * - * Creates an empty #GstBuffer. The caller is responsible for completing - * the initialization of the buffer with the gst_vaapi_video_buffer_set_*() - * functions. - * - * Return value: the newly allocated #GstBuffer, or %NULL or error - */ -GstBuffer * -gst_vaapi_video_buffer_glx_new(GstVaapiDisplayGLX *display) -{ - g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_GLX(display), NULL); - - return gst_vaapi_video_buffer_typed_new( - GST_VAAPI_TYPE_VIDEO_BUFFER_GLX, GST_VAAPI_DISPLAY_CAST(display)); -} - -/** - * gst_vaapi_video_buffer_glx_new_from_pool: - * @pool: a #GstVaapiVideoPool - * - * Creates a #GstBuffer with a video object allocated from a @pool. - * Only #GstVaapiSurfacePool and #GstVaapiImagePool pools are supported. - * - * The buffer is destroyed through the last call to gst_buffer_unref() - * and the video objects are pushed back to their respective pools. - * - * Return value: the newly allocated #GstBuffer, or %NULL on error - */ -GstBuffer * -gst_vaapi_video_buffer_glx_new_from_pool(GstVaapiVideoPool *pool) -{ - return gst_vaapi_video_buffer_typed_new_from_pool( - GST_VAAPI_TYPE_VIDEO_BUFFER_GLX, pool); -} - -/** - * gst_vaapi_video_buffer_glx_new_from_buffer: - * @buffer: a #GstBuffer - * - * Creates a #GstBuffer with video objects bound to @buffer video - * objects, if any. - * - * Return value: the newly allocated #GstBuffer, or %NULL on error - */ -GstBuffer * -gst_vaapi_video_buffer_glx_new_from_buffer(GstBuffer *buffer) -{ - return gst_vaapi_video_buffer_typed_new_from_buffer( - GST_VAAPI_TYPE_VIDEO_BUFFER_GLX, buffer); -} diff --git a/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.h b/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.h index fe5e0c3..0dbe065 100644 --- a/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.h +++ b/gst-libs/gst/vaapi/gstvaapivideobuffer_glx.h @@ -80,20 +80,6 @@ struct _GstVaapiVideoBufferGLXClass { GType gst_vaapi_video_buffer_glx_get_type (void) G_GNUC_CONST; -/* Deprecated API. Client applications shall not use the following functions */ -#ifndef GST_VAAPI_DISABLE_DEPRECATED - -G_GNUC_DEPRECATED -GstBuffer *gst_vaapi_video_buffer_glx_new (GstVaapiDisplayGLX * display); - -G_GNUC_DEPRECATED -GstBuffer *gst_vaapi_video_buffer_glx_new_from_pool (GstVaapiVideoPool * pool); - -G_GNUC_DEPRECATED -GstBuffer *gst_vaapi_video_buffer_glx_new_from_buffer (GstBuffer * buffer); - -#endif /* GST_VAAPI_DISABLE_DEPRECATED */ - G_END_DECLS #endif /* GST_VAAPI_VIDEO_BUFFER_GLX_H */ 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" -- 2.7.4