2012-07-06 09:05:03 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2012 Matthew Waters <>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-08 11:53:56 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2012-07-06 09:05:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2013-07-10 15:03:04 +00:00
|
|
|
#include "gl.h"
|
2012-07-06 09:05:03 +00:00
|
|
|
#include "gstglbufferpool.h"
|
2014-12-19 17:11:08 +00:00
|
|
|
#include "gstglutils.h"
|
2012-07-06 09:05:03 +00:00
|
|
|
|
2014-03-22 22:01:49 +00:00
|
|
|
#if GST_GL_HAVE_PLATFORM_EGL
|
|
|
|
#include <gst/gl/egl/gsteglimagememory.h>
|
|
|
|
#endif
|
|
|
|
|
2012-09-27 05:53:46 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstglbufferpool
|
|
|
|
* @short_description: buffer pool for #GstGLMemory objects
|
|
|
|
* @see_also: #GstBufferPool, #GstGLMemory
|
|
|
|
*
|
|
|
|
* a #GstGLBufferPool is an object that allocates buffers with #GstGLMemory
|
|
|
|
*
|
|
|
|
* A #GstGLBufferPool is created with gst_gl_buffer_pool_new()
|
|
|
|
*
|
|
|
|
* #GstGLBufferPool implements the VideoMeta buffer pool option
|
|
|
|
* #GST_BUFFER_POOL_OPTION_VIDEO_META
|
|
|
|
*/
|
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
/* bufferpool */
|
|
|
|
struct _GstGLBufferPoolPrivate
|
|
|
|
{
|
|
|
|
GstAllocator *allocator;
|
|
|
|
GstAllocationParams params;
|
|
|
|
GstCaps *caps;
|
|
|
|
gint im_format;
|
|
|
|
GstVideoInfo info;
|
2014-12-19 17:11:08 +00:00
|
|
|
GstVideoAlignment valign;
|
2012-09-17 00:30:01 +00:00
|
|
|
gboolean add_videometa;
|
2014-10-18 08:03:43 +00:00
|
|
|
gboolean add_uploadmeta;
|
2014-10-17 13:22:24 +00:00
|
|
|
gboolean add_glsyncmeta;
|
2014-03-22 22:01:49 +00:00
|
|
|
gboolean want_eglimage;
|
|
|
|
GstBuffer *last_buffer;
|
2012-07-06 09:05:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void gst_gl_buffer_pool_finalize (GObject * object);
|
|
|
|
|
2012-09-20 13:21:19 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_BUFFER_POOL);
|
|
|
|
#define GST_CAT_DEFAULT GST_CAT_GL_BUFFER_POOL
|
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
#define GST_GL_BUFFER_POOL_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_GL_BUFFER_POOL, GstGLBufferPoolPrivate))
|
|
|
|
|
|
|
|
#define gst_gl_buffer_pool_parent_class parent_class
|
2012-09-20 13:21:19 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstGLBufferPool, gst_gl_buffer_pool,
|
|
|
|
GST_TYPE_BUFFER_POOL, GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BUFFER_POOL,
|
|
|
|
"glbufferpool", 0, "GL Buffer Pool"));
|
2012-07-06 09:05:03 +00:00
|
|
|
|
|
|
|
static const gchar **
|
|
|
|
gst_gl_buffer_pool_get_options (GstBufferPool * pool)
|
|
|
|
{
|
2014-10-18 08:03:43 +00:00
|
|
|
static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META,
|
2014-10-17 13:22:24 +00:00
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META,
|
2014-12-19 17:11:08 +00:00
|
|
|
GST_BUFFER_POOL_OPTION_GL_SYNC_META,
|
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT,
|
|
|
|
NULL
|
2012-07-06 09:05:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
|
|
|
{
|
|
|
|
GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
|
|
|
|
GstGLBufferPoolPrivate *priv = glpool->priv;
|
|
|
|
GstVideoInfo info;
|
2014-08-10 21:58:22 +00:00
|
|
|
GstCaps *caps = NULL;
|
2014-12-19 17:11:08 +00:00
|
|
|
guint min_buffers, max_buffers;
|
2014-08-10 21:58:22 +00:00
|
|
|
GstAllocator *allocator = NULL;
|
2012-07-06 09:05:03 +00:00
|
|
|
GstAllocationParams alloc_params;
|
2014-04-23 12:34:12 +00:00
|
|
|
gboolean reset = TRUE;
|
2014-12-19 17:22:12 +00:00
|
|
|
gint p;
|
2012-07-06 09:05:03 +00:00
|
|
|
|
2014-12-19 17:11:08 +00:00
|
|
|
if (!gst_buffer_pool_config_get_params (config, &caps, NULL, &min_buffers,
|
|
|
|
&max_buffers))
|
2012-07-06 09:05:03 +00:00
|
|
|
goto wrong_config;
|
|
|
|
|
|
|
|
if (caps == NULL)
|
|
|
|
goto no_caps;
|
|
|
|
|
|
|
|
/* now parse the caps from the config */
|
|
|
|
if (!gst_video_info_from_caps (&info, caps))
|
|
|
|
goto wrong_caps;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pool, "%dx%d, caps %" GST_PTR_FORMAT, info.width, info.height,
|
|
|
|
caps);
|
|
|
|
|
|
|
|
if (!gst_buffer_pool_config_get_allocator (config, &allocator, &alloc_params))
|
|
|
|
goto wrong_config;
|
|
|
|
|
2014-08-10 21:58:22 +00:00
|
|
|
if (priv->allocator)
|
|
|
|
gst_object_unref (priv->allocator);
|
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
if (!allocator) {
|
|
|
|
gst_gl_memory_init ();
|
2014-08-10 21:58:22 +00:00
|
|
|
priv->allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR);
|
|
|
|
} else {
|
|
|
|
priv->allocator = gst_object_ref (allocator);
|
2012-07-06 09:05:03 +00:00
|
|
|
}
|
2014-08-10 21:58:22 +00:00
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
priv->params = alloc_params;
|
|
|
|
|
|
|
|
priv->im_format = GST_VIDEO_INFO_FORMAT (&info);
|
|
|
|
if (priv->im_format == -1)
|
|
|
|
goto unknown_format;
|
|
|
|
|
|
|
|
if (priv->caps)
|
2014-04-23 12:34:12 +00:00
|
|
|
reset = !gst_caps_is_equal (priv->caps, caps);
|
|
|
|
|
|
|
|
gst_caps_replace (&priv->caps, caps);
|
2012-07-06 09:05:03 +00:00
|
|
|
priv->info = info;
|
|
|
|
|
2012-09-17 00:30:01 +00:00
|
|
|
priv->add_videometa = gst_buffer_pool_config_has_option (config,
|
2012-07-06 09:05:03 +00:00
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
2014-10-18 08:03:43 +00:00
|
|
|
priv->add_uploadmeta = gst_buffer_pool_config_has_option (config,
|
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META);
|
2014-10-17 13:22:24 +00:00
|
|
|
priv->add_glsyncmeta = gst_buffer_pool_config_has_option (config,
|
|
|
|
GST_BUFFER_POOL_OPTION_GL_SYNC_META);
|
2012-07-06 09:05:03 +00:00
|
|
|
|
2014-03-22 22:01:49 +00:00
|
|
|
#if GST_GL_HAVE_PLATFORM_EGL
|
2014-08-10 21:58:22 +00:00
|
|
|
g_assert (priv->allocator != NULL);
|
|
|
|
priv->want_eglimage =
|
|
|
|
(g_strcmp0 (priv->allocator->mem_type, GST_EGL_IMAGE_MEMORY_TYPE) == 0);
|
2014-06-21 23:36:34 +00:00
|
|
|
#else
|
|
|
|
priv->want_eglimage = FALSE;
|
2014-03-22 22:01:49 +00:00
|
|
|
#endif
|
|
|
|
|
2014-12-19 17:11:08 +00:00
|
|
|
if (gst_buffer_pool_config_has_option (config,
|
|
|
|
GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT)) {
|
|
|
|
|
|
|
|
priv->add_videometa = TRUE;
|
|
|
|
|
|
|
|
gst_buffer_pool_config_get_video_alignment (config, &priv->valign);
|
|
|
|
gst_video_info_align (&priv->info, &priv->valign);
|
|
|
|
|
|
|
|
gst_buffer_pool_config_set_video_alignment (config, &priv->valign);
|
|
|
|
} else {
|
|
|
|
gst_video_alignment_reset (&priv->valign);
|
|
|
|
}
|
|
|
|
|
2014-04-23 12:34:12 +00:00
|
|
|
if (reset) {
|
2014-05-01 06:07:05 +00:00
|
|
|
if (glpool->upload)
|
|
|
|
gst_object_unref (glpool->upload);
|
2014-04-02 06:43:52 +00:00
|
|
|
|
2014-05-28 04:40:10 +00:00
|
|
|
glpool->upload = gst_gl_upload_meta_new (glpool->context);
|
2014-04-23 12:34:12 +00:00
|
|
|
}
|
2014-04-02 06:43:52 +00:00
|
|
|
|
2014-12-19 17:22:12 +00:00
|
|
|
/* Recalulate the size as we don't add padding between planes. */
|
|
|
|
priv->info.size = 0;
|
|
|
|
for (p = 0; p < GST_VIDEO_INFO_N_PLANES (&priv->info); p++) {
|
|
|
|
priv->info.size +=
|
|
|
|
gst_gl_get_plane_data_size (&priv->info, &priv->valign, p);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_pool_config_set_params (config, caps, priv->info.size,
|
|
|
|
min_buffers, max_buffers);
|
2014-12-19 17:11:08 +00:00
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config);
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_config:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (pool, "invalid config");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
no_caps:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (pool, "no caps in config");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_caps:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (pool,
|
|
|
|
"failed getting geometry from caps %" GST_PTR_FORMAT, caps);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
unknown_format:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (glpool, "failed to get format from caps %"
|
|
|
|
GST_PTR_FORMAT, caps);
|
|
|
|
GST_ELEMENT_ERROR (glpool, RESOURCE, WRITE,
|
|
|
|
("Failed to create output image buffer of %dx%d pixels",
|
|
|
|
priv->info.width, priv->info.height),
|
|
|
|
("Invalid input caps %" GST_PTR_FORMAT, caps));
|
2014-05-01 06:07:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_gl_buffer_pool_start (GstBufferPool * pool)
|
|
|
|
{
|
|
|
|
GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
|
|
|
|
GstGLBufferPoolPrivate *priv = glpool->priv;
|
|
|
|
|
2014-05-28 04:40:10 +00:00
|
|
|
gst_gl_upload_meta_set_format (glpool->upload, &priv->info);
|
2014-05-01 06:07:05 +00:00
|
|
|
|
|
|
|
return GST_BUFFER_POOL_CLASS (parent_class)->start (pool);
|
2012-07-06 09:05:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function handles GstBuffer creation */
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
|
|
|
|
GstBufferPoolAcquireParams * params)
|
|
|
|
{
|
|
|
|
GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
|
|
|
|
GstGLBufferPoolPrivate *priv = glpool->priv;
|
|
|
|
GstVideoInfo *info;
|
2014-12-19 17:11:08 +00:00
|
|
|
GstVideoAlignment *valign;
|
2012-07-06 09:05:03 +00:00
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
info = &priv->info;
|
2014-12-19 17:11:08 +00:00
|
|
|
valign = &priv->valign;
|
2012-07-06 09:05:03 +00:00
|
|
|
|
|
|
|
if (!(buf = gst_buffer_new ())) {
|
|
|
|
goto no_buffer;
|
|
|
|
}
|
2014-03-22 22:01:49 +00:00
|
|
|
#if GST_GL_HAVE_PLATFORM_EGL
|
|
|
|
if (priv->want_eglimage) {
|
|
|
|
/* alloc and append memories, also add video_meta and
|
|
|
|
* texture_upload_meta */
|
|
|
|
if (!gst_egl_image_memory_setup_buffer (glpool->context, info, buf))
|
|
|
|
goto egl_image_mem_create_failed;
|
|
|
|
|
|
|
|
*buffer = buf;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
#endif
|
2012-07-06 09:05:03 +00:00
|
|
|
|
2014-12-19 17:11:08 +00:00
|
|
|
if (!gst_gl_memory_setup_buffer (glpool->context, info, valign, buf))
|
2012-07-06 09:05:03 +00:00
|
|
|
goto mem_create_failed;
|
|
|
|
|
2014-10-18 08:03:43 +00:00
|
|
|
if (priv->add_uploadmeta)
|
|
|
|
gst_gl_upload_meta_add_to_buffer (glpool->upload, buf);
|
2012-07-06 09:05:03 +00:00
|
|
|
|
2014-10-17 13:22:24 +00:00
|
|
|
if (priv->add_glsyncmeta)
|
|
|
|
gst_buffer_add_gl_sync_meta (glpool->context, buf);
|
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
*buffer = buf;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERROR */
|
|
|
|
no_buffer:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (pool, "can't create image");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
mem_create_failed:
|
|
|
|
{
|
2012-09-27 05:53:46 +00:00
|
|
|
GST_WARNING_OBJECT (pool, "Could not create GL Memory");
|
2012-07-06 09:05:03 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2014-06-21 23:36:34 +00:00
|
|
|
|
2014-03-22 22:01:49 +00:00
|
|
|
#if GST_GL_HAVE_PLATFORM_EGL
|
|
|
|
egl_image_mem_create_failed:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (pool, "Could not create EGLImage Memory");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_gl_buffer_pool_acquire_buffer (GstBufferPool * bpool,
|
|
|
|
GstBuffer ** buffer, GstBufferPoolAcquireParams * params)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
GstGLBufferPool *glpool = NULL;
|
|
|
|
|
|
|
|
ret =
|
|
|
|
GST_BUFFER_POOL_CLASS
|
|
|
|
(gst_gl_buffer_pool_parent_class)->acquire_buffer (bpool, buffer, params);
|
|
|
|
if (ret != GST_FLOW_OK || !*buffer)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
glpool = GST_GL_BUFFER_POOL (bpool);
|
|
|
|
|
|
|
|
/* XXX: Don't return the memory we just rendered, glEGLImageTargetTexture2DOES()
|
|
|
|
* keeps the EGLImage unmappable until the next one is uploaded
|
|
|
|
*/
|
|
|
|
if (glpool->priv->want_eglimage && *buffer
|
|
|
|
&& *buffer == glpool->priv->last_buffer) {
|
|
|
|
GstBuffer *oldbuf = *buffer;
|
|
|
|
|
|
|
|
ret =
|
|
|
|
GST_BUFFER_POOL_CLASS
|
|
|
|
(gst_gl_buffer_pool_parent_class)->acquire_buffer (bpool,
|
|
|
|
buffer, params);
|
|
|
|
gst_object_replace ((GstObject **) & oldbuf->pool, (GstObject *) glpool);
|
|
|
|
gst_buffer_unref (oldbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2012-07-06 09:05:03 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 05:53:46 +00:00
|
|
|
/**
|
|
|
|
* gst_gl_buffer_pool_new:
|
|
|
|
* @display: the #GstGLDisplay to use
|
|
|
|
*
|
|
|
|
* Returns: a #GstBufferPool that allocates buffers with #GstGLMemory
|
|
|
|
*/
|
2012-07-06 09:05:03 +00:00
|
|
|
GstBufferPool *
|
2013-09-15 04:23:43 +00:00
|
|
|
gst_gl_buffer_pool_new (GstGLContext * context)
|
2012-07-06 09:05:03 +00:00
|
|
|
{
|
|
|
|
GstGLBufferPool *pool;
|
|
|
|
|
|
|
|
pool = g_object_new (GST_TYPE_GL_BUFFER_POOL, NULL);
|
2013-09-15 04:23:43 +00:00
|
|
|
pool->context = gst_object_ref (context);
|
2012-07-06 09:05:03 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (pool, "new GL buffer pool %p", pool);
|
|
|
|
|
|
|
|
return GST_BUFFER_POOL_CAST (pool);
|
|
|
|
}
|
|
|
|
|
2014-06-21 23:36:34 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2014-03-22 22:01:49 +00:00
|
|
|
void
|
|
|
|
gst_gl_buffer_pool_replace_last_buffer (GstGLBufferPool * pool,
|
|
|
|
GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
g_return_if_fail (pool != NULL);
|
|
|
|
g_return_if_fail (buffer != NULL);
|
|
|
|
|
|
|
|
gst_buffer_replace (&pool->priv->last_buffer, buffer);
|
|
|
|
}
|
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
static void
|
|
|
|
gst_gl_buffer_pool_class_init (GstGLBufferPoolClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
|
|
GstBufferPoolClass *gstbufferpool_class = (GstBufferPoolClass *) klass;
|
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (GstGLBufferPoolPrivate));
|
|
|
|
|
|
|
|
gobject_class->finalize = gst_gl_buffer_pool_finalize;
|
|
|
|
|
|
|
|
gstbufferpool_class->get_options = gst_gl_buffer_pool_get_options;
|
|
|
|
gstbufferpool_class->set_config = gst_gl_buffer_pool_set_config;
|
|
|
|
gstbufferpool_class->alloc_buffer = gst_gl_buffer_pool_alloc;
|
2014-03-22 22:01:49 +00:00
|
|
|
gstbufferpool_class->acquire_buffer = gst_gl_buffer_pool_acquire_buffer;
|
2014-05-01 06:07:05 +00:00
|
|
|
gstbufferpool_class->start = gst_gl_buffer_pool_start;
|
2012-07-06 09:05:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_gl_buffer_pool_init (GstGLBufferPool * pool)
|
|
|
|
{
|
2014-03-22 22:01:49 +00:00
|
|
|
GstGLBufferPoolPrivate *priv = NULL;
|
2013-06-13 04:36:41 +00:00
|
|
|
|
2014-03-22 22:01:49 +00:00
|
|
|
pool->priv = GST_GL_BUFFER_POOL_GET_PRIVATE (pool);
|
|
|
|
priv = pool->priv;
|
|
|
|
|
|
|
|
priv->allocator = NULL;
|
|
|
|
priv->caps = NULL;
|
|
|
|
priv->im_format = GST_VIDEO_FORMAT_UNKNOWN;
|
|
|
|
priv->add_videometa = TRUE;
|
2014-10-17 13:22:24 +00:00
|
|
|
priv->add_glsyncmeta = FALSE;
|
2014-03-22 22:01:49 +00:00
|
|
|
priv->want_eglimage = FALSE;
|
|
|
|
priv->last_buffer = FALSE;
|
2013-06-13 04:36:41 +00:00
|
|
|
|
2014-03-22 22:01:49 +00:00
|
|
|
gst_video_info_init (&priv->info);
|
|
|
|
gst_allocation_params_init (&priv->params);
|
2013-06-13 04:36:41 +00:00
|
|
|
}
|
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
static void
|
|
|
|
gst_gl_buffer_pool_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstGLBufferPool *pool = GST_GL_BUFFER_POOL_CAST (object);
|
|
|
|
GstGLBufferPoolPrivate *priv = pool->priv;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pool, "finalize GL buffer pool %p", pool);
|
|
|
|
|
2014-03-22 22:01:49 +00:00
|
|
|
gst_buffer_replace (&pool->priv->last_buffer, NULL);
|
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
if (priv->caps)
|
|
|
|
gst_caps_unref (priv->caps);
|
|
|
|
|
2014-05-01 06:07:05 +00:00
|
|
|
if (pool->upload)
|
|
|
|
gst_object_unref (pool->upload);
|
2014-04-02 06:43:52 +00:00
|
|
|
|
2012-07-06 09:05:03 +00:00
|
|
|
G_OBJECT_CLASS (gst_gl_buffer_pool_parent_class)->finalize (object);
|
2014-03-22 22:01:49 +00:00
|
|
|
|
|
|
|
/* only release the context once all our memory have been deleted */
|
|
|
|
if (pool->context) {
|
|
|
|
gst_object_unref (pool->context);
|
|
|
|
pool->context = NULL;
|
|
|
|
}
|
2014-08-10 21:58:22 +00:00
|
|
|
|
|
|
|
if (priv->allocator) {
|
|
|
|
gst_object_unref (priv->allocator);
|
|
|
|
priv->allocator = NULL;
|
|
|
|
}
|
2012-07-06 09:05:03 +00:00
|
|
|
}
|