eglglessink: Handle copying of GstMemory properly
We have to use the default video meta mapping functions.
This commit is contained in:
parent
f5ef0dd7ee
commit
2aefc09248
@ -3303,6 +3303,11 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||||||
gst_buffer_add_video_meta_full (buffer, 0, format, width, height,
|
gst_buffer_add_video_meta_full (buffer, 0, format, width, height,
|
||||||
mem->n_textures, offset, stride);
|
mem->n_textures, offset, stride);
|
||||||
|
|
||||||
|
if (!default_map_video) {
|
||||||
|
default_map_video = meta->map;
|
||||||
|
default_unmap_video = meta->unmap;
|
||||||
|
}
|
||||||
|
|
||||||
meta->map = eglglessink->eglglesctx.eglimage_video_map;
|
meta->map = eglglessink->eglglesctx.eglimage_video_map;
|
||||||
meta->unmap = eglglessink->eglglesctx.eglimage_video_unmap;
|
meta->unmap = eglglessink->eglglesctx.eglimage_video_unmap;
|
||||||
|
|
||||||
|
@ -61,6 +61,9 @@
|
|||||||
GST_DEBUG_CATEGORY_STATIC (eglgles_platform_wrapper);
|
GST_DEBUG_CATEGORY_STATIC (eglgles_platform_wrapper);
|
||||||
#define GST_CAT_DEFAULT eglgles_platform_wrapper
|
#define GST_CAT_DEFAULT eglgles_platform_wrapper
|
||||||
|
|
||||||
|
PlatformMapVideo default_map_video;
|
||||||
|
PlatformUnmapVideo default_unmap_video;
|
||||||
|
|
||||||
/* XXX: Likely to be removed */
|
/* XXX: Likely to be removed */
|
||||||
gboolean
|
gboolean
|
||||||
platform_wrapper_init (void)
|
platform_wrapper_init (void)
|
||||||
@ -345,11 +348,12 @@ eglimage_video_map (GstVideoMeta * meta, guint plane,
|
|||||||
GstEGLImageMemory *mem;
|
GstEGLImageMemory *mem;
|
||||||
GstVideoInfo vinfo;
|
GstVideoInfo vinfo;
|
||||||
|
|
||||||
g_return_val_if_fail (gst_buffer_n_memory (meta->buffer) == 1, FALSE);
|
if (gst_buffer_n_memory (meta->buffer) != 1)
|
||||||
|
return default_map_video (meta, plane, info, data, stride, flags);
|
||||||
|
|
||||||
gmem = gst_buffer_peek_memory (meta->buffer, 0);
|
gmem = gst_buffer_peek_memory (meta->buffer, 0);
|
||||||
g_return_val_if_fail (strcmp (gmem->allocator->mem_type,
|
if (strcmp (gmem->allocator->mem_type, GST_EGL_IMAGE_MEMORY_NAME) != 0)
|
||||||
GST_EGL_IMAGE_MEMORY_NAME) == 0, FALSE);
|
return default_map_video (meta, plane, info, data, stride, flags);
|
||||||
|
|
||||||
mem = GST_EGL_IMAGE_MEMORY ((gmem->parent ? gmem->parent : gmem));
|
mem = GST_EGL_IMAGE_MEMORY ((gmem->parent ? gmem->parent : gmem));
|
||||||
|
|
||||||
@ -446,11 +450,13 @@ eglimage_video_unmap (GstVideoMeta * meta, guint plane, GstMapInfo * info)
|
|||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
g_return_val_if_fail (gst_buffer_n_memory (meta->buffer) == 1, FALSE);
|
if (gst_buffer_n_memory (meta->buffer) != 1)
|
||||||
|
return default_unmap_video (meta, plane, info);
|
||||||
|
|
||||||
gmem = gst_buffer_peek_memory (meta->buffer, 0);
|
gmem = gst_buffer_peek_memory (meta->buffer, 0);
|
||||||
g_return_val_if_fail (strcmp (gmem->allocator->mem_type,
|
if (strcmp (gmem->allocator->mem_type, GST_EGL_IMAGE_MEMORY_NAME) != 0)
|
||||||
GST_EGL_IMAGE_MEMORY_NAME) == 0, FALSE);
|
return default_unmap_video (meta, plane, info);
|
||||||
|
|
||||||
mem = GST_EGL_IMAGE_MEMORY ((gmem->parent ? gmem->parent : gmem));
|
mem = GST_EGL_IMAGE_MEMORY ((gmem->parent ? gmem->parent : gmem));
|
||||||
|
|
||||||
g_mutex_lock (&mem->lock);
|
g_mutex_lock (&mem->lock);
|
||||||
|
@ -95,6 +95,9 @@ typedef struct
|
|||||||
typedef gboolean (*PlatformMapVideo) (GstVideoMeta *meta, guint plane, GstMapInfo *info, gpointer *data, gint * stride, GstMapFlags flags);
|
typedef gboolean (*PlatformMapVideo) (GstVideoMeta *meta, guint plane, GstMapInfo *info, gpointer *data, gint * stride, GstMapFlags flags);
|
||||||
typedef gboolean (*PlatformUnmapVideo) (GstVideoMeta *meta, guint plane, GstMapInfo *info);
|
typedef gboolean (*PlatformUnmapVideo) (GstVideoMeta *meta, guint plane, GstMapInfo *info);
|
||||||
|
|
||||||
|
extern PlatformMapVideo default_map_video;
|
||||||
|
extern PlatformUnmapVideo default_unmap_video;
|
||||||
|
|
||||||
gboolean platform_can_map_eglimage (GstMemoryMapFunction *map, GstMemoryUnmapFunction *unmap, PlatformMapVideo *video_map, PlatformUnmapVideo *video_unmap);
|
gboolean platform_can_map_eglimage (GstMemoryMapFunction *map, GstMemoryUnmapFunction *unmap, PlatformMapVideo *video_map, PlatformUnmapVideo *video_unmap);
|
||||||
gboolean platform_has_custom_eglimage_alloc (void);
|
gboolean platform_has_custom_eglimage_alloc (void);
|
||||||
gboolean platform_alloc_eglimage (EGLDisplay display, EGLContext context, GLint format, GLint type, gint width, gint height, GLuint tex_id, EGLImageKHR *image, gpointer *image_platform_data);
|
gboolean platform_alloc_eglimage (EGLDisplay display, EGLContext context, GLint format, GLint type, gint width, gint height, GLuint tex_id, EGLImageKHR *image, gpointer *image_platform_data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user