mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
glbufferpool: provide a consistent API regardless of platform
This commit is contained in:
parent
c399908c4b
commit
ec8f3e58de
2 changed files with 11 additions and 14 deletions
|
@ -51,10 +51,8 @@ struct _GstGLBufferPoolPrivate
|
||||||
gint im_format;
|
gint im_format;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
gboolean add_videometa;
|
gboolean add_videometa;
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
|
||||||
gboolean want_eglimage;
|
gboolean want_eglimage;
|
||||||
GstBuffer *last_buffer;
|
GstBuffer *last_buffer;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gst_gl_buffer_pool_finalize (GObject * object);
|
static void gst_gl_buffer_pool_finalize (GObject * object);
|
||||||
|
@ -129,6 +127,8 @@ gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
#if GST_GL_HAVE_PLATFORM_EGL
|
||||||
priv->want_eglimage = (priv->allocator
|
priv->want_eglimage = (priv->allocator
|
||||||
&& g_strcmp0 (priv->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
|
&& g_strcmp0 (priv->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
|
||||||
|
#else
|
||||||
|
priv->want_eglimage = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
|
@ -228,6 +228,7 @@ mem_create_failed:
|
||||||
GST_WARNING_OBJECT (pool, "Could not create GL Memory");
|
GST_WARNING_OBJECT (pool, "Could not create GL Memory");
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
#if GST_GL_HAVE_PLATFORM_EGL
|
||||||
egl_image_mem_create_failed:
|
egl_image_mem_create_failed:
|
||||||
{
|
{
|
||||||
|
@ -243,9 +244,7 @@ gst_gl_buffer_pool_acquire_buffer (GstBufferPool * bpool,
|
||||||
GstBuffer ** buffer, GstBufferPoolAcquireParams * params)
|
GstBuffer ** buffer, GstBufferPoolAcquireParams * params)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
|
||||||
GstGLBufferPool *glpool = NULL;
|
GstGLBufferPool *glpool = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
ret =
|
ret =
|
||||||
GST_BUFFER_POOL_CLASS
|
GST_BUFFER_POOL_CLASS
|
||||||
|
@ -253,7 +252,6 @@ gst_gl_buffer_pool_acquire_buffer (GstBufferPool * bpool,
|
||||||
if (ret != GST_FLOW_OK || !*buffer)
|
if (ret != GST_FLOW_OK || !*buffer)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
|
||||||
glpool = GST_GL_BUFFER_POOL (bpool);
|
glpool = GST_GL_BUFFER_POOL (bpool);
|
||||||
|
|
||||||
/* XXX: Don't return the memory we just rendered, glEGLImageTargetTexture2DOES()
|
/* XXX: Don't return the memory we just rendered, glEGLImageTargetTexture2DOES()
|
||||||
|
@ -270,7 +268,6 @@ gst_gl_buffer_pool_acquire_buffer (GstBufferPool * bpool,
|
||||||
gst_object_replace ((GstObject **) & oldbuf->pool, (GstObject *) glpool);
|
gst_object_replace ((GstObject **) & oldbuf->pool, (GstObject *) glpool);
|
||||||
gst_buffer_unref (oldbuf);
|
gst_buffer_unref (oldbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -294,7 +291,14 @@ gst_gl_buffer_pool_new (GstGLContext * context)
|
||||||
return GST_BUFFER_POOL_CAST (pool);
|
return GST_BUFFER_POOL_CAST (pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
/**
|
||||||
|
* gst_gl_buffer_pool_replace_last_buffer:
|
||||||
|
* @pool: a #GstGLBufferPool
|
||||||
|
* @buffer: a #GstBuffer
|
||||||
|
*
|
||||||
|
* Set @pool<-- -->s last buffer to @buffer for #GstGLPlatform<-- -->s that
|
||||||
|
* require it.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
gst_gl_buffer_pool_replace_last_buffer (GstGLBufferPool * pool,
|
gst_gl_buffer_pool_replace_last_buffer (GstGLBufferPool * pool,
|
||||||
GstBuffer * buffer)
|
GstBuffer * buffer)
|
||||||
|
@ -304,7 +308,6 @@ gst_gl_buffer_pool_replace_last_buffer (GstGLBufferPool * pool,
|
||||||
|
|
||||||
gst_buffer_replace (&pool->priv->last_buffer, buffer);
|
gst_buffer_replace (&pool->priv->last_buffer, buffer);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_buffer_pool_class_init (GstGLBufferPoolClass * klass)
|
gst_gl_buffer_pool_class_init (GstGLBufferPoolClass * klass)
|
||||||
|
@ -335,10 +338,8 @@ gst_gl_buffer_pool_init (GstGLBufferPool * pool)
|
||||||
priv->caps = NULL;
|
priv->caps = NULL;
|
||||||
priv->im_format = GST_VIDEO_FORMAT_UNKNOWN;
|
priv->im_format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
priv->add_videometa = TRUE;
|
priv->add_videometa = TRUE;
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
|
||||||
priv->want_eglimage = FALSE;
|
priv->want_eglimage = FALSE;
|
||||||
priv->last_buffer = FALSE;
|
priv->last_buffer = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
gst_video_info_init (&priv->info);
|
gst_video_info_init (&priv->info);
|
||||||
gst_allocation_params_init (&priv->params);
|
gst_allocation_params_init (&priv->params);
|
||||||
|
@ -352,9 +353,7 @@ gst_gl_buffer_pool_finalize (GObject * object)
|
||||||
|
|
||||||
GST_LOG_OBJECT (pool, "finalize GL buffer pool %p", pool);
|
GST_LOG_OBJECT (pool, "finalize GL buffer pool %p", pool);
|
||||||
|
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
|
||||||
gst_buffer_replace (&pool->priv->last_buffer, NULL);
|
gst_buffer_replace (&pool->priv->last_buffer, NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (priv->caps)
|
if (priv->caps)
|
||||||
gst_caps_unref (priv->caps);
|
gst_caps_unref (priv->caps);
|
||||||
|
|
|
@ -66,10 +66,8 @@ struct _GstGLBufferPoolClass
|
||||||
};
|
};
|
||||||
|
|
||||||
GstBufferPool *gst_gl_buffer_pool_new (GstGLContext * context);
|
GstBufferPool *gst_gl_buffer_pool_new (GstGLContext * context);
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
|
||||||
void gst_gl_buffer_pool_replace_last_buffer (GstGLBufferPool * pool,
|
void gst_gl_buffer_pool_replace_last_buffer (GstGLBufferPool * pool,
|
||||||
GstBuffer * buffer);
|
GstBuffer * buffer);
|
||||||
#endif
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue