mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
[781/906] download: propogate errors from the GL thread
This commit is contained in:
parent
7c4d51edf4
commit
e32e8f45e0
1 changed files with 26 additions and 10 deletions
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
static void _do_download (GstGLDisplay * display, GstGLDownload * download);
|
static void _do_download (GstGLDisplay * display, GstGLDownload * download);
|
||||||
static void _init_download (GstGLDisplay * display, GstGLDownload * download);
|
static void _init_download (GstGLDisplay * display, GstGLDownload * download);
|
||||||
static void _init_download_shader (GstGLDisplay * display,
|
static gboolean _init_download_shader (GstGLDisplay * display,
|
||||||
GstGLDownload * download);
|
GstGLDownload * download);
|
||||||
static gboolean _gst_gl_download_perform_with_data_unlocked (GstGLDownload *
|
static gboolean _gst_gl_download_perform_with_data_unlocked (GstGLDownload *
|
||||||
download, GLuint texture_id, gpointer data[GST_VIDEO_MAX_PLANES]);
|
download, GLuint texture_id, gpointer data[GST_VIDEO_MAX_PLANES]);
|
||||||
|
@ -231,6 +231,8 @@ struct _GstGLDownloadPrivate
|
||||||
|
|
||||||
void (*do_rgb) (GstGLDisplay * display, GstGLDownload * download);
|
void (*do_rgb) (GstGLDisplay * display, GstGLDownload * download);
|
||||||
void (*do_yuv) (GstGLDisplay * display, GstGLDownload * download);
|
void (*do_yuv) (GstGLDisplay * display, GstGLDownload * download);
|
||||||
|
|
||||||
|
gboolean result;
|
||||||
};
|
};
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_gl_download_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_gl_download_debug);
|
||||||
|
@ -373,6 +375,7 @@ gst_gl_download_init_format (GstGLDownload * download, GstVideoFormat v_format,
|
||||||
guint out_width, guint out_height)
|
guint out_width, guint out_height)
|
||||||
{
|
{
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
g_return_val_if_fail (download != NULL, FALSE);
|
g_return_val_if_fail (download != NULL, FALSE);
|
||||||
g_return_val_if_fail (v_format != GST_VIDEO_FORMAT_UNKNOWN, FALSE);
|
g_return_val_if_fail (v_format != GST_VIDEO_FORMAT_UNKNOWN, FALSE);
|
||||||
|
@ -384,8 +387,6 @@ gst_gl_download_init_format (GstGLDownload * download, GstVideoFormat v_format,
|
||||||
if (download->initted) {
|
if (download->initted) {
|
||||||
g_mutex_unlock (&download->lock);
|
g_mutex_unlock (&download->lock);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
|
||||||
download->initted = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_video_info_set_format (&info, v_format, out_width, out_height);
|
gst_video_info_set_format (&info, v_format, out_width, out_height);
|
||||||
|
@ -395,9 +396,11 @@ gst_gl_download_init_format (GstGLDownload * download, GstVideoFormat v_format,
|
||||||
gst_gl_display_thread_add (download->display,
|
gst_gl_display_thread_add (download->display,
|
||||||
(GstGLDisplayThreadFunc) _init_download, download);
|
(GstGLDisplayThreadFunc) _init_download, download);
|
||||||
|
|
||||||
|
ret = download->initted = download->priv->result;
|
||||||
|
|
||||||
g_mutex_unlock (&download->lock);
|
g_mutex_unlock (&download->lock);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -497,7 +500,7 @@ _gst_gl_download_perform_with_data_unlocked (GstGLDownload * download,
|
||||||
gst_gl_display_thread_add (download->display,
|
gst_gl_display_thread_add (download->display,
|
||||||
(GstGLDisplayThreadFunc) _do_download, download);
|
(GstGLDisplayThreadFunc) _do_download, download);
|
||||||
|
|
||||||
return TRUE;
|
return download->priv->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -559,7 +562,7 @@ _init_download (GstGLDisplay * display, GstGLDownload * download)
|
||||||
*/
|
*/
|
||||||
gst_gl_display_set_error (display,
|
gst_gl_display_set_error (display,
|
||||||
"Context, EXT_framebuffer_object supported: no");
|
"Context, EXT_framebuffer_object supported: no");
|
||||||
return;
|
goto error;
|
||||||
}
|
}
|
||||||
GST_INFO ("Context, EXT_framebuffer_object supported: yes");
|
GST_INFO ("Context, EXT_framebuffer_object supported: yes");
|
||||||
|
|
||||||
|
@ -667,7 +670,14 @@ _init_download (GstGLDisplay * display, GstGLDownload * download)
|
||||||
}
|
}
|
||||||
|
|
||||||
no_convert:
|
no_convert:
|
||||||
_init_download_shader (display, download);
|
download->priv->result = _init_download_shader (display, download);
|
||||||
|
return;
|
||||||
|
|
||||||
|
error:
|
||||||
|
{
|
||||||
|
download->priv->result = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -698,7 +708,7 @@ _create_shader (GstGLDisplay * display, const gchar * vertex_src,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
_init_download_shader (GstGLDisplay * display, GstGLDownload * download)
|
_init_download_shader (GstGLDisplay * display, GstGLDownload * download)
|
||||||
{
|
{
|
||||||
GstGLFuncs *gl;
|
GstGLFuncs *gl;
|
||||||
|
@ -721,7 +731,7 @@ _init_download_shader (GstGLDisplay * display, GstGLDownload * download)
|
||||||
case GST_VIDEO_FORMAT_ABGR:
|
case GST_VIDEO_FORMAT_ABGR:
|
||||||
case GST_VIDEO_FORMAT_RGB:
|
case GST_VIDEO_FORMAT_RGB:
|
||||||
case GST_VIDEO_FORMAT_BGR:
|
case GST_VIDEO_FORMAT_BGR:
|
||||||
return;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -737,7 +747,7 @@ _init_download_shader (GstGLDisplay * display, GstGLDownload * download)
|
||||||
/* colorspace conversion is not possible */
|
/* colorspace conversion is not possible */
|
||||||
gst_gl_display_set_error (display,
|
gst_gl_display_set_error (display,
|
||||||
"Context, ARB_fragment_shader supported: no");
|
"Context, ARB_fragment_shader supported: no");
|
||||||
return;
|
return FALSE;;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (v_format) {
|
switch (v_format) {
|
||||||
|
@ -850,14 +860,18 @@ _init_download_shader (GstGLDisplay * display, GstGLDownload * download)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
gst_gl_display_set_error (display,
|
gst_gl_display_set_error (display,
|
||||||
"Unsupported download video format %d", v_format);
|
"Unsupported download video format %d", v_format);
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called in the gl thread */
|
/* Called in the gl thread */
|
||||||
|
@ -902,6 +916,8 @@ _do_download (GstGLDisplay * display, GstGLDownload * download)
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
download->priv->result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GST_GL_HAVE_OPENGL
|
#if GST_GL_HAVE_OPENGL
|
||||||
|
|
Loading…
Reference in a new issue