GstCaps *caps;
gboolean need_pool;
guint size;
- GstAllocationParams params = { 0, };
+ GstAllocator *allocator;
+ GstAllocationParams params;
eglglessink = GST_EGLGLESSINK (bsink);
+ gst_allocation_params_init (¶ms);
+
gst_query_parse_allocation (query, &caps, &need_pool);
if (!caps) {
GST_ERROR_OBJECT (eglglessink, "allocation query without caps");
gst_object_unref (pool);
}
+ /* First the default allocator */
+ if (!gst_egl_image_memory_is_mappable ()) {
+ allocator = gst_allocator_find (NULL);
+ gst_query_add_allocation_param (query, allocator, ¶ms);
+ gst_object_unref (allocator);
+ }
+
+ allocator = gst_egl_image_allocator_obtain ();
+ if (!gst_egl_image_memory_is_mappable ())
+ params.flags |= GST_MEMORY_FLAG_NOT_MAPPABLE;
+ gst_query_add_allocation_param (query, allocator, ¶ms);
+ gst_object_unref (allocator);
+
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE, NULL);
GstEglGlesSink *sink;
GstAllocator *allocator;
+ GstAllocationParams params;
GstVideoInfo info;
gboolean add_metavideo;
gboolean want_eglimage;
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
- (gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
- size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
+ (gst_egl_image_memory_is_mappable ()? 0 :
+ GST_MEMORY_FLAG_NOT_MAPPABLE), size, data,
+ (GDestroyNotify) gst_egl_gles_image_data_free);
n_mem = 1;
}
break;
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
- (gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
- size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
+ (gst_egl_image_memory_is_mappable ()? 0 :
+ GST_MEMORY_FLAG_NOT_MAPPABLE), size, data,
+ (GDestroyNotify) gst_egl_gles_image_data_free);
n_mem = 1;
}
break;
(i ==
0 ? GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE :
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE_ALPHA),
- (gst_egl_image_memory_can_map ()? 0 :
+ (gst_egl_image_memory_is_mappable ()? 0 :
GST_MEMORY_FLAG_NOT_MAPPABLE), size[i], data,
(GDestroyNotify) gst_egl_gles_image_data_free);
}
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
image, GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE,
- (gst_egl_image_memory_can_map ()? 0 :
+ (gst_egl_image_memory_is_mappable ()? 0 :
GST_MEMORY_FLAG_NOT_MAPPABLE), size[i], data,
(GDestroyNotify) gst_egl_gles_image_data_free);
}
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
image, GST_EGL_IMAGE_MEMORY_TYPE_RGBA,
- (gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
- size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
+ (gst_egl_image_memory_is_mappable ()? 0 :
+ GST_MEMORY_FLAG_NOT_MAPPABLE), size, data,
+ (GDestroyNotify) gst_egl_gles_image_data_free);
n_mem = 1;
}
static const gchar **
gst_egl_image_buffer_pool_get_options (GstBufferPool * bpool)
{
- static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META,
- GST_BUFFER_POOL_OPTION_EGL_IMAGE, NULL
+ static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META, NULL
};
return options;
if (!gst_video_info_from_caps (&info, caps))
return FALSE;
+ if (!gst_buffer_pool_config_get_allocator (config, &pool->allocator,
+ &pool->params))
+ return FALSE;
+
pool->add_metavideo =
gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
- pool->want_eglimage =
- gst_buffer_pool_config_has_option (config,
- GST_BUFFER_POOL_OPTION_EGL_IMAGE);
-
- pool->allocator = gst_egl_image_allocator_obtain ();
+ pool->want_eglimage = (pool->allocator
+ && g_strcmp0 (pool->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
pool->info = info;
*buffer = NULL;
- if (!pool->add_metavideo || (!gst_egl_image_memory_can_map ()
- && !pool->want_eglimage))
+ if (!pool->add_metavideo || !pool->want_eglimage)
return
GST_BUFFER_POOL_CLASS
(gst_egl_image_buffer_pool_parent_class)->alloc_buffer (bpool,