From faa94a87376190cc77f814a1cb54b26e70157246 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 17 Mar 2014 20:40:51 +0100 Subject: [PATCH] gl: silence a critical if upstream does not provide us with meta params --- ext/gl/gstgltestsrc.c | 44 ++++++++++++++++++----------------- gst-libs/gst/gl/gstglfilter.c | 44 ++++++++++++++++++----------------- gst-libs/gst/gl/gstglmixer.c | 44 ++++++++++++++++++----------------- 3 files changed, 69 insertions(+), 63 deletions(-) diff --git a/ext/gl/gstgltestsrc.c b/ext/gl/gstgltestsrc.c index b788dcd5c7..59cefd77d5 100644 --- a/ext/gl/gstgltestsrc.c +++ b/ext/gl/gstgltestsrc.c @@ -627,32 +627,34 @@ gst_gl_test_src_decide_allocation (GstBaseSrc * basesrc, GstQuery * query) gchar *apis; gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params); - if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", - GST_GL_TYPE_CONTEXT, &context, NULL) && context) { - GstGLContext *old = src->context; + if (upload_meta_params) { + if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", + GST_GL_TYPE_CONTEXT, &context, NULL) && context) { + GstGLContext *old = src->context; - src->context = context; - if (old) - gst_object_unref (old); - } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle", - G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING, - &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL) - && handle) { - GstGLPlatform platform = GST_GL_PLATFORM_NONE; - GstGLAPI gl_apis; + src->context = context; + if (old) + gst_object_unref (old); + } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle", + G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING, + &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL) + && handle) { + GstGLPlatform platform = GST_GL_PLATFORM_NONE; + GstGLAPI gl_apis; - GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s", handle, - type, apis); + GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s", + handle, type, apis); - if (g_strcmp0 (type, "glx") == 0) - platform = GST_GL_PLATFORM_GLX; + if (g_strcmp0 (type, "glx") == 0) + platform = GST_GL_PLATFORM_GLX; - gl_apis = gst_gl_api_from_string (apis); + gl_apis = gst_gl_api_from_string (apis); - if (gl_apis && platform) - other_context = - gst_gl_context_new_wrapped (src->display, (guintptr) handle, - platform, gl_apis); + if (gl_apis && platform) + other_context = + gst_gl_context_new_wrapped (src->display, (guintptr) handle, + platform, gl_apis); + } } } diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 109379c146..7bc67bbe6d 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -883,32 +883,34 @@ gst_gl_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query) gchar *apis; gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params); - if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", - GST_GL_TYPE_CONTEXT, &context, NULL) && context) { - GstGLContext *old = filter->context; + if (upload_meta_params) { + if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", + GST_GL_TYPE_CONTEXT, &context, NULL) && context) { + GstGLContext *old = filter->context; - filter->context = context; - if (old) - gst_object_unref (old); - } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle", - G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING, - &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL) - && handle) { - GstGLPlatform platform = GST_GL_PLATFORM_NONE; - GstGLAPI gl_apis; + filter->context = context; + if (old) + gst_object_unref (old); + } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle", + G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING, + &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL) + && handle) { + GstGLPlatform platform = GST_GL_PLATFORM_NONE; + GstGLAPI gl_apis; - GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s", handle, - type, apis); + GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s", + handle, type, apis); - if (g_strcmp0 (type, "glx") == 0) - platform = GST_GL_PLATFORM_GLX; + if (g_strcmp0 (type, "glx") == 0) + platform = GST_GL_PLATFORM_GLX; - gl_apis = gst_gl_api_from_string (apis); + gl_apis = gst_gl_api_from_string (apis); - if (gl_apis && platform) - other_context = - gst_gl_context_new_wrapped (filter->display, (guintptr) handle, - platform, gl_apis); + if (gl_apis && platform) + other_context = + gst_gl_context_new_wrapped (filter->display, (guintptr) handle, + platform, gl_apis); + } } } diff --git a/gst-libs/gst/gl/gstglmixer.c b/gst-libs/gst/gl/gstglmixer.c index b47783c01b..267ff475cd 100644 --- a/gst-libs/gst/gl/gstglmixer.c +++ b/gst-libs/gst/gl/gstglmixer.c @@ -1117,32 +1117,34 @@ gst_gl_mixer_decide_allocation (GstGLMixer * mix, GstQuery * query) gchar *apis; gst_query_parse_nth_allocation_meta (query, idx, &upload_meta_params); - if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", - GST_GL_TYPE_CONTEXT, &context, NULL) && context) { - GstGLContext *old = mix->context; + if (upload_meta_params) { + if (gst_structure_get (upload_meta_params, "gst.gl.GstGLContext", + GST_GL_TYPE_CONTEXT, &context, NULL) && context) { + GstGLContext *old = mix->context; - mix->context = context; - if (old) - gst_object_unref (old); - } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle", - G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING, - &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL) - && handle) { - GstGLPlatform platform = GST_GL_PLATFORM_NONE; - GstGLAPI gl_apis; + mix->context = context; + if (old) + gst_object_unref (old); + } else if (gst_structure_get (upload_meta_params, "gst.gl.context.handle", + G_TYPE_POINTER, &handle, "gst.gl.context.type", G_TYPE_STRING, + &type, "gst.gl.context.apis", G_TYPE_STRING, &apis, NULL) + && handle) { + GstGLPlatform platform = GST_GL_PLATFORM_NONE; + GstGLAPI gl_apis; - GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s", handle, - type, apis); + GST_DEBUG ("got GL context handle 0x%p with type %s and apis %s", + handle, type, apis); - if (g_strcmp0 (type, "glx") == 0) - platform = GST_GL_PLATFORM_GLX; + if (g_strcmp0 (type, "glx") == 0) + platform = GST_GL_PLATFORM_GLX; - gl_apis = gst_gl_api_from_string (apis); + gl_apis = gst_gl_api_from_string (apis); - if (gl_apis && platform) - other_context = - gst_gl_context_new_wrapped (mix->display, (guintptr) handle, - platform, gl_apis); + if (gl_apis && platform) + other_context = + gst_gl_context_new_wrapped (mix->display, (guintptr) handle, + platform, gl_apis); + } } }