2015-01-24 07:29:57 +00:00
|
|
|
/*
|
|
|
|
* gstvaapitexture_egl.c - VA/EGL texture abstraction
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Intel Corporation
|
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:gstvaapitexture_egl
|
|
|
|
* @short_description: VA/EGL texture abstraction
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sysdeps.h"
|
|
|
|
#include "gstvaapitexture.h"
|
|
|
|
#include "gstvaapitexture_egl.h"
|
|
|
|
#include "gstvaapitexture_priv.h"
|
|
|
|
#include "gstvaapicompat.h"
|
|
|
|
#include "gstvaapiutils.h"
|
|
|
|
#include "gstvaapiutils_egl.h"
|
|
|
|
#include "gstvaapidisplay_egl.h"
|
|
|
|
#include "gstvaapidisplay_egl_priv.h"
|
|
|
|
#include "gstvaapisurface_egl.h"
|
|
|
|
#include "gstvaapifilter.h"
|
|
|
|
|
2016-10-13 03:53:17 +00:00
|
|
|
#define DEBUG 1
|
|
|
|
#include "gstvaapidebug.h"
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
typedef struct _GstVaapiTextureEGLPrivate GstVaapiTextureEGLPrivate;
|
2015-01-24 07:29:57 +00:00
|
|
|
|
|
|
|
/**
|
2020-04-18 11:32:24 +00:00
|
|
|
* GstVaapiTextureEGLPrivate:
|
2015-01-24 07:29:57 +00:00
|
|
|
*
|
2020-04-18 11:32:24 +00:00
|
|
|
* EGL texture specific fields.
|
2015-01-24 07:29:57 +00:00
|
|
|
*/
|
2020-04-18 11:32:24 +00:00
|
|
|
struct _GstVaapiTextureEGLPrivate
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
2016-02-02 16:50:19 +00:00
|
|
|
/*< private > */
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *texture;
|
2015-01-24 07:29:57 +00:00
|
|
|
EglContext *egl_context;
|
|
|
|
EGLImageKHR egl_image;
|
|
|
|
GstVaapiSurface *surface;
|
|
|
|
GstVaapiFilter *filter;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *texture;
|
2015-01-24 07:29:57 +00:00
|
|
|
gboolean success; /* result */
|
|
|
|
} CreateTextureArgs;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *texture;
|
2015-01-24 07:29:57 +00:00
|
|
|
GstVaapiSurface *surface;
|
|
|
|
const GstVaapiRectangle *crop_rect;
|
|
|
|
guint flags;
|
|
|
|
gboolean success; /* result */
|
|
|
|
} UploadSurfaceArgs;
|
|
|
|
|
|
|
|
static gboolean
|
2020-04-18 11:32:24 +00:00
|
|
|
create_objects (GstVaapiTexture * texture, GLuint texture_id)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTextureEGLPrivate *const texture_egl =
|
|
|
|
gst_vaapi_texture_get_private (texture);
|
|
|
|
EglContext *const ctx = texture_egl->egl_context;
|
2015-01-24 07:29:57 +00:00
|
|
|
EglVTable *const vtable = egl_context_get_vtable (ctx, FALSE);
|
2020-04-18 11:32:24 +00:00
|
|
|
GLint attribs[3] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE };
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
texture_egl->egl_image =
|
|
|
|
vtable->eglCreateImageKHR (ctx->display->base.handle.p,
|
2015-01-24 07:29:57 +00:00
|
|
|
ctx->base.handle.p, EGL_GL_TEXTURE_2D_KHR,
|
|
|
|
(EGLClientBuffer) GSIZE_TO_POINTER (texture_id), attribs);
|
2020-04-18 11:32:24 +00:00
|
|
|
if (!texture_egl->egl_image)
|
2015-01-24 07:29:57 +00:00
|
|
|
goto error_create_image;
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
texture_egl->surface =
|
|
|
|
gst_vaapi_surface_new_with_egl_image (GST_VAAPI_TEXTURE_DISPLAY (texture),
|
|
|
|
texture_egl->egl_image, GST_VIDEO_FORMAT_RGBA, texture->width,
|
|
|
|
texture->height);
|
|
|
|
if (!texture_egl->surface)
|
2015-01-24 07:29:57 +00:00
|
|
|
goto error_create_surface;
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
texture_egl->filter =
|
|
|
|
gst_vaapi_filter_new (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
|
|
|
if (!texture_egl->filter)
|
2015-01-24 07:29:57 +00:00
|
|
|
goto error_create_filter;
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
error_create_image:
|
2017-10-05 17:25:08 +00:00
|
|
|
{
|
|
|
|
GST_ERROR ("failed to create EGL image from 2D texture %u", texture_id);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2015-01-24 07:29:57 +00:00
|
|
|
error_create_surface:
|
2017-10-05 17:25:08 +00:00
|
|
|
{
|
|
|
|
GST_ERROR ("failed to create VA surface from 2D texture %u", texture_id);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2015-01-24 07:29:57 +00:00
|
|
|
error_create_filter:
|
2017-10-05 17:25:08 +00:00
|
|
|
{
|
|
|
|
GST_ERROR ("failed to create VPP filter for color conversion");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2020-04-18 11:32:24 +00:00
|
|
|
do_create_texture_unlocked (GstVaapiTexture * texture)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
|
|
|
GLuint texture_id;
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTextureEGLPrivate *texture_egl =
|
|
|
|
gst_vaapi_texture_get_private (texture);
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
if (texture->is_wrapped)
|
2015-01-24 07:29:57 +00:00
|
|
|
texture_id = GST_VAAPI_TEXTURE_ID (texture);
|
|
|
|
else {
|
2020-04-18 11:32:24 +00:00
|
|
|
texture_id = egl_create_texture (texture_egl->egl_context,
|
|
|
|
texture->gl_target, texture->gl_format,
|
|
|
|
texture->width, texture->height);
|
2015-01-24 07:29:57 +00:00
|
|
|
if (!texture_id)
|
|
|
|
return FALSE;
|
|
|
|
GST_VAAPI_TEXTURE_ID (texture) = texture_id;
|
|
|
|
}
|
|
|
|
return create_objects (texture, texture_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
do_create_texture (CreateTextureArgs * args)
|
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *const texture = args->texture;
|
|
|
|
GstVaapiTextureEGLPrivate *texture_egl =
|
|
|
|
gst_vaapi_texture_get_private (texture);
|
2015-01-24 07:29:57 +00:00
|
|
|
EglContextState old_cs;
|
|
|
|
|
|
|
|
args->success = FALSE;
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
GST_VAAPI_DISPLAY_LOCK (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
|
|
|
if (egl_context_set_current (texture_egl->egl_context, TRUE, &old_cs)) {
|
2015-01-24 07:29:57 +00:00
|
|
|
args->success = do_create_texture_unlocked (texture);
|
2020-04-18 11:32:24 +00:00
|
|
|
egl_context_set_current (texture_egl->egl_context, FALSE, &old_cs);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
2020-04-18 11:32:24 +00:00
|
|
|
GST_VAAPI_DISPLAY_UNLOCK (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-04-18 11:32:24 +00:00
|
|
|
destroy_objects (GstVaapiTextureEGLPrivate * texture_egl)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
EglContext *const ctx = texture_egl->egl_context;
|
2015-01-24 07:29:57 +00:00
|
|
|
EglVTable *const vtable = egl_context_get_vtable (ctx, FALSE);
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
if (texture_egl->egl_image != EGL_NO_IMAGE_KHR) {
|
2015-01-24 07:29:57 +00:00
|
|
|
vtable->eglDestroyImageKHR (ctx->display->base.handle.p,
|
2020-04-18 11:32:24 +00:00
|
|
|
texture_egl->egl_image);
|
|
|
|
texture_egl->egl_image = EGL_NO_IMAGE_KHR;
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
2020-04-18 11:32:24 +00:00
|
|
|
gst_mini_object_replace ((GstMiniObject **) & texture_egl->surface, NULL);
|
|
|
|
gst_vaapi_filter_replace (&texture_egl->filter, NULL);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-04-18 11:32:24 +00:00
|
|
|
do_destroy_texture_unlocked (GstVaapiTextureEGLPrivate * texture_egl)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *const base_texture = texture_egl->texture;
|
|
|
|
const GLuint texture_id = GST_VAAPI_TEXTURE_ID (base_texture);
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
destroy_objects (texture_egl);
|
2015-01-24 07:29:57 +00:00
|
|
|
|
|
|
|
if (texture_id) {
|
|
|
|
if (!base_texture->is_wrapped)
|
2020-04-18 11:32:24 +00:00
|
|
|
egl_destroy_texture (texture_egl->egl_context, texture_id);
|
|
|
|
GST_VAAPI_TEXTURE_ID (base_texture) = 0;
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-04-18 11:32:24 +00:00
|
|
|
do_destroy_texture (GstVaapiTextureEGLPrivate * texture_egl)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
|
|
|
EglContextState old_cs;
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *texture = texture_egl->texture;
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
GST_VAAPI_DISPLAY_LOCK (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
|
|
|
if (egl_context_set_current (texture_egl->egl_context, TRUE, &old_cs)) {
|
|
|
|
do_destroy_texture_unlocked (texture_egl);
|
|
|
|
egl_context_set_current (texture_egl->egl_context, FALSE, &old_cs);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
2020-04-18 11:32:24 +00:00
|
|
|
GST_VAAPI_DISPLAY_UNLOCK (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
|
|
|
egl_object_replace (&texture_egl->egl_context, NULL);
|
|
|
|
g_free (texture_egl);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2020-04-18 11:32:24 +00:00
|
|
|
do_upload_surface_unlocked (GstVaapiTextureEGLPrivate * texture_egl,
|
2015-01-24 07:29:57 +00:00
|
|
|
GstVaapiSurface * surface, const GstVaapiRectangle * crop_rect, guint flags)
|
|
|
|
{
|
|
|
|
GstVaapiFilterStatus status;
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
if (!gst_vaapi_filter_set_cropping_rectangle (texture_egl->filter, crop_rect))
|
2015-01-24 07:29:57 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
status = gst_vaapi_filter_process (texture_egl->filter, surface,
|
|
|
|
texture_egl->surface, flags);
|
2015-01-24 07:29:57 +00:00
|
|
|
if (status != GST_VAAPI_FILTER_STATUS_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
do_upload_surface (UploadSurfaceArgs * args)
|
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *const texture = args->texture;
|
|
|
|
GstVaapiTextureEGLPrivate *texture_egl =
|
|
|
|
gst_vaapi_texture_get_private (texture);
|
2015-01-24 07:29:57 +00:00
|
|
|
EglContextState old_cs;
|
|
|
|
|
|
|
|
args->success = FALSE;
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
GST_VAAPI_DISPLAY_LOCK (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
|
|
|
if (egl_context_set_current (texture_egl->egl_context, TRUE, &old_cs)) {
|
|
|
|
args->success = do_upload_surface_unlocked (texture_egl, args->surface,
|
2015-01-24 07:29:57 +00:00
|
|
|
args->crop_rect, args->flags);
|
2020-04-18 11:32:24 +00:00
|
|
|
egl_context_set_current (texture_egl->egl_context, FALSE, &old_cs);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
2020-04-18 11:32:24 +00:00
|
|
|
GST_VAAPI_DISPLAY_UNLOCK (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2020-04-18 11:32:24 +00:00
|
|
|
gst_vaapi_texture_egl_create (GstVaapiTexture * texture)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
|
|
|
CreateTextureArgs args = { texture };
|
2017-10-09 14:02:11 +00:00
|
|
|
GstVaapiDisplayEGL *display =
|
2020-04-18 11:32:24 +00:00
|
|
|
GST_VAAPI_DISPLAY_EGL (GST_VAAPI_TEXTURE_DISPLAY (texture));
|
|
|
|
GstVaapiTextureEGLPrivate *texture_egl =
|
|
|
|
gst_vaapi_texture_get_private (texture);
|
2017-10-09 14:02:11 +00:00
|
|
|
|
|
|
|
if (GST_VAAPI_TEXTURE (texture)->is_wrapped) {
|
2017-10-10 11:38:21 +00:00
|
|
|
if (!gst_vaapi_display_egl_set_current_display (display))
|
|
|
|
return FALSE;
|
2017-10-09 14:02:11 +00:00
|
|
|
}
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
egl_object_replace (&texture_egl->egl_context,
|
2017-10-09 14:02:11 +00:00
|
|
|
GST_VAAPI_DISPLAY_EGL_CONTEXT (display));
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
return egl_context_run (texture_egl->egl_context,
|
2015-01-24 07:29:57 +00:00
|
|
|
(EglContextRunFunc) do_create_texture, &args) && args.success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2020-04-18 11:32:24 +00:00
|
|
|
gst_vaapi_texture_egl_destroy (GstVaapiTextureEGLPrivate * texture_egl)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
egl_context_run (texture_egl->egl_context,
|
|
|
|
(EglContextRunFunc) do_destroy_texture, texture_egl);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2020-04-18 11:32:24 +00:00
|
|
|
gst_vaapi_texture_egl_put_surface (GstVaapiTexture * texture,
|
2015-01-24 07:29:57 +00:00
|
|
|
GstVaapiSurface * surface, const GstVaapiRectangle * crop_rect, guint flags)
|
|
|
|
{
|
|
|
|
UploadSurfaceArgs args = { texture, surface, crop_rect, flags };
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTextureEGLPrivate *texture_egl =
|
|
|
|
gst_vaapi_texture_get_private (texture);
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
return egl_context_run (texture_egl->egl_context,
|
2015-01-24 07:29:57 +00:00
|
|
|
(EglContextRunFunc) do_upload_surface, &args) && args.success;
|
|
|
|
}
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
static GstVaapiTexture *
|
|
|
|
gst_vaapi_texture_egl_new_internal (GstVaapiTexture * texture)
|
2015-01-24 07:29:57 +00:00
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTextureEGLPrivate *texture_egl;
|
2015-01-24 07:29:57 +00:00
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
texture->put_surface = gst_vaapi_texture_egl_put_surface;
|
|
|
|
|
|
|
|
texture_egl = g_malloc0 (sizeof (GstVaapiTextureEGLPrivate));
|
|
|
|
if (!texture_egl) {
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (texture));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
texture_egl->texture = texture;
|
|
|
|
gst_vaapi_texture_set_private (texture, texture_egl,
|
|
|
|
(GDestroyNotify) gst_vaapi_texture_egl_destroy);
|
|
|
|
|
|
|
|
if (!gst_vaapi_texture_egl_create (texture)) {
|
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (texture));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return texture;
|
|
|
|
}
|
2015-01-24 07:29:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_vaapi_texture_egl_new:
|
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
* @target: the target to which the texture is bound
|
|
|
|
* @format: the format of the pixel data
|
|
|
|
* @width: the requested width, in pixels
|
|
|
|
* @height: the requested height, in pixels
|
|
|
|
*
|
|
|
|
* Creates a texture with the specified dimensions, @target and
|
|
|
|
* @format. Note that only GL_TEXTURE_2D @target and GL_RGBA or
|
|
|
|
* GL_BGRA formats are supported at this time.
|
|
|
|
*
|
|
|
|
* The application shall maintain the live EGL context itself. That
|
|
|
|
* is, gst_vaapi_window_egl_make_current() must be called beforehand,
|
|
|
|
* or any other function like eglMakeCurrent() if the context is
|
|
|
|
* managed outside of this library.
|
|
|
|
*
|
|
|
|
* Return value: the newly created #GstVaapiTexture object
|
|
|
|
*/
|
|
|
|
GstVaapiTexture *
|
|
|
|
gst_vaapi_texture_egl_new (GstVaapiDisplay * display, guint target,
|
|
|
|
guint format, guint width, guint height)
|
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *texture;
|
|
|
|
|
2015-01-24 07:29:57 +00:00
|
|
|
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_EGL (display), NULL);
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
texture = gst_vaapi_texture_new_internal (display, GST_VAAPI_ID_INVALID,
|
|
|
|
target, format, width, height);
|
|
|
|
if (!texture)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return gst_vaapi_texture_egl_new_internal (texture);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_vaapi_texture_egl_new_wrapped:
|
|
|
|
* @display: a #GstVaapiDisplay
|
|
|
|
* @texture_id: the foreign GL texture name to use
|
|
|
|
* @target: the target to which the texture is bound
|
|
|
|
* @format: the format of the pixel data
|
|
|
|
* @width: the texture width, in pixels
|
|
|
|
* @height: the texture height, in pixels
|
|
|
|
*
|
|
|
|
* Creates a texture from an existing GL texture, with the specified
|
|
|
|
* @target and @format. Note that only GL_TEXTURE_2D @target and
|
|
|
|
* GL_RGBA or GL_BGRA formats are supported at this time.
|
|
|
|
*
|
|
|
|
* The application shall maintain the live EGL context itself. That
|
|
|
|
* is, gst_vaapi_window_egl_make_current() must be called beforehand,
|
|
|
|
* or any other function like eglMakeCurrent() if the context is
|
|
|
|
* managed outside of this library.
|
|
|
|
*
|
|
|
|
* Return value: the newly created #GstVaapiTexture object
|
|
|
|
*/
|
|
|
|
GstVaapiTexture *
|
|
|
|
gst_vaapi_texture_egl_new_wrapped (GstVaapiDisplay * display,
|
|
|
|
guint texture_id, guint target, GLenum format, guint width, guint height)
|
|
|
|
{
|
2020-04-18 11:32:24 +00:00
|
|
|
GstVaapiTexture *texture;
|
|
|
|
|
2015-01-24 07:29:57 +00:00
|
|
|
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_EGL (display), NULL);
|
|
|
|
g_return_val_if_fail (texture_id != GL_NONE, NULL);
|
|
|
|
|
2020-04-18 11:32:24 +00:00
|
|
|
texture = gst_vaapi_texture_new_internal (display, texture_id,
|
|
|
|
target, format, width, height);
|
|
|
|
if (!texture)
|
|
|
|
return texture;
|
|
|
|
|
|
|
|
return gst_vaapi_texture_egl_new_internal (texture);
|
2015-01-24 07:29:57 +00:00
|
|
|
}
|