mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
gl/pool: init the upload object on start
Theoretically, set_config could be called multiple times
This commit is contained in:
parent
775e998dab
commit
b903c61ceb
2 changed files with 27 additions and 9 deletions
|
@ -50,7 +50,6 @@ struct _GstGLBufferPoolPrivate
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gint im_format;
|
gint im_format;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
GstGLUpload *upload;
|
|
||||||
gboolean add_videometa;
|
gboolean add_videometa;
|
||||||
#if GST_GL_HAVE_PLATFORM_EGL
|
#if GST_GL_HAVE_PLATFORM_EGL
|
||||||
gboolean want_eglimage;
|
gboolean want_eglimage;
|
||||||
|
@ -133,11 +132,10 @@ gst_gl_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
if (priv->upload)
|
if (glpool->upload)
|
||||||
gst_object_unref (priv->upload);
|
gst_object_unref (glpool->upload);
|
||||||
|
|
||||||
priv->upload = gst_gl_upload_new (glpool->context);
|
glpool->upload = gst_gl_upload_new (glpool->context);
|
||||||
gst_gl_upload_init_format (priv->upload, &priv->info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config);
|
return GST_BUFFER_POOL_CLASS (parent_class)->set_config (pool, config);
|
||||||
|
@ -167,7 +165,25 @@ unknown_format:
|
||||||
("Failed to create output image buffer of %dx%d pixels",
|
("Failed to create output image buffer of %dx%d pixels",
|
||||||
priv->info.width, priv->info.height),
|
priv->info.width, priv->info.height),
|
||||||
("Invalid input caps %" GST_PTR_FORMAT, caps));
|
("Invalid input caps %" GST_PTR_FORMAT, caps));
|
||||||
return FALSE;;
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_gl_buffer_pool_start (GstBufferPool * pool)
|
||||||
|
{
|
||||||
|
GstGLBufferPool *glpool = GST_GL_BUFFER_POOL_CAST (pool);
|
||||||
|
GstGLBufferPoolPrivate *priv = glpool->priv;
|
||||||
|
|
||||||
|
if (!gst_gl_upload_init_format (glpool->upload, &priv->info))
|
||||||
|
goto upload_error;
|
||||||
|
|
||||||
|
return GST_BUFFER_POOL_CLASS (parent_class)->start (pool);
|
||||||
|
|
||||||
|
upload_error:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (glpool, "Failed to initialize upload");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +218,7 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
|
||||||
if (!gst_gl_memory_setup_buffer (glpool->context, info, buf))
|
if (!gst_gl_memory_setup_buffer (glpool->context, info, buf))
|
||||||
goto mem_create_failed;
|
goto mem_create_failed;
|
||||||
|
|
||||||
gst_gl_upload_add_video_gl_texture_upload_meta (glpool->priv->upload, buf);
|
gst_gl_upload_add_video_gl_texture_upload_meta (glpool->upload, buf);
|
||||||
|
|
||||||
*buffer = buf;
|
*buffer = buf;
|
||||||
|
|
||||||
|
@ -311,6 +327,7 @@ gst_gl_buffer_pool_class_init (GstGLBufferPoolClass * klass)
|
||||||
gstbufferpool_class->set_config = gst_gl_buffer_pool_set_config;
|
gstbufferpool_class->set_config = gst_gl_buffer_pool_set_config;
|
||||||
gstbufferpool_class->alloc_buffer = gst_gl_buffer_pool_alloc;
|
gstbufferpool_class->alloc_buffer = gst_gl_buffer_pool_alloc;
|
||||||
gstbufferpool_class->acquire_buffer = gst_gl_buffer_pool_acquire_buffer;
|
gstbufferpool_class->acquire_buffer = gst_gl_buffer_pool_acquire_buffer;
|
||||||
|
gstbufferpool_class->start = gst_gl_buffer_pool_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -349,8 +366,8 @@ gst_gl_buffer_pool_finalize (GObject * object)
|
||||||
if (priv->caps)
|
if (priv->caps)
|
||||||
gst_caps_unref (priv->caps);
|
gst_caps_unref (priv->caps);
|
||||||
|
|
||||||
if (priv->upload)
|
if (pool->upload)
|
||||||
gst_object_unref (priv->upload);
|
gst_object_unref (pool->upload);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_gl_buffer_pool_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gst_gl_buffer_pool_parent_class)->finalize (object);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct _GstGLBufferPool
|
||||||
GstBufferPool bufferpool;
|
GstBufferPool bufferpool;
|
||||||
|
|
||||||
GstGLContext *context;
|
GstGLContext *context;
|
||||||
|
GstGLUpload *upload;
|
||||||
|
|
||||||
GstGLBufferPoolPrivate *priv;
|
GstGLBufferPoolPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue