mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
glmemory: add the texture type to allocate to parameters
Rather than assuming something. e.g. zerocopy on iOS with GLES3 requires the use of Luminance/Luminance Alpha formats and does not work with Red/RG textures.
This commit is contained in:
parent
6958b7a014
commit
989200820d
18 changed files with 164 additions and 141 deletions
|
@ -702,7 +702,8 @@ gst_gl_overlay_load_jpeg (GstGLOverlay * overlay, FILE * fp)
|
|||
(GST_GL_BASE_FILTER (overlay)->context));
|
||||
params =
|
||||
gst_gl_video_allocation_params_new (GST_GL_BASE_FILTER (overlay)->context,
|
||||
NULL, &v_info, 0, &v_align, GST_GL_TEXTURE_TARGET_2D);
|
||||
NULL, &v_info, 0, &v_align, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
overlay->image_memory = (GstGLMemory *)
|
||||
gst_gl_base_memory_alloc (mem_allocator,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -817,7 +818,8 @@ gst_gl_overlay_load_png (GstGLOverlay * overlay, FILE * fp)
|
|||
(GST_GL_BASE_FILTER (overlay)->context));
|
||||
params =
|
||||
gst_gl_video_allocation_params_new (GST_GL_BASE_FILTER (overlay)->context,
|
||||
NULL, &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D);
|
||||
NULL, &v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
overlay->image_memory = (GstGLMemory *)
|
||||
gst_gl_base_memory_alloc (mem_allocator,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
|
|
@ -66,8 +66,8 @@ EGLDisplay
|
|||
gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem)
|
||||
{
|
||||
g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)), NULL);
|
||||
return GST_GL_CONTEXT_EGL (_gl_mem_get_parent (mem)->mem.mem.context)->
|
||||
egl_display;
|
||||
return GST_GL_CONTEXT_EGL (_gl_mem_get_parent (mem)->mem.mem.
|
||||
context)->egl_display;
|
||||
}
|
||||
|
||||
GstVideoGLTextureOrientation
|
||||
|
@ -99,17 +99,6 @@ _gl_mem_destroy (GstGLMemoryEGL * mem)
|
|||
*) mem);
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_mem_init (GstGLMemoryEGL * mem, GstAllocator * allocator,
|
||||
GstMemory * parent, GstGLContext * context, GstGLTextureTarget target,
|
||||
GstAllocationParams * params, GstVideoInfo * info,
|
||||
guint plane, GstVideoAlignment * valign, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
gst_gl_memory_init ((GstGLMemory *) mem, allocator, parent,
|
||||
context, target, params, info, plane, valign, user_data, notify);
|
||||
}
|
||||
|
||||
static GstGLMemoryEGL *
|
||||
_gl_mem_egl_alloc (GstGLBaseMemoryAllocator * allocator,
|
||||
GstGLVideoAllocationParams * params)
|
||||
|
@ -136,10 +125,10 @@ _gl_mem_egl_alloc (GstGLBaseMemoryAllocator * allocator,
|
|||
mem->image = gst_egl_image_ref (params->parent.gl_handle);
|
||||
}
|
||||
|
||||
_gl_mem_init (mem, GST_ALLOCATOR_CAST (allocator), NULL,
|
||||
params->parent.context, params->target, params->parent.alloc_params,
|
||||
params->v_info, params->plane, params->valign, params->parent.user_data,
|
||||
params->parent.notify);
|
||||
gst_gl_memory_init (GST_GL_MEMORY_CAST (mem), GST_ALLOCATOR_CAST (allocator),
|
||||
NULL, params->parent.context, params->target, params->tex_type,
|
||||
params->parent.alloc_params, params->v_info, params->plane,
|
||||
params->valign, params->parent.user_data, params->parent.notify);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|||
gst_buffer_pool_config_get_gl_allocation_params (config);
|
||||
if (!priv->gl_params)
|
||||
priv->gl_params = gst_gl_video_allocation_params_new (glpool->context,
|
||||
&alloc_params, &info, -1, NULL, 0);
|
||||
&alloc_params, &info, -1, NULL, 0, 0);
|
||||
|
||||
max_align = alloc_params.align;
|
||||
|
||||
|
@ -262,7 +262,7 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
|
|||
}
|
||||
|
||||
alloc = GST_GL_MEMORY_ALLOCATOR (priv->allocator);
|
||||
if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params, NULL, 0))
|
||||
if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params, NULL, NULL, 0))
|
||||
goto mem_create_failed;
|
||||
|
||||
if (priv->add_glsyncmeta)
|
||||
|
|
|
@ -2234,7 +2234,8 @@ _do_convert_one_view (GstGLContext * context, GstGLColorConvert * convert,
|
|||
allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
|
||||
base_mem_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &temp_info,
|
||||
0, NULL, convert->priv->to_texture_target);
|
||||
0, NULL, convert->priv->to_texture_target,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
|
||||
convert->priv->out_tex[j] =
|
||||
(GstGLMemory *) gst_gl_base_memory_alloc (base_mem_allocator,
|
||||
|
|
|
@ -275,8 +275,9 @@ _gl_tex_create (GstGLMemory * gl_mem, GError ** error)
|
|||
void
|
||||
gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
|
||||
GstMemory * parent, GstGLContext * context, GstGLTextureTarget target,
|
||||
GstAllocationParams * params, GstVideoInfo * info, guint plane,
|
||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
||||
GstVideoGLTextureType tex_type, GstAllocationParams * params,
|
||||
GstVideoInfo * info, guint plane, GstVideoAlignment * valign,
|
||||
gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
const gchar *target_str;
|
||||
gsize size;
|
||||
|
@ -307,9 +308,7 @@ gst_gl_memory_init (GstGLMemory * mem, GstAllocator * allocator,
|
|||
size = gst_gl_get_plane_data_size (info, valign, plane);
|
||||
|
||||
mem->tex_target = target;
|
||||
mem->tex_type =
|
||||
gst_gl_texture_type_from_format (context, GST_VIDEO_INFO_FORMAT (info),
|
||||
plane);
|
||||
mem->tex_type = tex_type;
|
||||
mem->plane = plane;
|
||||
|
||||
_calculate_unpack_length (mem, context);
|
||||
|
@ -638,12 +637,21 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (USING_GLES2 (src->mem.context)
|
||||
&& (src->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE
|
||||
|| src->tex_type == GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA)) {
|
||||
GST_CAT_FIXME (GST_CAT_GL_MEMORY,
|
||||
"Cannot copy Luminance/Luminance Alpha textures in GLES");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!gst_memory_map (GST_MEMORY_CAST (src), &sinfo,
|
||||
GST_MAP_READ | GST_MAP_GL)) {
|
||||
GST_CAT_ERROR (GST_CAT_GL_MEMORY,
|
||||
"Failed to map source memory for copying");
|
||||
goto error;
|
||||
}
|
||||
|
||||
src_tex_id = *(guint *) sinfo.data;
|
||||
|
||||
GST_CAT_LOG (GST_CAT_GL_MEMORY, "copying memory %p, tex %u into "
|
||||
|
@ -738,22 +746,15 @@ _default_gl_tex_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
dest = g_new0 (GstGLMemory, 1);
|
||||
|
||||
gst_gl_memory_init (dest, allocator, NULL, src->mem.context, src->tex_target,
|
||||
¶ms, &src->info, src->plane, &src->valign, NULL, NULL);
|
||||
src->tex_type, ¶ms, &src->info, src->plane, &src->valign, NULL, NULL);
|
||||
|
||||
if (GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
|
||||
if (!gst_gl_base_memory_memcpy ((GstGLBaseMemory *) src,
|
||||
(GstGLBaseMemory *) dest, offset, size)) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unref (GST_MEMORY_CAST (dest));
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (!GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
|
||||
GstMapInfo dinfo;
|
||||
|
||||
if (!gst_memory_map (GST_MEMORY_CAST (dest), &dinfo,
|
||||
GST_MAP_WRITE | GST_MAP_GL)) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY,
|
||||
"Failed not map destination " "for writing");
|
||||
"Failed not map destination for writing");
|
||||
gst_memory_unref (GST_MEMORY_CAST (dest));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -763,11 +764,18 @@ _default_gl_tex_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
src->tex_type, src->tex_width, GL_MEM_HEIGHT (src))) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
|
||||
gst_memory_unref (GST_MEMORY_CAST (dest));
|
||||
return NULL;
|
||||
goto memcpy;
|
||||
}
|
||||
|
||||
gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
|
||||
} else {
|
||||
memcpy:
|
||||
if (!gst_gl_base_memory_memcpy ((GstGLBaseMemory *) src,
|
||||
(GstGLBaseMemory *) dest, offset, size)) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unref (GST_MEMORY_CAST (dest));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return (GstMemory *) dest;
|
||||
|
@ -826,9 +834,9 @@ _default_gl_tex_alloc (GstGLMemoryAllocator * allocator,
|
|||
}
|
||||
|
||||
gst_gl_memory_init (mem, GST_ALLOCATOR_CAST (allocator), NULL,
|
||||
params->parent.context, params->target, params->parent.alloc_params,
|
||||
params->v_info, params->plane, params->valign, params->parent.user_data,
|
||||
params->parent.notify);
|
||||
params->parent.context, params->target, params->tex_type,
|
||||
params->parent.alloc_params, params->v_info, params->plane,
|
||||
params->valign, params->parent.user_data, params->parent.notify);
|
||||
|
||||
if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
|
||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
|
||||
|
@ -1063,6 +1071,7 @@ _gst_gl_video_allocation_params_set_video_alignment (GstGLVideoAllocationParams
|
|||
* @plane: the video plane @wrapped_data represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data
|
||||
* @target: the #GstGLTextureTarget
|
||||
* @tex_type: the #GstVideoGLTextureType
|
||||
* @wrapped_data: (allow-none): the optional data pointer to wrap
|
||||
* @gl_handle: the optional OpenGL handle to wrap or 0
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
|
@ -1080,8 +1089,8 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
|||
GstGLAllocationParamsFreeFunc free, GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info,
|
||||
guint plane, GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
gpointer wrapped_data, gpointer gl_handle, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
GstVideoGLTextureType tex_type, gpointer wrapped_data, gpointer gl_handle,
|
||||
gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
guint i;
|
||||
|
||||
|
@ -1106,6 +1115,7 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
|||
}
|
||||
_gst_gl_video_allocation_params_set_video_alignment (params, valign);
|
||||
params->target = target;
|
||||
params->tex_type = tex_type;
|
||||
params->plane = plane;
|
||||
|
||||
return TRUE;
|
||||
|
@ -1114,11 +1124,12 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
|||
/**
|
||||
* gst_gl_video_allocation_params_new:
|
||||
* @context: a #GstGLContext
|
||||
* @alloc_params: (allow-none): the #GstAllocationParams for @wrapped_data
|
||||
* @v_info: the #GstVideoInfo for @wrapped_data
|
||||
* @plane: the video plane @wrapped_data represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data
|
||||
* @target: the #GstGLTextureTarget for @wrapped_data
|
||||
* @alloc_params: (allow-none): the #GstAllocationParams for sysmem mappings of the texture
|
||||
* @v_info: the #GstVideoInfo for the texture
|
||||
* @plane: the video plane of @v_info to allocate
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of the texture
|
||||
* @target: the #GstGLTextureTarget for the created textures
|
||||
* @target: the #GstVideoGLTextureType for the created textures
|
||||
*
|
||||
* Returns: a new #GstGLVideoAllocationParams for allocating #GstGLMemory's
|
||||
*
|
||||
|
@ -1127,7 +1138,8 @@ gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
|||
GstGLVideoAllocationParams *
|
||||
gst_gl_video_allocation_params_new (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target)
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type)
|
||||
{
|
||||
GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
|
||||
|
||||
|
@ -1139,7 +1151,7 @@ gst_gl_video_allocation_params_new (GstGLContext * context,
|
|||
gst_gl_video_allocation_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc)
|
||||
gst_gl_video_allocation_params_free_data, context, alloc_params,
|
||||
v_info, plane, valign, target, NULL, 0, NULL, NULL)) {
|
||||
v_info, plane, valign, target, tex_type, NULL, 0, NULL, NULL)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1155,6 +1167,7 @@ gst_gl_video_allocation_params_new (GstGLContext * context,
|
|||
* @plane: the video plane @wrapped_data represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @wrapped_data
|
||||
* @target: the #GstGLTextureTarget for @wrapped_data
|
||||
* @tex_type: the #GstVideoGLTextureType for @wrapped_data
|
||||
* @wrapped_data: the data pointer to wrap
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
* @notify: (allow-none): a #GDestroyNotify
|
||||
|
@ -1167,7 +1180,8 @@ GstGLVideoAllocationParams *
|
|||
gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
gpointer wrapped_data, gpointer user_data, GDestroyNotify notify)
|
||||
GstVideoGLTextureType tex_type, gpointer wrapped_data, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
|
||||
|
||||
|
@ -1179,7 +1193,8 @@ gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
|||
gst_gl_video_allocation_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc)
|
||||
gst_gl_video_allocation_params_free_data, context, alloc_params,
|
||||
v_info, plane, valign, target, wrapped_data, 0, user_data, notify)) {
|
||||
v_info, plane, valign, target, tex_type, wrapped_data, 0, user_data,
|
||||
notify)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1195,6 +1210,7 @@ gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
|||
* @plane: the video plane @tex_id represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @tex_id
|
||||
* @target: the #GstGLTextureTarget for @tex_id
|
||||
* @tex_type: the #GstVideoGLTextureType for @tex_id
|
||||
* @gl_handle: the GL handle to wrap
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
* @notify: (allow-none): a #GDestroyNotify
|
||||
|
@ -1211,7 +1227,8 @@ GstGLVideoAllocationParams *
|
|||
gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
gpointer gl_handle, gpointer user_data, GDestroyNotify notify)
|
||||
GstVideoGLTextureType tex_type, gpointer gl_handle, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GstGLVideoAllocationParams *params = g_new0 (GstGLVideoAllocationParams, 1);
|
||||
|
||||
|
@ -1223,7 +1240,8 @@ gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
|
|||
gst_gl_video_allocation_params_copy_data,
|
||||
(GstGLAllocationParamsFreeFunc)
|
||||
gst_gl_video_allocation_params_free_data, context, alloc_params,
|
||||
v_info, plane, valign, target, NULL, gl_handle, user_data, notify)) {
|
||||
v_info, plane, valign, target, tex_type, NULL, gl_handle, user_data,
|
||||
notify)) {
|
||||
g_free (params);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1239,6 +1257,7 @@ gst_gl_video_allocation_params_new_wrapped_gl_handle (GstGLContext * context,
|
|||
* @plane: the video plane @tex_id represents
|
||||
* @valign: (allow-none): any #GstVideoAlignment applied to symem mappings of @tex_id
|
||||
* @target: the #GstGLTextureTarget for @tex_id
|
||||
* @tex_type: the #GstGLTextureType for @tex_id
|
||||
* @tex_id: the GL texture to wrap
|
||||
* @user_data: (allow-none): user data to call @notify with
|
||||
* @notify: (allow-none): a #GDestroyNotify
|
||||
|
@ -1251,11 +1270,12 @@ GstGLVideoAllocationParams *
|
|||
gst_gl_video_allocation_params_new_wrapped_texture (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params, GstVideoInfo * v_info, guint plane,
|
||||
GstVideoAlignment * valign, GstGLTextureTarget target,
|
||||
guint tex_id, gpointer user_data, GDestroyNotify notify)
|
||||
GstVideoGLTextureType tex_type, guint tex_id, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
return gst_gl_video_allocation_params_new_wrapped_gl_handle (context,
|
||||
alloc_params, v_info, plane, valign, target, GUINT_TO_POINTER (tex_id),
|
||||
user_data, notify);
|
||||
alloc_params, v_info, plane, valign, target, tex_type,
|
||||
GUINT_TO_POINTER (tex_id), user_data, notify);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1305,6 +1325,7 @@ gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
|
|||
_gst_gl_video_allocation_params_set_video_alignment (dest_vid,
|
||||
src_vid->valign);
|
||||
dest_vid->target = src_vid->target;
|
||||
dest_vid->tex_type = src_vid->tex_type;
|
||||
dest_vid->plane = src_vid->plane;
|
||||
}
|
||||
|
||||
|
@ -1313,6 +1334,7 @@ gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
|
|||
* @allocator: the @GstGLMemoryAllocator to allocate from
|
||||
* @buffer: a #GstBuffer to setup
|
||||
* @params: the #GstGLVideoAllocationParams to allocate with
|
||||
* @tex_types: (allow-none): a list of #GstVideoGLTextureType's to allocate with.
|
||||
*
|
||||
* Returns: whether the buffer was correctly setup
|
||||
*
|
||||
|
@ -1321,7 +1343,8 @@ gst_gl_video_allocation_params_copy_data (GstGLVideoAllocationParams * src_vid,
|
|||
gboolean
|
||||
gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
||||
GstBuffer * buffer, GstGLVideoAllocationParams * params,
|
||||
gpointer * wrapped_data, gsize n_wrapped_pointers)
|
||||
GstVideoGLTextureType * tex_types, gpointer * wrapped_data,
|
||||
gsize n_wrapped_pointers)
|
||||
{
|
||||
GstGLBaseMemoryAllocator *base_allocator;
|
||||
guint n_mem, i, v, views;
|
||||
|
@ -1347,6 +1370,14 @@ gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
|||
for (i = 0; i < n_mem; i++) {
|
||||
GstGLMemory *gl_mem;
|
||||
|
||||
if (tex_types) {
|
||||
params->tex_type = tex_types[i];
|
||||
} else {
|
||||
params->tex_type =
|
||||
gst_gl_texture_type_from_format (params->parent.context,
|
||||
GST_VIDEO_INFO_FORMAT (params->v_info), i);
|
||||
}
|
||||
|
||||
params->plane = i;
|
||||
if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
|
||||
g_return_val_if_fail (wrapped_data != NULL, FALSE);
|
||||
|
|
|
@ -92,6 +92,7 @@ struct _GstGLVideoAllocationParams
|
|||
guint plane;
|
||||
GstVideoAlignment *valign;
|
||||
GstGLTextureTarget target;
|
||||
GstVideoGLTextureType tex_type;
|
||||
};
|
||||
|
||||
gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
|
||||
|
@ -105,6 +106,7 @@ gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAlloc
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
gpointer wrapped_data,
|
||||
gpointer gl_handle,
|
||||
gpointer user_data,
|
||||
|
@ -114,13 +116,15 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new (GstGLContext *
|
|||
GstVideoInfo * v_info,
|
||||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target);
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type);
|
||||
GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_data (GstGLContext * context,
|
||||
GstAllocationParams * alloc_params,
|
||||
GstVideoInfo * v_info,
|
||||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
gpointer wrapped_data,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
@ -131,6 +135,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_texture
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
guint tex_id,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
@ -141,6 +146,7 @@ GstGLVideoAllocationParams * gst_gl_video_allocation_params_new_wrapped_gl_handl
|
|||
guint plane,
|
||||
GstVideoAlignment * valign,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
gpointer gl_handle,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
@ -192,6 +198,7 @@ void gst_gl_memory_init (GstGLMemory * mem,
|
|||
GstMemory * parent,
|
||||
GstGLContext * context,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstAllocationParams *params,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
|
@ -227,6 +234,7 @@ guint gst_gl_memory_get_texture_id (GstGLMemory * gl_me
|
|||
gboolean gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
|
||||
GstBuffer * buffer,
|
||||
GstGLVideoAllocationParams * params,
|
||||
GstVideoGLTextureType *tex_types,
|
||||
gpointer *wrapped_data,
|
||||
gsize n_wrapped_pointers);
|
||||
|
||||
|
|
|
@ -217,34 +217,6 @@ _gl_mem_create (GstGLMemoryPBO * gl_mem, GError ** error)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gl_mem_init (GstGLMemoryPBO * mem, GstAllocator * allocator,
|
||||
GstMemory * parent, GstGLContext * context, GstGLTextureTarget target,
|
||||
GstAllocationParams * params, GstVideoInfo * info,
|
||||
guint plane, GstVideoAlignment * valign, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
gst_gl_memory_init ((GstGLMemory *) mem, allocator, parent,
|
||||
context, target, params, info, plane, valign, user_data, notify);
|
||||
}
|
||||
|
||||
static GstGLMemoryPBO *
|
||||
_gl_mem_new (GstAllocator * allocator, GstMemory * parent,
|
||||
GstGLContext * context, GstGLTextureTarget target,
|
||||
GstAllocationParams * params, GstVideoInfo * info,
|
||||
guint plane, GstVideoAlignment * valign, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GstGLMemoryPBO *mem;
|
||||
mem = g_new0 (GstGLMemoryPBO, 1);
|
||||
mem->mem.texture_wrapped = FALSE;
|
||||
|
||||
_gl_mem_init (mem, allocator, parent, context, target, params, info, plane,
|
||||
valign, user_data, notify);
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_read_pixels_to_pbo (GstGLMemoryPBO * gl_mem)
|
||||
{
|
||||
|
@ -601,18 +573,12 @@ _gl_mem_copy (GstGLMemoryPBO * src, gssize offset, gssize size)
|
|||
size);
|
||||
}
|
||||
|
||||
dest = (GstMemory *) _gl_mem_new (allocator, NULL, src->mem.mem.context,
|
||||
src->mem.tex_target, ¶ms, &src->mem.info, src->mem.plane,
|
||||
&src->mem.valign, NULL, NULL);
|
||||
dest = (GstMemory *) g_new0 (GstGLMemoryPBO, 1);
|
||||
gst_gl_memory_init (GST_GL_MEMORY_CAST (dest), allocator, NULL,
|
||||
src->mem.mem.context, src->mem.tex_target, src->mem.tex_type, ¶ms,
|
||||
&src->mem.info, src->mem.plane, &src->mem.valign, NULL, NULL);
|
||||
|
||||
if (GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
|
||||
if (!gst_gl_base_memory_memcpy ((GstGLBaseMemory *) src,
|
||||
(GstGLBaseMemory *) dest, offset, size)) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unref (GST_MEMORY_CAST (dest));
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (!GST_MEMORY_FLAG_IS_SET (src, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD)) {
|
||||
GstMapInfo dinfo;
|
||||
|
||||
if (!gst_memory_map (GST_MEMORY_CAST (dest), &dinfo,
|
||||
|
@ -628,11 +594,18 @@ _gl_mem_copy (GstGLMemoryPBO * src, gssize offset, gssize size)
|
|||
src->mem.tex_type, src->mem.tex_width, GL_MEM_HEIGHT (src))) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
|
||||
gst_memory_unref (GST_MEMORY_CAST (dest));
|
||||
return NULL;
|
||||
goto memcpy;
|
||||
}
|
||||
|
||||
gst_memory_unmap (GST_MEMORY_CAST (dest), &dinfo);
|
||||
} else {
|
||||
memcpy:
|
||||
if (!gst_gl_base_memory_memcpy ((GstGLBaseMemory *) src,
|
||||
(GstGLBaseMemory *) dest, offset, size)) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY, "Could not copy GL Memory");
|
||||
gst_memory_unref (GST_MEMORY_CAST (dest));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
|
@ -678,10 +651,10 @@ _gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator,
|
|||
mem->mem.texture_wrapped = TRUE;
|
||||
}
|
||||
|
||||
_gl_mem_init (mem, GST_ALLOCATOR_CAST (allocator), NULL,
|
||||
params->parent.context, params->target, params->parent.alloc_params,
|
||||
params->v_info, params->plane, params->valign, params->parent.user_data,
|
||||
params->parent.notify);
|
||||
gst_gl_memory_init (GST_GL_MEMORY_CAST (mem), GST_ALLOCATOR_CAST (allocator),
|
||||
NULL, params->parent.context, params->target, params->tex_type,
|
||||
params->parent.alloc_params, params->v_info, params->plane,
|
||||
params->valign, params->parent.user_data, params->parent.notify);
|
||||
|
||||
if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
|
||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
|
||||
|
|
|
@ -356,7 +356,8 @@ gst_gl_composition_overlay_upload (GstGLCompositionOverlay * overlay,
|
|||
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (overlay->context,
|
||||
NULL, &comp_frame->info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
comp_frame->data[0], comp_frame, _video_frame_unmap_and_free);
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, comp_frame->data[0], comp_frame,
|
||||
_video_frame_unmap_and_free);
|
||||
|
||||
comp_gl_memory =
|
||||
(GstGLMemory *) gst_gl_base_memory_alloc (mem_allocator,
|
||||
|
|
|
@ -315,8 +315,8 @@ _gl_memory_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
|
|||
gst_allocation_params_init (¶ms);
|
||||
|
||||
allocator =
|
||||
GST_ALLOCATOR (gst_gl_memory_allocator_get_default (upload->upload->
|
||||
context));
|
||||
GST_ALLOCATOR (gst_gl_memory_allocator_get_default (upload->
|
||||
upload->context));
|
||||
gst_query_add_allocation_param (query, allocator, ¶ms);
|
||||
gst_object_unref (allocator);
|
||||
|
||||
|
@ -582,9 +582,9 @@ _dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
|
|||
if (dmabuf->params)
|
||||
gst_gl_allocation_params_free ((GstGLAllocationParams *) dmabuf->params);
|
||||
if (!(dmabuf->params =
|
||||
gst_gl_video_allocation_params_new_wrapped_gl_handle (dmabuf->upload->
|
||||
context, NULL, &dmabuf->upload->priv->in_info, -1, NULL,
|
||||
GST_GL_TEXTURE_TARGET_2D, NULL, NULL, NULL)))
|
||||
gst_gl_video_allocation_params_new_wrapped_gl_handle (dmabuf->
|
||||
upload->context, NULL, &dmabuf->upload->priv->in_info, -1, NULL,
|
||||
GST_GL_TEXTURE_TARGET_2D, 0, NULL, NULL, NULL)))
|
||||
return FALSE;
|
||||
|
||||
/* Find and validate all memories */
|
||||
|
@ -649,7 +649,7 @@ _dma_buf_upload_perform_gl_thread (GstGLContext * context,
|
|||
|
||||
/* FIXME: buffer pool */
|
||||
dmabuf->outbuf = gst_buffer_new ();
|
||||
gst_gl_memory_setup_buffer (allocator, dmabuf->outbuf, dmabuf->params,
|
||||
gst_gl_memory_setup_buffer (allocator, dmabuf->outbuf, dmabuf->params, NULL,
|
||||
(gpointer *) dmabuf->eglimage, gst_buffer_n_memory (dmabuf->outbuf));
|
||||
gst_object_unref (allocator);
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ _upload_meta_upload_accept (gpointer impl, GstBuffer * buffer,
|
|||
if (!(upload->params =
|
||||
gst_gl_video_allocation_params_new (upload->upload->context, NULL,
|
||||
&upload->upload->priv->in_info, -1, NULL,
|
||||
GST_GL_TEXTURE_TARGET_2D)))
|
||||
GST_GL_TEXTURE_TARGET_2D, 0)))
|
||||
return FALSE;
|
||||
|
||||
if (buffer) {
|
||||
|
@ -817,11 +817,11 @@ _upload_meta_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
|
|||
gpointer handle;
|
||||
|
||||
gl_apis =
|
||||
gst_gl_api_to_string (gst_gl_context_get_gl_api (upload->
|
||||
upload->context));
|
||||
gst_gl_api_to_string (gst_gl_context_get_gl_api (upload->upload->
|
||||
context));
|
||||
platform =
|
||||
gst_gl_platform_to_string (gst_gl_context_get_gl_platform
|
||||
(upload->upload->context));
|
||||
gst_gl_platform_to_string (gst_gl_context_get_gl_platform (upload->
|
||||
upload->context));
|
||||
handle = (gpointer) gst_gl_context_get_gl_context (upload->upload->context);
|
||||
|
||||
gl_context =
|
||||
|
@ -876,7 +876,8 @@ _upload_meta_upload_perform (gpointer impl, GstBuffer * buffer,
|
|||
|
||||
/* FIXME: buffer pool */
|
||||
*outbuf = gst_buffer_new ();
|
||||
gst_gl_memory_setup_buffer (allocator, *outbuf, upload->params, NULL, 0);
|
||||
gst_gl_memory_setup_buffer (allocator, *outbuf, upload->params, NULL, NULL,
|
||||
0);
|
||||
gst_object_unref (allocator);
|
||||
|
||||
for (i = 0; i < GST_GL_UPLOAD_MAX_PLANES; i++) {
|
||||
|
@ -1067,7 +1068,7 @@ _raw_data_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
|
|||
if (!(raw->params =
|
||||
gst_gl_video_allocation_params_new_wrapped_data (raw->upload->context,
|
||||
NULL, &raw->upload->priv->in_info, -1, NULL,
|
||||
GST_GL_TEXTURE_TARGET_2D, NULL, raw->in_frame,
|
||||
GST_GL_TEXTURE_TARGET_2D, 0, NULL, raw->in_frame,
|
||||
(GDestroyNotify) _raw_upload_frame_unref)))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -1952,9 +1952,10 @@ _gen_buffer (GstGLViewConvert * viewconvert, GstBuffer ** target)
|
|||
(viewconvert->context));
|
||||
mem_allocator = GST_GL_MEMORY_ALLOCATOR (allocator);
|
||||
params = gst_gl_video_allocation_params_new (viewconvert->context, NULL,
|
||||
&viewconvert->out_info, 0, NULL, viewconvert->to_texture_target);
|
||||
&viewconvert->out_info, 0, NULL, viewconvert->to_texture_target, 0);
|
||||
|
||||
if (!gst_gl_memory_setup_buffer (mem_allocator, *target, params, NULL, 0)) {
|
||||
if (!gst_gl_memory_setup_buffer (mem_allocator, *target, params, NULL, NULL,
|
||||
0)) {
|
||||
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
|
||||
gst_object_unref (allocator);
|
||||
return FALSE;
|
||||
|
@ -2093,7 +2094,8 @@ _do_view_convert (GstGLContext * context, GstGLViewConvert * viewconvert)
|
|||
GST_ALLOCATOR (gst_gl_memory_allocator_get_default (context));
|
||||
base_mem_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &temp_info,
|
||||
0, NULL, viewconvert->to_texture_target);
|
||||
0, NULL, viewconvert->to_texture_target,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
|
||||
priv->out_tex[j] =
|
||||
(GstGLMemory *) gst_gl_base_memory_alloc (base_mem_allocator,
|
||||
|
|
|
@ -1354,7 +1354,8 @@ retry:
|
|||
(GST_GL_MEMORY_ALLOCATOR_NAME));
|
||||
|
||||
params = gst_gl_video_allocation_params_new (self->gl_context, NULL,
|
||||
&state->info, 0, NULL, GST_GL_TEXTURE_TARGET_EXTERNAL_OES);
|
||||
&state->info, 0, NULL, GST_GL_TEXTURE_TARGET_EXTERNAL_OES,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
|
||||
self->oes_mem = (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
|
|
@ -160,6 +160,7 @@ static GstIOSurfaceMemory *
|
|||
_io_surface_memory_new (GstGLContext * context,
|
||||
IOSurfaceRef surface,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
||||
|
@ -170,7 +171,7 @@ _io_surface_memory_new (GstGLContext * context,
|
|||
|
||||
mem = g_new0 (GstIOSurfaceMemory, 1);
|
||||
gst_gl_memory_init (&mem->gl_mem, _io_surface_memory_allocator, NULL, context,
|
||||
target, NULL, info, plane, valign, user_data, notify);
|
||||
target, tex_type, NULL, info, plane, valign, user_data, notify);
|
||||
|
||||
GST_MINI_OBJECT_FLAG_SET (mem, GST_MEMORY_FLAG_READONLY);
|
||||
|
||||
|
@ -184,11 +185,12 @@ GstIOSurfaceMemory *
|
|||
gst_io_surface_memory_wrapped (GstGLContext * context,
|
||||
IOSurfaceRef surface,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
GstVideoAlignment * valign, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
return _io_surface_memory_new (context, surface, target, info,
|
||||
return _io_surface_memory_new (context, surface, target, tex_type, info,
|
||||
plane, valign, user_data, notify);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ GstIOSurfaceMemory *
|
|||
gst_io_surface_memory_wrapped (GstGLContext * context,
|
||||
IOSurfaceRef surface,
|
||||
GstGLTextureTarget target,
|
||||
GstVideoGLTextureType tex_type,
|
||||
GstVideoInfo * info,
|
||||
guint plane,
|
||||
GstVideoAlignment *valign,
|
||||
|
|
|
@ -171,8 +171,8 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
|
|||
gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
|
||||
params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx,
|
||||
NULL, &cache->input_info, 0, NULL, gl_target,
|
||||
CVOpenGLESTextureGetName (texture), texture,
|
||||
(GDestroyNotify) CFRelease);
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, CVOpenGLESTextureGetName (texture),
|
||||
texture, (GDestroyNotify) CFRelease);
|
||||
|
||||
gst_buffer_replace_memory (output_buffer, 0,
|
||||
(GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
|
@ -197,7 +197,7 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
|
|||
|
||||
gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
|
||||
params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx,
|
||||
NULL, &cache->input_info, 0, NULL, gl_target,
|
||||
NULL, &cache->input_info, 0, NULL, gl_target, textype,
|
||||
CVOpenGLESTextureGetName (texture), texture,
|
||||
(GDestroyNotify) CFRelease);
|
||||
|
||||
|
@ -219,7 +219,7 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
|
|||
|
||||
gl_target = gst_gl_texture_target_from_gl (CVOpenGLESTextureGetTarget (texture));
|
||||
params = gst_gl_video_allocation_params_new_wrapped_texture (cache->ctx,
|
||||
NULL, &cache->input_info, 1, NULL, gl_target,
|
||||
NULL, &cache->input_info, 1, NULL, gl_target, textype,
|
||||
CVOpenGLESTextureGetName (texture), texture,
|
||||
(GDestroyNotify) CFRelease);
|
||||
|
||||
|
@ -255,11 +255,14 @@ _do_get_gl_buffer (GstGLContext * context, ContextThreadData * data)
|
|||
gst_buffer_copy_into (data->output_buffer, data->input_buffer, GST_BUFFER_COPY_ALL, 0, -1);
|
||||
for (int i = 0; i < GST_VIDEO_INFO_N_PLANES (&cache->input_info); i++) {
|
||||
GstIOSurfaceMemory *mem;
|
||||
GstVideoGLTextureType tex_type =
|
||||
gst_gl_texture_type_from_format (context,
|
||||
GST_VIDEO_INFO_FORMAT (&cache->input_info), i);
|
||||
|
||||
CFRetain (pixel_buf);
|
||||
mem = gst_io_surface_memory_wrapped (cache->ctx,
|
||||
surface, GST_GL_TEXTURE_TARGET_RECTANGLE, &cache->input_info,
|
||||
i, NULL, pixel_buf, (GDestroyNotify) CFRelease);
|
||||
surface, GST_GL_TEXTURE_TARGET_RECTANGLE, tex_type,
|
||||
&cache->input_info, i, NULL, pixel_buf, (GDestroyNotify) CFRelease);
|
||||
|
||||
gst_buffer_replace_memory (data->output_buffer, i, (GstMemory *) mem);
|
||||
}
|
||||
|
|
|
@ -141,13 +141,15 @@ check_conversion (TestFrame * frames, guint size)
|
|||
/* create GL buffer */
|
||||
inbuf = gst_buffer_new ();
|
||||
for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&in_info); j++) {
|
||||
GstVideoGLTextureType tex_type = gst_gl_texture_type_from_format (context,
|
||||
GST_VIDEO_INFO_FORMAT (&in_info), j);
|
||||
GstGLVideoAllocationParams *params;
|
||||
GstGLBaseMemory *mem;
|
||||
|
||||
ref_count++;
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&in_info, j, NULL, GST_GL_TEXTURE_TARGET_2D, frames[i].data[j],
|
||||
&ref_count, _frame_unref);
|
||||
&in_info, j, NULL, GST_GL_TEXTURE_TARGET_2D, tex_type,
|
||||
frames[i].data[j], &ref_count, _frame_unref);
|
||||
|
||||
mem = gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
|
|
@ -72,7 +72,7 @@ init (gpointer data)
|
|||
allocator = gst_gl_memory_allocator_get_default (context);
|
||||
params =
|
||||
gst_gl_video_allocation_params_new (context, NULL, &v_info, 0, NULL,
|
||||
GST_GL_TEXTURE_TARGET_2D);
|
||||
GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
|
||||
/* has to be called in the thread that is going to use the framebuffer */
|
||||
fbo = gst_gl_framebuffer_new (context);
|
||||
|
|
|
@ -75,10 +75,12 @@ GST_START_TEST (test_basic)
|
|||
gst_video_info_set_format (&v_info, formats[i], width, height);
|
||||
|
||||
for (j = 0; j < GST_VIDEO_INFO_N_PLANES (&v_info); j++) {
|
||||
GstVideoGLTextureType tex_type = gst_gl_texture_type_from_format (context,
|
||||
GST_VIDEO_INFO_FORMAT (&v_info), j);
|
||||
GstGLVideoAllocationParams *params;
|
||||
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &v_info, j,
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D);
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, tex_type);
|
||||
|
||||
mem = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -137,7 +139,7 @@ test_transfer_allocator (const gchar * allocator_name)
|
|||
gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 1, 1);
|
||||
|
||||
params = gst_gl_video_allocation_params_new (context, NULL, &v_info, 0,
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D);
|
||||
NULL, GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA);
|
||||
|
||||
/* texture creation */
|
||||
mem = (GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
|
@ -150,7 +152,8 @@ test_transfer_allocator (const gchar * allocator_name)
|
|||
|
||||
/* test wrapping raw data */
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, rgba_pixel, NULL, NULL);
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, rgba_pixel, NULL, NULL);
|
||||
mem2 =
|
||||
(GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -164,8 +167,9 @@ test_transfer_allocator (const gchar * allocator_name)
|
|||
|
||||
/* wrapped texture creation */
|
||||
params = gst_gl_video_allocation_params_new_wrapped_texture (context, NULL,
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, ((GstGLMemory *) mem)->tex_id,
|
||||
NULL, NULL);
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, ((GstGLMemory *) mem)->tex_id, NULL,
|
||||
NULL);
|
||||
mem3 =
|
||||
(GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
@ -303,7 +307,8 @@ GST_START_TEST (test_separate_transfer)
|
|||
gst_video_info_set_format (&v_info, GST_VIDEO_FORMAT_RGBA, 1, 1);
|
||||
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, rgba_pixel, NULL, NULL);
|
||||
&v_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, rgba_pixel, NULL, NULL);
|
||||
mem =
|
||||
(GstMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
|
|
|
@ -217,7 +217,8 @@ GST_START_TEST (test_upload_buffer)
|
|||
/* create GL buffer */
|
||||
buffer = gst_buffer_new ();
|
||||
params = gst_gl_video_allocation_params_new_wrapped_data (context, NULL,
|
||||
&in_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D, rgba_data, NULL, NULL);
|
||||
&in_info, 0, NULL, GST_GL_TEXTURE_TARGET_2D,
|
||||
GST_VIDEO_GL_TEXTURE_TYPE_RGBA, rgba_data, NULL, NULL);
|
||||
gl_mem = (GstGLMemory *) gst_gl_base_memory_alloc (base_mem_alloc,
|
||||
(GstGLAllocationParams *) params);
|
||||
gst_gl_allocation_params_free ((GstGLAllocationParams *) params);
|
||||
|
|
Loading…
Reference in a new issue