(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);
(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);
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
*) 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)
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;
}
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;
}
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)
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,
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;
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);
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 "
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;
}
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;
}
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);
* @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
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;
}
_gst_gl_video_allocation_params_set_video_alignment (params, valign);
params->target = target;
+ params->tex_type = tex_type;
params->plane = plane;
return TRUE;
/**
* 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
*
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);
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;
}
* @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
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);
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;
}
* @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
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);
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;
}
* @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
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);
}
/**
_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;
}
* @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
*
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;
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);
guint plane;
GstVideoAlignment *valign;
GstGLTextureTarget target;
+ GstVideoGLTextureType tex_type;
};
gboolean gst_gl_video_allocation_params_init_full (GstGLVideoAllocationParams * params,
guint plane,
GstVideoAlignment * valign,
GstGLTextureTarget target,
+ GstVideoGLTextureType tex_type,
gpointer wrapped_data,
gpointer gl_handle,
gpointer user_data,
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);
guint plane,
GstVideoAlignment * valign,
GstGLTextureTarget target,
+ GstVideoGLTextureType tex_type,
guint tex_id,
gpointer user_data,
GDestroyNotify notify);
guint plane,
GstVideoAlignment * valign,
GstGLTextureTarget target,
+ GstVideoGLTextureType tex_type,
gpointer gl_handle,
gpointer user_data,
GDestroyNotify notify);
GstMemory * parent,
GstGLContext * context,
GstGLTextureTarget target,
+ GstVideoGLTextureType tex_type,
GstAllocationParams *params,
GstVideoInfo * info,
guint plane,
gboolean gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
GstBuffer * buffer,
GstGLVideoAllocationParams * params,
+ GstVideoGLTextureType *tex_types,
gpointer *wrapped_data,
gsize n_wrapped_pointers);
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)
{
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,
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;
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);
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,
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);
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 */
/* 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);
}
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) {
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 =
/* 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++) {
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;
(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;
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,
/* 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);
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);
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);
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,
/* 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);
/* 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);
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);
/* 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);