mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
gl: pass video info's by reference
This commit is contained in:
parent
98c486025a
commit
e01e2cce9f
8 changed files with 33 additions and 33 deletions
|
@ -413,8 +413,8 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
|
|||
|
||||
if (!gl_sink->upload) {
|
||||
gl_sink->upload = gst_gl_upload_new (gl_sink->context);
|
||||
if (!gst_gl_upload_init_format (gl_sink->upload, gl_sink->info,
|
||||
gl_sink->info))
|
||||
if (!gst_gl_upload_init_format (gl_sink->upload, &gl_sink->info,
|
||||
&gl_sink->info))
|
||||
goto upload_error;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!(gl_mem = gst_gl_memory_alloc (glpool->context, priv->info)))
|
||||
if (!(gl_mem = gst_gl_memory_alloc (glpool->context, info)))
|
||||
goto mem_create_failed;
|
||||
gst_buffer_append_memory (buf, gl_mem);
|
||||
|
||||
|
|
|
@ -964,8 +964,8 @@ gst_gl_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query)
|
|||
|
||||
if (!filter->upload) {
|
||||
filter->upload = gst_gl_upload_new (filter->context);
|
||||
gst_gl_upload_init_format (filter->upload, filter->in_info,
|
||||
filter->out_info);
|
||||
gst_gl_upload_init_format (filter->upload, &filter->in_info,
|
||||
&filter->out_info);
|
||||
}
|
||||
//blocking call, generate a FBO
|
||||
if (!gst_gl_context_gen_fbo (filter->context, out_width, out_height,
|
||||
|
|
|
@ -62,19 +62,19 @@ typedef struct
|
|||
|
||||
static void
|
||||
_gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
|
||||
GstGLContext * context, GstVideoInfo v_info, gpointer user_data,
|
||||
GstGLContext * context, GstVideoInfo * v_info, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
gsize maxsize;
|
||||
|
||||
maxsize = v_info.size;
|
||||
maxsize = v_info->size;
|
||||
|
||||
gst_memory_init (GST_MEMORY_CAST (mem), GST_MEMORY_FLAG_NO_SHARE,
|
||||
allocator, parent, maxsize, 0, 0, maxsize);
|
||||
|
||||
mem->context = gst_object_ref (context);
|
||||
mem->gl_format = GL_RGBA;
|
||||
mem->v_info = v_info;
|
||||
mem->v_info = *v_info;
|
||||
mem->notify = notify;
|
||||
mem->user_data = user_data;
|
||||
mem->wrapped = FALSE;
|
||||
|
@ -82,21 +82,21 @@ _gl_mem_init (GstGLMemory * mem, GstAllocator * allocator, GstMemory * parent,
|
|||
mem->download = gst_gl_download_new (context);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_GL_MEMORY, "new GL texture memory:%p format:%u "
|
||||
"dimensions:%ux%u", mem, GST_VIDEO_INFO_FORMAT (&v_info),
|
||||
GST_VIDEO_INFO_WIDTH (&v_info), GST_VIDEO_INFO_HEIGHT (&v_info));
|
||||
"dimensions:%ux%u", mem, GST_VIDEO_INFO_FORMAT (v_info),
|
||||
GST_VIDEO_INFO_WIDTH (v_info), GST_VIDEO_INFO_HEIGHT (v_info));
|
||||
}
|
||||
|
||||
static GstGLMemory *
|
||||
_gl_mem_new (GstAllocator * allocator, GstMemory * parent,
|
||||
GstGLContext * context, GstVideoInfo v_info, gpointer user_data,
|
||||
GstGLContext * context, GstVideoInfo * v_info, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GstGLMemory *mem;
|
||||
GLuint tex_id;
|
||||
|
||||
gst_gl_context_gen_texture (context, &tex_id,
|
||||
GST_VIDEO_INFO_FORMAT (&v_info), GST_VIDEO_INFO_WIDTH (&v_info),
|
||||
GST_VIDEO_INFO_HEIGHT (&v_info));
|
||||
GST_VIDEO_INFO_FORMAT (v_info), GST_VIDEO_INFO_WIDTH (v_info),
|
||||
GST_VIDEO_INFO_HEIGHT (v_info));
|
||||
if (!tex_id) {
|
||||
GST_CAT_WARNING (GST_CAT_GL_MEMORY,
|
||||
"Could not create GL texture with context:%p", context);
|
||||
|
@ -126,8 +126,8 @@ _gl_mem_map (GstGLMemory * gl_mem, gsize maxsize, GstMapFlags flags)
|
|||
if (GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
|
||||
if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem,
|
||||
GST_GL_MEMORY_FLAG_UPLOAD_INITTED)) {
|
||||
if (!gst_gl_upload_init_format (gl_mem->upload, gl_mem->v_info,
|
||||
gl_mem->v_info)) {
|
||||
if (!gst_gl_upload_init_format (gl_mem->upload, &gl_mem->v_info,
|
||||
&gl_mem->v_info)) {
|
||||
goto error;
|
||||
}
|
||||
GST_GL_MEMORY_FLAG_SET (gl_mem, GST_GL_MEMORY_FLAG_UPLOAD_INITTED);
|
||||
|
@ -310,7 +310,7 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
GstGLMemoryCopyParams copy_params;
|
||||
|
||||
if (GST_GL_MEMORY_FLAG_IS_SET (src, GST_GL_MEMORY_FLAG_NEED_UPLOAD)) {
|
||||
dest = _gl_mem_new (src->mem.allocator, NULL, src->context, src->v_info,
|
||||
dest = _gl_mem_new (src->mem.allocator, NULL, src->context, &src->v_info,
|
||||
NULL, NULL);
|
||||
dest->data = g_malloc (src->mem.maxsize);
|
||||
memcpy (dest->data, src->data, src->mem.maxsize);
|
||||
|
@ -322,7 +322,7 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size)
|
|||
gst_gl_context_thread_add (src->context, _gl_mem_copy_thread, ©_params);
|
||||
|
||||
dest = g_slice_alloc (sizeof (GstGLMemory));
|
||||
_gl_mem_init (dest, src->mem.allocator, NULL, src->context, src->v_info,
|
||||
_gl_mem_init (dest, src->mem.allocator, NULL, src->context, &src->v_info,
|
||||
NULL, NULL);
|
||||
|
||||
if (!copy_params.result) {
|
||||
|
@ -422,7 +422,7 @@ gst_gl_memory_copy_into_texture (GstGLMemory * gl_mem, guint tex_id)
|
|||
* from @context
|
||||
*/
|
||||
GstMemory *
|
||||
gst_gl_memory_alloc (GstGLContext * context, GstVideoInfo v_info)
|
||||
gst_gl_memory_alloc (GstGLContext * context, GstVideoInfo * v_info)
|
||||
{
|
||||
GstGLMemory *mem;
|
||||
|
||||
|
@ -449,7 +449,7 @@ gst_gl_memory_alloc (GstGLContext * context, GstVideoInfo v_info)
|
|||
* from @context and contents specified by @data
|
||||
*/
|
||||
GstGLMemory *
|
||||
gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo v_info,
|
||||
gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo * v_info,
|
||||
gpointer data, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
GstGLMemory *mem;
|
||||
|
|
|
@ -143,9 +143,9 @@ struct _GstGLMemory
|
|||
|
||||
void gst_gl_memory_init (void);
|
||||
|
||||
GstMemory * gst_gl_memory_alloc (GstGLContext * context, GstVideoInfo info);
|
||||
GstMemory * gst_gl_memory_alloc (GstGLContext * context, GstVideoInfo * info);
|
||||
|
||||
GstGLMemory * gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo info, gpointer data,
|
||||
GstGLMemory * gst_gl_memory_wrapped (GstGLContext * context, GstVideoInfo * info, gpointer data,
|
||||
gpointer user_data, GDestroyNotify notify);
|
||||
|
||||
gboolean gst_is_gl_memory (GstMemory * mem);
|
||||
|
|
|
@ -1681,8 +1681,8 @@ gst_gl_mixer_process_textures (GstGLMixer * mix, GstBuffer * outbuf)
|
|||
if (!pad->upload) {
|
||||
pad->upload = gst_gl_upload_new (mix->context);
|
||||
|
||||
if (!gst_gl_upload_init_format (pad->upload, pad->in_info,
|
||||
mix->out_info)) {
|
||||
if (!gst_gl_upload_init_format (pad->upload, &pad->in_info,
|
||||
&mix->out_info)) {
|
||||
GST_ELEMENT_ERROR (mix, RESOURCE, NOT_FOUND, ("%s",
|
||||
"Failed to init upload format"), (NULL));
|
||||
res = FALSE;
|
||||
|
|
|
@ -403,12 +403,12 @@ gst_gl_upload_finalize (GObject * object)
|
|||
|
||||
static gboolean
|
||||
_gst_gl_upload_init_format_unlocked (GstGLUpload * upload,
|
||||
GstVideoInfo in_info, GstVideoInfo out_info)
|
||||
GstVideoInfo * in_info, GstVideoInfo * out_info)
|
||||
{
|
||||
g_return_val_if_fail (upload != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&in_info) !=
|
||||
g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (in_info) !=
|
||||
GST_VIDEO_FORMAT_UNKNOWN, FALSE);
|
||||
g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (&in_info) !=
|
||||
g_return_val_if_fail (GST_VIDEO_INFO_FORMAT (in_info) !=
|
||||
GST_VIDEO_FORMAT_ENCODED, FALSE);
|
||||
|
||||
if (upload->initted) {
|
||||
|
@ -417,8 +417,8 @@ _gst_gl_upload_init_format_unlocked (GstGLUpload * upload,
|
|||
upload->initted = TRUE;
|
||||
}
|
||||
|
||||
upload->in_info = in_info;
|
||||
upload->out_info = out_info;
|
||||
upload->in_info = *in_info;
|
||||
upload->out_info = *out_info;
|
||||
|
||||
gst_gl_context_thread_add (upload->context,
|
||||
(GstGLContextThreadFunc) _init_upload, upload);
|
||||
|
@ -438,8 +438,8 @@ _gst_gl_upload_init_format_unlocked (GstGLUpload * upload,
|
|||
* Returns: whether the initialization was successful
|
||||
*/
|
||||
gboolean
|
||||
gst_gl_upload_init_format (GstGLUpload * upload, GstVideoInfo in_info,
|
||||
GstVideoInfo out_info)
|
||||
gst_gl_upload_init_format (GstGLUpload * upload, GstVideoInfo * in_info,
|
||||
GstVideoInfo * out_info)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
|
@ -583,7 +583,7 @@ gst_gl_upload_perform_with_memory (GstGLUpload * upload, GstGLMemory * gl_mem)
|
|||
g_return_val_if_fail (upload != NULL, FALSE);
|
||||
|
||||
if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_UPLOAD_INITTED)) {
|
||||
gst_gl_upload_init_format (upload, gl_mem->v_info, gl_mem->v_info);
|
||||
gst_gl_upload_init_format (upload, &gl_mem->v_info, &gl_mem->v_info);
|
||||
}
|
||||
|
||||
if (!GST_GL_MEMORY_FLAG_IS_SET (gl_mem, GST_GL_MEMORY_FLAG_NEED_UPLOAD))
|
||||
|
@ -630,7 +630,7 @@ _do_upload_for_meta (GstGLUpload * upload, GstVideoGLTextureUploadMeta * meta)
|
|||
gst_video_info_set_format (&in_info, v_format, width, height);
|
||||
gst_video_info_set_format (&out_info, GST_VIDEO_FORMAT_RGBA, width, height);
|
||||
|
||||
if (!_gst_gl_upload_init_format_unlocked (upload, in_info, out_info))
|
||||
if (!_gst_gl_upload_init_format_unlocked (upload, &in_info, &out_info))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ struct _GstGLUploadClass
|
|||
|
||||
GstGLUpload * gst_gl_upload_new (GstGLContext * context);
|
||||
|
||||
gboolean gst_gl_upload_init_format (GstGLUpload * upload, GstVideoInfo in_info, GstVideoInfo out_info);
|
||||
gboolean gst_gl_upload_init_format (GstGLUpload * upload, GstVideoInfo * in_info, GstVideoInfo * out_info);
|
||||
|
||||
gboolean gst_gl_upload_add_video_gl_texture_upload_meta (GstGLUpload * upload, GstBuffer * buffer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue