eglglessink: Handle copying of GstMemory properly

We have to use the default video meta mapping functions.
This commit is contained in:
Sebastian Dröge 2013-01-03 15:22:38 +01:00
parent f5ef0dd7ee
commit 2aefc09248
3 changed files with 20 additions and 6 deletions

View file

@ -3303,6 +3303,11 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
gst_buffer_add_video_meta_full (buffer, 0, format, width, height,
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->unmap = eglglessink->eglglesctx.eglimage_video_unmap;

View file

@ -61,6 +61,9 @@
GST_DEBUG_CATEGORY_STATIC (eglgles_platform_wrapper);
#define GST_CAT_DEFAULT eglgles_platform_wrapper
PlatformMapVideo default_map_video;
PlatformUnmapVideo default_unmap_video;
/* XXX: Likely to be removed */
gboolean
platform_wrapper_init (void)
@ -345,11 +348,12 @@ eglimage_video_map (GstVideoMeta * meta, guint plane,
GstEGLImageMemory *mem;
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);
g_return_val_if_fail (strcmp (gmem->allocator->mem_type,
GST_EGL_IMAGE_MEMORY_NAME) == 0, FALSE);
if (strcmp (gmem->allocator->mem_type, GST_EGL_IMAGE_MEMORY_NAME) != 0)
return default_map_video (meta, plane, info, data, stride, flags);
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
};
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);
g_return_val_if_fail (strcmp (gmem->allocator->mem_type,
GST_EGL_IMAGE_MEMORY_NAME) == 0, FALSE);
if (strcmp (gmem->allocator->mem_type, GST_EGL_IMAGE_MEMORY_NAME) != 0)
return default_unmap_video (meta, plane, info);
mem = GST_EGL_IMAGE_MEMORY ((gmem->parent ? gmem->parent : gmem));
g_mutex_lock (&mem->lock);

View file

@ -95,6 +95,9 @@ typedef struct
typedef gboolean (*PlatformMapVideo) (GstVideoMeta *meta, guint plane, GstMapInfo *info, gpointer *data, gint * stride, GstMapFlags flags);
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_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);