diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-07-26 12:57:19 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2013-07-26 13:16:52 +0200 |
commit | 2b0a4a03046ed3c71aeeee908b42ba5bd480fa9c (patch) | |
tree | 672a6af26fbaa6379c199d22a42580735dbb6e26 | |
parent | e183ea12908465f1a05e68d5b9e4cd9a941880fb (diff) |
image: clean image API up.
Don't expose functions that reference a GstVaapiImageRaw, those are
meant to be internal only for implementing subpictures sync. Also add
a few private definitions to avoid functions calls for retrieving
image size and format information.
-rw-r--r-- | docs/reference/libs/libs-sections.txt | 1 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/Makefile.am | 1 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiimage.c | 32 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiimage.h | 30 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapiimage_priv.h | 126 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapisubpicture.c | 3 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapisurface.c | 16 |
7 files changed, 138 insertions, 71 deletions
diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index 9b005e61..3c1b03aa 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -226,7 +226,6 @@ gst_vaapi_image_get_plane gst_vaapi_image_get_pitch gst_vaapi_image_get_data_size gst_vaapi_image_get_buffer -gst_vaapi_image_get_raw gst_vaapi_image_update_from_buffer gst_vaapi_image_copy <SUBSECTION Standard> diff --git a/gst-libs/gst/vaapi/Makefile.am b/gst-libs/gst/vaapi/Makefile.am index d4fa2485..a8ccd6fe 100644 --- a/gst-libs/gst/vaapi/Makefile.am +++ b/gst-libs/gst/vaapi/Makefile.am @@ -109,6 +109,7 @@ libgstvaapi_source_priv_h = \ gstvaapidecoder_priv.h \ gstvaapidecoder_unit.h \ gstvaapidisplay_priv.h \ + gstvaapiimage_priv.h \ gstvaapiminiobject.h \ gstvaapiobject_priv.h \ gstvaapiparser_frame.h \ diff --git a/gst-libs/gst/vaapi/gstvaapiimage.c b/gst-libs/gst/vaapi/gstvaapiimage.c index 3ddf1240..49107ba9 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage.c +++ b/gst-libs/gst/vaapi/gstvaapiimage.c @@ -30,42 +30,12 @@ #include "gstvaapicompat.h" #include "gstvaapiutils.h" #include "gstvaapiimage.h" +#include "gstvaapiimage_priv.h" #include "gstvaapiobject_priv.h" #define DEBUG 1 #include "gstvaapidebug.h" -typedef struct _GstVaapiImageClass GstVaapiImageClass; - -/** - * GstVaapiImage: - * - * A VA image wrapper - */ -struct _GstVaapiImage { - /*< private >*/ - GstVaapiObject parent_instance; - - VAImage internal_image; - VAImage image; - guchar *image_data; - GstVideoFormat internal_format; - GstVideoFormat format; - guint width; - guint height; - guint is_linear : 1; -}; - -/** - * GstVaapiImageClass: - * - * A VA image wrapper class - */ -struct _GstVaapiImageClass { - /*< private >*/ - GstVaapiObjectClass parent_class; -}; - #define SWAP_UINT(a, b) do { \ guint v = a; \ a = b; \ diff --git a/gst-libs/gst/vaapi/gstvaapiimage.h b/gst-libs/gst/vaapi/gstvaapiimage.h index 124bdad5..c5c3ed22 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage.h +++ b/gst-libs/gst/vaapi/gstvaapiimage.h @@ -58,22 +58,6 @@ G_BEGIN_DECLS #define GST_VAAPI_IMAGE_HEIGHT(image) gst_vaapi_image_get_height(image) typedef struct _GstVaapiImage GstVaapiImage; -typedef struct _GstVaapiImageRaw GstVaapiImageRaw; - -/** - * GstVaapiImageRaw: - * - * A raw image wrapper. The caller is responsible for initializing all - * the fields with sensible values. - */ -struct _GstVaapiImageRaw { - GstVideoFormat format; - guint width; - guint height; - guint num_planes; - guchar *pixels[3]; - guint stride[3]; -}; GstVaapiImage * gst_vaapi_image_new( @@ -136,13 +120,6 @@ gst_vaapi_image_get_buffer( ); gboolean -gst_vaapi_image_get_raw( - GstVaapiImage *image, - GstVaapiImageRaw *dst_image, - GstVaapiRectangle *rect -); - -gboolean gst_vaapi_image_update_from_buffer( GstVaapiImage *image, GstBuffer *buffer, @@ -150,13 +127,6 @@ gst_vaapi_image_update_from_buffer( ); gboolean -gst_vaapi_image_update_from_raw( - GstVaapiImage *image, - GstVaapiImageRaw *src_image, - GstVaapiRectangle *rect -); - -gboolean gst_vaapi_image_copy(GstVaapiImage *dst_image, GstVaapiImage *src_image); G_END_DECLS diff --git a/gst-libs/gst/vaapi/gstvaapiimage_priv.h b/gst-libs/gst/vaapi/gstvaapiimage_priv.h new file mode 100644 index 00000000..bc99d058 --- /dev/null +++ b/gst-libs/gst/vaapi/gstvaapiimage_priv.h @@ -0,0 +1,126 @@ +/* + * gstvaapiimage_priv.h - VA image abstraction (private definitions) + * + * Copyright (C) 2010-2011 Splitted-Desktop Systems + * Copyright (C) 2011-2013 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_IMAGE_PRIV_H +#define GST_VAAPI_IMAGE_PRIV_H + +#include <gst/vaapi/gstvaapiimage.h> +#include "gstvaapiobject_priv.h" + +G_BEGIN_DECLS + +typedef struct _GstVaapiImageClass GstVaapiImageClass; +typedef struct _GstVaapiImageRaw GstVaapiImageRaw; + +/** + * GstVaapiImage: + * + * A VA image wrapper + */ +struct _GstVaapiImage { + /*< private >*/ + GstVaapiObject parent_instance; + + VAImage internal_image; + VAImage image; + guchar *image_data; + GstVideoFormat internal_format; + GstVideoFormat format; + guint width; + guint height; + guint is_linear : 1; +}; + +/** + * GstVaapiImageClass: + * + * A VA image wrapper class + */ +struct _GstVaapiImageClass { + /*< private >*/ + GstVaapiObjectClass parent_class; +}; + +/** + * GstVaapiImageRaw: + * + * A raw image wrapper. The caller is responsible for initializing all + * the fields with sensible values. + */ +struct _GstVaapiImageRaw { + GstVideoFormat format; + guint width; + guint height; + guint num_planes; + guchar *pixels[3]; + guint stride[3]; +}; + +/** + * GST_VAAPI_IMAGE_FORMAT: + * @image: a #GstVaapiImage + * + * Macro that evaluates to the #GstVideoFormat of @image. + */ +#undef GST_VAAPI_IMAGE_FORMAT +#define GST_VAAPI_IMAGE_FORMAT(image) \ + (GST_VAAPI_IMAGE(image)->format) + +/** + * GST_VAAPI_IMAGE_WIDTH: + * @image: a #GstVaapiImage + * + * Macro that evaluates to the width of @image. + */ +#undef GST_VAAPI_IMAGE_WIDTH +#define GST_VAAPI_IMAGE_WIDTH(image) \ + (GST_VAAPI_IMAGE(image)->width) + +/** + * GST_VAAPI_IMAGE_HEIGHT: + * @image: a #GstVaapiImage + * + * Macro that evaluates to the height of @image. + */ +#undef GST_VAAPI_IMAGE_HEIGHT +#define GST_VAAPI_IMAGE_HEIGHT(image) \ + (GST_VAAPI_IMAGE(image)->height) + +G_GNUC_INTERNAL +gboolean +gst_vaapi_image_get_raw( + GstVaapiImage *image, + GstVaapiImageRaw *dst_image, + GstVaapiRectangle *rect +); + +G_GNUC_INTERNAL +gboolean +gst_vaapi_image_update_from_raw( + GstVaapiImage *image, + GstVaapiImageRaw *src_image, + GstVaapiRectangle *rect +); + +G_END_DECLS + +#endif /* GST_VAAPI_IMAGE_PRIV_H */ diff --git a/gst-libs/gst/vaapi/gstvaapisubpicture.c b/gst-libs/gst/vaapi/gstvaapisubpicture.c index 92bbb2e3..a269df5a 100644 --- a/gst-libs/gst/vaapi/gstvaapisubpicture.c +++ b/gst-libs/gst/vaapi/gstvaapisubpicture.c @@ -31,6 +31,7 @@ #include "gstvaapiutils.h" #include "gstvaapisubpicture.h" #include "gstvaapiobject_priv.h" +#include "gstvaapiimage_priv.h" #define DEBUG 1 #include "gstvaapidebug.h" @@ -141,7 +142,7 @@ gst_vaapi_subpicture_new(GstVaapiImage *image, guint flags) GST_VAAPI_ID_ARGS(GST_VAAPI_OBJECT_ID(image))); display = GST_VAAPI_OBJECT_DISPLAY(image); - format = gst_vaapi_image_get_format(image); + format = GST_VAAPI_IMAGE_FORMAT(image); if (!gst_vaapi_display_has_subpicture_format(display, format, &va_flags)) return NULL; if (flags & ~va_flags) diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index 768a8a9b..1a094b7b 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.c +++ b/gst-libs/gst/vaapi/gstvaapisurface.c @@ -32,6 +32,7 @@ #include "gstvaapisurface_priv.h" #include "gstvaapicontext.h" #include "gstvaapiimage.h" +#include "gstvaapiimage_priv.h" #define DEBUG 1 #include "gstvaapidebug.h" @@ -322,7 +323,7 @@ gst_vaapi_surface_get_format(GstVaapiSurface *surface) if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) { GstVaapiImage * const image = gst_vaapi_surface_derive_image(surface); if (image) { - surface->format = gst_vaapi_image_get_format(image); + surface->format = GST_VAAPI_IMAGE_FORMAT(image); gst_vaapi_object_unref(image); } if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) @@ -502,7 +503,8 @@ gst_vaapi_surface_get_image(GstVaapiSurface *surface, GstVaapiImage *image) if (!display) return FALSE; - gst_vaapi_image_get_size(image, &width, &height); + width = GST_VAAPI_IMAGE_WIDTH(image); + height = GST_VAAPI_IMAGE_HEIGHT(image); if (width != surface->width || height != surface->height) return FALSE; @@ -549,7 +551,8 @@ gst_vaapi_surface_put_image(GstVaapiSurface *surface, GstVaapiImage *image) if (!display) return FALSE; - gst_vaapi_image_get_size(image, &width, &height); + width = GST_VAAPI_IMAGE_WIDTH(image); + height = GST_VAAPI_IMAGE_HEIGHT(image); if (width != surface->width || height != surface->height) return FALSE; @@ -659,11 +662,8 @@ _gst_vaapi_surface_associate_subpicture( src_rect = &src_rect_default; src_rect_default.x = 0; src_rect_default.y = 0; - gst_vaapi_image_get_size( - image, - &src_rect_default.width, - &src_rect_default.height - ); + src_rect_default.width = GST_VAAPI_IMAGE_WIDTH(image); + src_rect_default.height = GST_VAAPI_IMAGE_HEIGHT(image); } if (!dst_rect) { |