mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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.
This commit is contained in:
parent
e183ea1290
commit
2b0a4a0304
7 changed files with 138 additions and 71 deletions
|
@ -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>
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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; \
|
||||
|
|
|
@ -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(
|
||||
|
@ -135,13 +119,6 @@ gst_vaapi_image_get_buffer(
|
|||
GstVaapiRectangle *rect
|
||||
);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_image_get_raw(
|
||||
GstVaapiImage *image,
|
||||
GstVaapiImageRaw *dst_image,
|
||||
GstVaapiRectangle *rect
|
||||
);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_image_update_from_buffer(
|
||||
GstVaapiImage *image,
|
||||
|
@ -149,13 +126,6 @@ gst_vaapi_image_update_from_buffer(
|
|||
GstVaapiRectangle *rect
|
||||
);
|
||||
|
||||
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);
|
||||
|
||||
|
|
126
gst-libs/gst/vaapi/gstvaapiimage_priv.h
Normal file
126
gst-libs/gst/vaapi/gstvaapiimage_priv.h
Normal file
|
@ -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 */
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue