glmemory: small code reformat

makes the alloc_params selections fit on a single line.
This commit is contained in:
Matthew Waters 2015-12-30 12:09:29 +11:00 committed by Tim-Philipp Müller
parent 9328ec33f3
commit 3695ab353d
2 changed files with 21 additions and 26 deletions

View file

@ -735,15 +735,15 @@ static GstGLMemory *
_default_gl_tex_alloc (GstGLMemoryAllocator * allocator, _default_gl_tex_alloc (GstGLMemoryAllocator * allocator,
GstGLVideoAllocationParams * params) GstGLVideoAllocationParams * params)
{ {
guint alloc_flags = params->parent.alloc_flags;
GstGLMemory *mem; GstGLMemory *mem;
g_return_val_if_fail (params->parent. g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO, NULL); NULL);
mem = g_new0 (GstGLMemory, 1); mem = g_new0 (GstGLMemory, 1);
if (params->parent. if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
mem->tex_id = params->parent.gl_handle; mem->tex_id = params->parent.gl_handle;
mem->texture_wrapped = TRUE; mem->texture_wrapped = TRUE;
} }
@ -753,12 +753,10 @@ _default_gl_tex_alloc (GstGLMemoryAllocator * allocator,
params->v_info, params->plane, params->valign, params->parent.user_data, params->v_info, params->plane, params->valign, params->parent.user_data,
params->parent.notify); params->parent.notify);
if (params->parent. if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD); GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
} }
if (params->parent. if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
mem->mem.data = params->parent.wrapped_data; mem->mem.data = params->parent.wrapped_data;
GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD); GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
} }
@ -1134,13 +1132,13 @@ gst_gl_memory_setup_buffer (GstGLMemoryAllocator * allocator,
guint n_mem, i, v, views; guint n_mem, i, v, views;
g_return_val_if_fail (params != NULL, FALSE); g_return_val_if_fail (params != NULL, FALSE);
g_return_val_if_fail ((params->parent. g_return_val_if_fail ((params->
alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) parent.alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM)
== 0, FALSE); == 0, FALSE);
g_return_val_if_fail ((params->parent.alloc_flags & g_return_val_if_fail ((params->parent.alloc_flags &
GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) == 0, FALSE); GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) == 0, FALSE);
g_return_val_if_fail (params->parent. g_return_val_if_fail (params->
alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO, FALSE); parent.alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO, FALSE);
base_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator); base_allocator = GST_GL_BASE_MEMORY_ALLOCATOR (allocator);
n_mem = GST_VIDEO_INFO_N_PLANES (params->v_info); n_mem = GST_VIDEO_INFO_N_PLANES (params->v_info);
@ -1181,8 +1179,9 @@ gst_gl_memory_allocator_get_default (GstGLContext * context)
g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL); g_return_val_if_fail (GST_IS_GL_CONTEXT (context), NULL);
if (USING_OPENGL (context) || USING_OPENGL3 (context) /* we can only use the pbo allocator with GL > 3.0 contexts */
|| USING_GLES3 (context)) { if (gst_gl_context_check_gl_version (context,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2, 3, 0)) {
allocator = (GstGLMemoryAllocator *) allocator = (GstGLMemoryAllocator *)
gst_allocator_find (GST_GL_MEMORY_PBO_ALLOCATOR_NAME); gst_allocator_find (GST_GL_MEMORY_PBO_ALLOCATOR_NAME);
} else { } else {

View file

@ -719,15 +719,16 @@ _gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator,
GstGLVideoAllocationParams * params) GstGLVideoAllocationParams * params)
{ {
GstGLMemoryPBO *mem; GstGLMemoryPBO *mem;
guint alloc_flags;
g_return_val_if_fail (params-> alloc_flags = params->parent.alloc_flags;
parent.alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO, NULL);
g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO,
NULL);
mem = g_new0 (GstGLMemoryPBO, 1); mem = g_new0 (GstGLMemoryPBO, 1);
if (params-> if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
parent.alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE)
{
mem->mem.tex_id = params->parent.gl_handle; mem->mem.tex_id = params->parent.gl_handle;
mem->mem.texture_wrapped = TRUE; mem->mem.texture_wrapped = TRUE;
} }
@ -737,15 +738,10 @@ _gl_mem_pbo_alloc (GstGLBaseMemoryAllocator * allocator,
params->v_info, params->plane, params->valign, params->parent.user_data, params->v_info, params->plane, params->valign, params->parent.user_data,
params->parent.notify); params->parent.notify);
if (params-> if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) {
parent.alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE)
{
GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD); GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
} }
if (params-> if (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
parent.alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) {
mem->pbo->mem.data = params->parent.wrapped_data;
GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD); GST_MINI_OBJECT_FLAG_SET (mem, GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
GST_MINI_OBJECT_FLAG_SET (mem->pbo, GST_MINI_OBJECT_FLAG_SET (mem->pbo,
GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD); GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);