mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
eglglessink: change pool->sink->last_buffer to pool->last_buffer
So that GstEGLImageBufferPool does not depend on GstEglGlesSink The goal is still to move it into gstegl lib
This commit is contained in:
parent
fdaa26e1c8
commit
3a84875294
1 changed files with 30 additions and 20 deletions
|
@ -222,13 +222,12 @@ typedef struct
|
||||||
{
|
{
|
||||||
GstVideoBufferPool parent;
|
GstVideoBufferPool parent;
|
||||||
|
|
||||||
GstEglGlesSink *sink;
|
|
||||||
GstAllocator *allocator;
|
GstAllocator *allocator;
|
||||||
GstAllocationParams params;
|
GstAllocationParams params;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
gboolean add_metavideo;
|
gboolean add_metavideo;
|
||||||
gboolean want_eglimage;
|
gboolean want_eglimage;
|
||||||
|
GstBuffer *last_buffer;
|
||||||
GstEGLImageBufferPoolSendBlockingAllocate send_blocking_allocate_func;
|
GstEGLImageBufferPoolSendBlockingAllocate send_blocking_allocate_func;
|
||||||
gpointer send_blocking_allocate_data;
|
gpointer send_blocking_allocate_data;
|
||||||
GDestroyNotify send_blocking_allocate_destroy;
|
GDestroyNotify send_blocking_allocate_destroy;
|
||||||
|
@ -243,10 +242,10 @@ GType gst_egl_image_buffer_pool_get_type (void);
|
||||||
G_DEFINE_TYPE (GstEGLImageBufferPool, gst_egl_image_buffer_pool,
|
G_DEFINE_TYPE (GstEGLImageBufferPool, gst_egl_image_buffer_pool,
|
||||||
GST_TYPE_VIDEO_BUFFER_POOL);
|
GST_TYPE_VIDEO_BUFFER_POOL);
|
||||||
|
|
||||||
static GstBufferPool *gst_egl_image_buffer_pool_new (GstEglGlesSink *
|
static GstBufferPool
|
||||||
eglglessink,
|
* gst_egl_image_buffer_pool_new (GstEGLImageBufferPoolSendBlockingAllocate
|
||||||
GstEGLImageBufferPoolSendBlockingAllocate blocking_allocate_func,
|
blocking_allocate_func, gpointer blocking_allocate_data,
|
||||||
gpointer blocking_allocate_data, GDestroyNotify destroy_func);
|
GDestroyNotify destroy_func);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_egl_image_buffer_pool_get_video_infos (GstEGLImageBufferPool * pool,
|
gst_egl_image_buffer_pool_get_video_infos (GstEGLImageBufferPool * pool,
|
||||||
|
@ -264,6 +263,15 @@ gst_egl_image_buffer_pool_get_video_infos (GstEGLImageBufferPool * pool,
|
||||||
*height = pool->info.height;
|
*height = pool->info.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_egl_image_buffer_pool_replace_last_buffer (GstEGLImageBufferPool * pool,
|
||||||
|
GstBuffer * buffer)
|
||||||
|
{
|
||||||
|
g_return_if_fail (pool != NULL);
|
||||||
|
|
||||||
|
gst_buffer_replace (&pool->last_buffer, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_eglglessink_egl_image_buffer_pool_send_blocking (GstBufferPool * bpool,
|
gst_eglglessink_egl_image_buffer_pool_send_blocking (GstBufferPool * bpool,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -440,7 +448,7 @@ gst_egl_image_buffer_pool_acquire_buffer (GstBufferPool * bpool,
|
||||||
/* XXX: Don't return the memory we just rendered, glEGLImageTargetTexture2DOES()
|
/* XXX: Don't return the memory we just rendered, glEGLImageTargetTexture2DOES()
|
||||||
* keeps the EGLImage unmappable until the next one is uploaded
|
* keeps the EGLImage unmappable until the next one is uploaded
|
||||||
*/
|
*/
|
||||||
if (*buffer && *buffer == pool->sink->last_buffer) {
|
if (*buffer && *buffer == pool->last_buffer) {
|
||||||
GstBuffer *oldbuf = *buffer;
|
GstBuffer *oldbuf = *buffer;
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
|
@ -463,9 +471,7 @@ gst_egl_image_buffer_pool_finalize (GObject * object)
|
||||||
gst_object_unref (pool->allocator);
|
gst_object_unref (pool->allocator);
|
||||||
pool->allocator = NULL;
|
pool->allocator = NULL;
|
||||||
|
|
||||||
if (pool->sink)
|
gst_egl_image_buffer_pool_replace_last_buffer (pool, NULL);
|
||||||
gst_object_unref (pool->sink);
|
|
||||||
pool->sink = NULL;
|
|
||||||
|
|
||||||
if (pool->send_blocking_allocate_destroy)
|
if (pool->send_blocking_allocate_destroy)
|
||||||
pool->send_blocking_allocate_destroy (pool->send_blocking_allocate_data);
|
pool->send_blocking_allocate_destroy (pool->send_blocking_allocate_data);
|
||||||
|
@ -723,7 +729,9 @@ gst_eglglessink_stop (GstEglGlesSink * eglglessink)
|
||||||
}
|
}
|
||||||
eglglessink->last_flow = GST_FLOW_FLUSHING;
|
eglglessink->last_flow = GST_FLOW_FLUSHING;
|
||||||
|
|
||||||
gst_buffer_replace (&eglglessink->last_buffer, NULL);
|
if (eglglessink->pool)
|
||||||
|
gst_egl_image_buffer_pool_replace_last_buffer (GST_EGL_IMAGE_BUFFER_POOL
|
||||||
|
(eglglessink->pool), NULL);
|
||||||
|
|
||||||
if (eglglessink->using_own_window) {
|
if (eglglessink->using_own_window) {
|
||||||
gst_egl_adaptation_destroy_native_window (eglglessink->egl_context,
|
gst_egl_adaptation_destroy_native_window (eglglessink->egl_context,
|
||||||
|
@ -1615,7 +1623,9 @@ gst_eglglessink_upload (GstEglGlesSink * eglglessink, GstBuffer * buf)
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gst_buffer_replace (&eglglessink->last_buffer, buf);
|
if (eglglessink->pool)
|
||||||
|
gst_egl_image_buffer_pool_replace_last_buffer (GST_EGL_IMAGE_BUFFER_POOL
|
||||||
|
(eglglessink->pool), buf);
|
||||||
eglglessink->stride[0] = 1;
|
eglglessink->stride[0] = 1;
|
||||||
eglglessink->stride[1] = 1;
|
eglglessink->stride[1] = 1;
|
||||||
eglglessink->stride[2] = 1;
|
eglglessink->stride[2] = 1;
|
||||||
|
@ -2041,8 +2051,8 @@ gst_eglglessink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (eglglessink, "create new pool");
|
GST_DEBUG_OBJECT (eglglessink, "create new pool");
|
||||||
pool =
|
pool =
|
||||||
gst_egl_image_buffer_pool_new (eglglessink,
|
gst_egl_image_buffer_pool_new
|
||||||
gst_eglglessink_egl_image_buffer_pool_send_blocking,
|
(gst_eglglessink_egl_image_buffer_pool_send_blocking,
|
||||||
gst_object_ref (eglglessink),
|
gst_object_ref (eglglessink),
|
||||||
gst_eglglessink_egl_image_buffer_pool_on_destroy);
|
gst_eglglessink_egl_image_buffer_pool_on_destroy);
|
||||||
|
|
||||||
|
@ -2195,8 +2205,8 @@ gst_eglglessink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
||||||
}
|
}
|
||||||
|
|
||||||
newpool =
|
newpool =
|
||||||
gst_egl_image_buffer_pool_new (eglglessink,
|
gst_egl_image_buffer_pool_new
|
||||||
gst_eglglessink_egl_image_buffer_pool_send_blocking,
|
(gst_eglglessink_egl_image_buffer_pool_send_blocking,
|
||||||
gst_object_ref (eglglessink),
|
gst_object_ref (eglglessink),
|
||||||
gst_eglglessink_egl_image_buffer_pool_on_destroy);
|
gst_eglglessink_egl_image_buffer_pool_on_destroy);
|
||||||
config = gst_buffer_pool_get_config (newpool);
|
config = gst_buffer_pool_get_config (newpool);
|
||||||
|
@ -2469,14 +2479,14 @@ gst_eglglessink_init (GstEglGlesSink * eglglessink)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBufferPool *
|
static GstBufferPool *
|
||||||
gst_egl_image_buffer_pool_new (GstEglGlesSink * eglglessink,
|
gst_egl_image_buffer_pool_new (GstEGLImageBufferPoolSendBlockingAllocate
|
||||||
GstEGLImageBufferPoolSendBlockingAllocate blocking_allocate_func,
|
blocking_allocate_func, gpointer blocking_allocate_data,
|
||||||
gpointer blocking_allocate_data, GDestroyNotify destroy_func)
|
GDestroyNotify destroy_func)
|
||||||
{
|
{
|
||||||
GstEGLImageBufferPool *pool;
|
GstEGLImageBufferPool *pool;
|
||||||
|
|
||||||
pool = g_object_new (gst_egl_image_buffer_pool_get_type (), NULL);
|
pool = g_object_new (gst_egl_image_buffer_pool_get_type (), NULL);
|
||||||
pool->sink = gst_object_ref (eglglessink);
|
pool->last_buffer = NULL;
|
||||||
pool->send_blocking_allocate_func = blocking_allocate_func;
|
pool->send_blocking_allocate_func = blocking_allocate_func;
|
||||||
pool->send_blocking_allocate_data = blocking_allocate_data;
|
pool->send_blocking_allocate_data = blocking_allocate_data;
|
||||||
pool->send_blocking_allocate_destroy = destroy_func;
|
pool->send_blocking_allocate_destroy = destroy_func;
|
||||||
|
|
Loading…
Reference in a new issue