mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 00:58:12 +00:00
[490/906] gldisplay: error out instead of g_assert
This commit is contained in:
parent
20ac2cc4aa
commit
2394987226
6 changed files with 131 additions and 83 deletions
|
@ -716,7 +716,8 @@ gst_gl_display_thread_destroy_context (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
GST_ERROR ("Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display->upload_fbo) {
|
if (display->upload_fbo) {
|
||||||
|
@ -1048,7 +1049,9 @@ gst_gl_display_thread_init_upload (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//check if YCBCR MESA is available
|
//check if YCBCR MESA is available
|
||||||
|
@ -1078,7 +1081,9 @@ gst_gl_display_thread_init_upload (GstGLDisplay * display)
|
||||||
"Your MESA version only supports YUY2 and UYVY (GLSL is required for others yuv formats)");
|
"Your MESA version only supports YUY2 and UYVY (GLSL is required for others yuv formats)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//check if color matrix is available
|
//check if color matrix is available
|
||||||
|
@ -1102,7 +1107,8 @@ gst_gl_display_thread_init_upload (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1155,12 +1161,14 @@ gst_gl_display_thread_do_upload (GstGLDisplay * display)
|
||||||
gst_gl_display_thread_do_upload_draw (display);
|
gst_gl_display_thread_do_upload_draw (display);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1288,7 +1296,9 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
|
||||||
display->multipleRT[2] = GL_COLOR_ATTACHMENT2_EXT;
|
display->multipleRT[2] = GL_COLOR_ATTACHMENT2_EXT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Unsupported download video format %d",
|
||||||
|
display->download_video_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
//attach the depth render buffer to the FBO
|
//attach the depth render buffer to the FBO
|
||||||
|
@ -1304,8 +1314,10 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
|
||||||
|
|
||||||
gst_gl_display_check_framebuffer_status ();
|
gst_gl_display_check_framebuffer_status ();
|
||||||
|
|
||||||
g_assert (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) ==
|
if (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) !=
|
||||||
GL_FRAMEBUFFER_COMPLETE_EXT);
|
GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||||
|
gst_gl_display_set_error (display,
|
||||||
|
"GL framebuffer status incomplete");
|
||||||
|
|
||||||
//unbind the FBO
|
//unbind the FBO
|
||||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||||
|
@ -1318,7 +1330,8 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported download video format %d",
|
||||||
|
display->download_video_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (display->download_video_format) {
|
switch (display->download_video_format) {
|
||||||
|
@ -1511,7 +1524,9 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Unsupported download video format %d",
|
||||||
|
display->download_video_format);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//turn off the pipeline because colorspace conversion is not possible
|
//turn off the pipeline because colorspace conversion is not possible
|
||||||
|
@ -1521,7 +1536,8 @@ gst_gl_display_thread_init_download (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported download video format %d",
|
||||||
|
display->download_video_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1553,7 +1569,8 @@ gst_gl_display_thread_do_download (GstGLDisplay * display)
|
||||||
gst_gl_display_thread_do_download_draw_yuv (display);
|
gst_gl_display_thread_do_download_draw_yuv (display);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported download video format %d",
|
||||||
|
display->download_video_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,8 +1633,9 @@ gst_gl_display_thread_gen_fbo (GstGLDisplay * display)
|
||||||
GL_RENDERBUFFER_EXT, display->generated_depth_buffer);
|
GL_RENDERBUFFER_EXT, display->generated_depth_buffer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_assert (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) ==
|
if (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) !=
|
||||||
GL_FRAMEBUFFER_COMPLETE_EXT);
|
GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||||
|
gst_gl_display_set_error (display, "GL framebuffer status incomplete");
|
||||||
|
|
||||||
//unbind the FBO
|
//unbind the FBO
|
||||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||||
|
@ -1663,7 +1681,8 @@ gst_gl_display_thread_use_fbo (GstGLDisplay * display)
|
||||||
display->use_fbo_proj_param4);
|
display->use_fbo_proj_param4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow fbo projection %d",
|
||||||
|
display->use_fbo_projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
glMatrixMode (GL_MODELVIEW);
|
glMatrixMode (GL_MODELVIEW);
|
||||||
|
@ -2019,7 +2038,8 @@ gst_gl_display_glgen_texture (GstGLDisplay * display, GLuint * pTexture,
|
||||||
height, 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, NULL);
|
height, 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
|
@ -2029,7 +2049,8 @@ gst_gl_display_glgen_texture (GstGLDisplay * display, GLuint * pTexture,
|
||||||
width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri (GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
@ -2646,8 +2667,9 @@ gst_gl_display_thread_init_upload_fbo (GstGLDisplay * display)
|
||||||
|
|
||||||
gst_gl_display_check_framebuffer_status ();
|
gst_gl_display_check_framebuffer_status ();
|
||||||
|
|
||||||
g_assert (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) ==
|
if (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) !=
|
||||||
GL_FRAMEBUFFER_COMPLETE_EXT);
|
GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||||
|
gst_gl_display_set_error (display, "GL framebuffer status incomplete");
|
||||||
|
|
||||||
//unbind the FBO
|
//unbind the FBO
|
||||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||||
|
@ -2710,7 +2732,8 @@ gst_gl_display_thread_do_upload_make (GstGLDisplay * display)
|
||||||
height, 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, NULL);
|
height, 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_UYVY:
|
case GST_VIDEO_FORMAT_UYVY:
|
||||||
|
@ -2729,7 +2752,8 @@ gst_gl_display_thread_do_upload_make (GstGLDisplay * display)
|
||||||
height, 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, NULL);
|
height, 0, GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
|
@ -2751,7 +2775,8 @@ gst_gl_display_thread_do_upload_make (GstGLDisplay * display)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2800,11 +2825,13 @@ gst_gl_display_thread_do_upload_fill (GstGLDisplay * display)
|
||||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_outtex);
|
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->upload_outtex);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (display->upload_video_format) {
|
switch (display->upload_video_format) {
|
||||||
|
@ -2854,7 +2881,8 @@ gst_gl_display_thread_do_upload_fill (GstGLDisplay * display)
|
||||||
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, data);
|
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_REV_MESA, data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_UYVY:
|
case GST_VIDEO_FORMAT_UYVY:
|
||||||
|
@ -2874,7 +2902,8 @@ gst_gl_display_thread_do_upload_fill (GstGLDisplay * display)
|
||||||
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, data);
|
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_VIDEO_FORMAT_I420:
|
case GST_VIDEO_FORMAT_I420:
|
||||||
|
@ -2901,7 +2930,8 @@ gst_gl_display_thread_do_upload_fill (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
//make sure no texture is in use in our opengl context
|
//make sure no texture is in use in our opengl context
|
||||||
|
@ -3025,7 +3055,9 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
|
||||||
shader_upload_YUY2_UYVY = display->shader_upload_UYVY;
|
shader_upload_YUY2_UYVY = display->shader_upload_UYVY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Upload video format inconsistency %d",
|
||||||
|
display->upload_video_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_gl_shader_use (shader_upload_YUY2_UYVY);
|
gst_gl_shader_use (shader_upload_YUY2_UYVY);
|
||||||
|
@ -3092,7 +3124,8 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unknow colorspace conversion %d",
|
||||||
|
display->upload_colorspace_conversion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3188,7 +3221,8 @@ gst_gl_display_thread_do_upload_draw (GstGLDisplay * display)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display, "Unsupported upload video format %d",
|
||||||
|
display->upload_video_format);
|
||||||
|
|
||||||
} //end switch display->currentVideo_format
|
} //end switch display->currentVideo_format
|
||||||
|
|
||||||
|
@ -3240,7 +3274,8 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
|
||||||
gpointer data = display->download_data;
|
gpointer data = display->download_data;
|
||||||
|
|
||||||
#ifndef OPENGL_ES2
|
#ifndef OPENGL_ES2
|
||||||
glUseProgramObjectARB (0);
|
if (display->upload_colorspace_conversion == GST_GL_DISPLAY_CONVERSION_GLSL)
|
||||||
|
glUseProgramObjectARB (0);
|
||||||
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
glEnable (GL_TEXTURE_RECTANGLE_ARB);
|
||||||
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->ouput_texture);
|
glBindTexture (GL_TEXTURE_RECTANGLE_ARB, display->ouput_texture);
|
||||||
#else
|
#else
|
||||||
|
@ -3320,7 +3355,8 @@ gst_gl_display_thread_do_download_draw_rgb (GstGLDisplay * display)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Download video format inconsistency %d", video_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef OPENGL_ES2
|
#ifndef OPENGL_ES2
|
||||||
|
@ -3389,7 +3425,8 @@ gst_gl_display_thread_do_download_draw_yuv (GstGLDisplay * display)
|
||||||
shader_download_YUY2_UYVY = display->shader_download_UYVY;
|
shader_download_YUY2_UYVY = display->shader_download_UYVY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Download video format inconsistensy %d", video_format);
|
||||||
}
|
}
|
||||||
#ifndef OPENGL_ES2
|
#ifndef OPENGL_ES2
|
||||||
glDrawBuffer (GL_COLOR_ATTACHMENT0_EXT);
|
glDrawBuffer (GL_COLOR_ATTACHMENT0_EXT);
|
||||||
|
@ -3478,7 +3515,8 @@ gst_gl_display_thread_do_download_draw_yuv (GstGLDisplay * display)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Download video format inconsistensy %d", video_format);
|
||||||
|
|
||||||
} //end switch display->currentVideo_format
|
} //end switch display->currentVideo_format
|
||||||
|
|
||||||
|
@ -3559,7 +3597,8 @@ gst_gl_display_thread_do_download_draw_yuv (GstGLDisplay * display)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
gst_gl_display_set_error (display,
|
||||||
|
"Download video format inconsistensy %d", video_format);
|
||||||
}
|
}
|
||||||
#ifndef OPENGL_ES2
|
#ifndef OPENGL_ES2
|
||||||
glReadBuffer (GL_NONE);
|
glReadBuffer (GL_NONE);
|
||||||
|
|
|
@ -623,7 +623,7 @@ gst_gl_mixer_query (GstPad * pad, GstQuery * query)
|
||||||
GstPad *peer = gst_pad_get_peer (GST_PAD_CAST (sink_pad));
|
GstPad *peer = gst_pad_get_peer (GST_PAD_CAST (sink_pad));
|
||||||
walk = g_slist_next (walk);
|
walk = g_slist_next (walk);
|
||||||
|
|
||||||
g_assert (sink_pad->display != NULL);
|
g_return_val_if_fail (sink_pad->display != NULL, FALSE);
|
||||||
|
|
||||||
gst_gl_display_activate_gl_context (foreign_display, FALSE);
|
gst_gl_display_activate_gl_context (foreign_display, FALSE);
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ gst_gl_shader_init (GstGLShader * self)
|
||||||
priv->vertex_handle = 0;
|
priv->vertex_handle = 0;
|
||||||
priv->program_handle = glCreateProgramObjectARB ();
|
priv->program_handle = glCreateProgramObjectARB ();
|
||||||
|
|
||||||
g_assert (priv->program_handle);
|
g_return_if_fail (priv->program_handle);
|
||||||
|
|
||||||
priv->compiled = FALSE;
|
priv->compiled = FALSE;
|
||||||
priv->active = FALSE; // unused at the moment
|
priv->active = FALSE; // unused at the moment
|
||||||
|
@ -290,7 +290,7 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error)
|
||||||
if (priv->compiled)
|
if (priv->compiled)
|
||||||
return priv->compiled;
|
return priv->compiled;
|
||||||
|
|
||||||
g_assert (priv->program_handle);
|
g_return_val_if_fail (priv->program_handle, FALSE);
|
||||||
|
|
||||||
if (priv->vertex_src) {
|
if (priv->vertex_src) {
|
||||||
/* create vertex object */
|
/* create vertex object */
|
||||||
|
@ -384,7 +384,7 @@ gst_gl_shader_release (GstGLShader * shader)
|
||||||
|
|
||||||
priv = shader->priv;
|
priv = shader->priv;
|
||||||
|
|
||||||
g_assert (priv->program_handle);
|
g_return_if_fail (priv->program_handle);
|
||||||
|
|
||||||
if (!priv->compiled)
|
if (!priv->compiled)
|
||||||
return;
|
return;
|
||||||
|
@ -428,7 +428,7 @@ gst_gl_shader_use (GstGLShader * shader)
|
||||||
|
|
||||||
priv = shader->priv;
|
priv = shader->priv;
|
||||||
|
|
||||||
g_assert (priv->program_handle);
|
g_return_if_fail (priv->program_handle);
|
||||||
|
|
||||||
glUseProgramObjectARB (priv->program_handle);
|
glUseProgramObjectARB (priv->program_handle);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,8 @@ G_DEFINE_TYPE (GstGLWindow, gst_gl_window, G_TYPE_OBJECT);
|
||||||
|
|
||||||
gboolean _gst_gl_window_debug = FALSE;
|
gboolean _gst_gl_window_debug = FALSE;
|
||||||
|
|
||||||
void gst_gl_window_init_platform ()
|
void
|
||||||
|
gst_gl_window_init_platform ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,14 +174,15 @@ gst_gl_window_new (DWORD_PTR external_gl_context)
|
||||||
x, y, 0, 0, (HWND) NULL, (HMENU) NULL, hinstance, window);
|
x, y, 0, 0, (HWND) NULL, (HMENU) NULL, hinstance, window);
|
||||||
|
|
||||||
if (!priv->internal_win_id) {
|
if (!priv->internal_win_id) {
|
||||||
g_debug ("failed to create gl window: %lud\n", (gulong) priv->internal_win_id);
|
g_debug ("failed to create gl window: %lud\n",
|
||||||
|
(gulong) priv->internal_win_id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug ("gl window created: %lud\n", (gulong) priv->internal_win_id);
|
g_debug ("gl window created: %lud\n", (gulong) priv->internal_win_id);
|
||||||
|
|
||||||
//device is set in the window_proc
|
//device is set in the window_proc
|
||||||
g_assert (priv->device);
|
g_return_val_if_fail (priv->device, NULL);
|
||||||
|
|
||||||
ShowCursor (TRUE);
|
ShowCursor (TRUE);
|
||||||
|
|
||||||
|
@ -194,34 +196,36 @@ gst_gl_window_error_quark (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
gulong
|
gulong
|
||||||
gst_gl_window_get_internal_gl_context (GstGLWindow *window)
|
gst_gl_window_get_internal_gl_context (GstGLWindow * window)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
return (gulong) priv->gl_context;
|
return (gulong) priv->gl_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
callback_activate_gl_context (GstGLWindowPrivate *priv)
|
callback_activate_gl_context (GstGLWindowPrivate * priv)
|
||||||
{
|
{
|
||||||
if (!wglMakeCurrent (priv->device, priv->gl_context))
|
if (!wglMakeCurrent (priv->device, priv->gl_context))
|
||||||
g_debug ("failed to activate opengl context %lud\n", GetLastError ());
|
g_debug ("failed to activate opengl context %lud\n", GetLastError ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
callback_inactivate_gl_context (GstGLWindowPrivate *priv)
|
callback_inactivate_gl_context (GstGLWindowPrivate * priv)
|
||||||
{
|
{
|
||||||
if (!wglMakeCurrent (NULL, NULL))
|
if (!wglMakeCurrent (NULL, NULL))
|
||||||
g_debug ("failed to inactivate opengl context %lud\n", GetLastError ());
|
g_debug ("failed to inactivate opengl context %lud\n", GetLastError ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_gl_window_activate_gl_context (GstGLWindow *window, gboolean activate)
|
gst_gl_window_activate_gl_context (GstGLWindow * window, gboolean activate)
|
||||||
{
|
{
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
if (activate)
|
if (activate)
|
||||||
gst_gl_window_send_message (window, GST_GL_WINDOW_CB (callback_activate_gl_context), priv);
|
gst_gl_window_send_message (window,
|
||||||
|
GST_GL_WINDOW_CB (callback_activate_gl_context), priv);
|
||||||
else
|
else
|
||||||
gst_gl_window_send_message (window, GST_GL_WINDOW_CB (callback_inactivate_gl_context), priv);
|
gst_gl_window_send_message (window,
|
||||||
|
GST_GL_WINDOW_CB (callback_inactivate_gl_context), priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -233,16 +237,16 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
||||||
HWND parent_id = GetProp (priv->internal_win_id, "gl_window_parent_id");
|
HWND parent_id = GetProp (priv->internal_win_id, "gl_window_parent_id");
|
||||||
|
|
||||||
if (priv->visible) {
|
if (priv->visible) {
|
||||||
ShowWindow (priv->internal_win_id, SW_HIDE);
|
ShowWindow (priv->internal_win_id, SW_HIDE);
|
||||||
priv->visible = FALSE;
|
priv->visible = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent_id) {
|
if (parent_id) {
|
||||||
WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc");
|
WNDPROC parent_proc = GetProp (parent_id, "gl_window_parent_proc");
|
||||||
|
|
||||||
g_debug ("release parent %lud\n", (gulong) parent_id);
|
g_debug ("release parent %lud\n", (gulong) parent_id);
|
||||||
|
|
||||||
g_assert (parent_proc);
|
g_return_if_fail (parent_proc);
|
||||||
|
|
||||||
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc);
|
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc);
|
||||||
SetParent (priv->internal_win_id, NULL);
|
SetParent (priv->internal_win_id, NULL);
|
||||||
|
@ -250,7 +254,6 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
||||||
RemoveProp (parent_id, "gl_window_parent_proc");
|
RemoveProp (parent_id, "gl_window_parent_proc");
|
||||||
RemoveProp (priv->internal_win_id, "gl_window_parent_id");
|
RemoveProp (priv->internal_win_id, "gl_window_parent_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
//not 0
|
//not 0
|
||||||
if (id) {
|
if (id) {
|
||||||
WNDPROC window_parent_proc =
|
WNDPROC window_parent_proc =
|
||||||
|
@ -278,7 +281,7 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
||||||
} else {
|
} else {
|
||||||
//no parent so the internal window needs borders and system menu
|
//no parent so the internal window needs borders and system menu
|
||||||
SetWindowLongPtr (priv->internal_win_id, GWL_STYLE,
|
SetWindowLongPtr (priv->internal_win_id, GWL_STYLE,
|
||||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
|
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,8 +338,11 @@ gst_gl_window_draw (GstGLWindow * window, gint width, gint height)
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetClientRect (priv->internal_win_id, &rect);
|
GetClientRect (priv->internal_win_id, &rect);
|
||||||
width += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
width += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
||||||
height += 2 * GetSystemMetrics (SM_CYSIZEFRAME) + GetSystemMetrics (SM_CYCAPTION);
|
height +=
|
||||||
MoveWindow (priv->internal_win_id, rect.left, rect.top, width, height, FALSE);
|
2 * GetSystemMetrics (SM_CYSIZEFRAME) +
|
||||||
|
GetSystemMetrics (SM_CYCAPTION);
|
||||||
|
MoveWindow (priv->internal_win_id, rect.left, rect.top, width, height,
|
||||||
|
FALSE);
|
||||||
}
|
}
|
||||||
ShowWindowAsync (priv->internal_win_id, SW_SHOW);
|
ShowWindowAsync (priv->internal_win_id, SW_SHOW);
|
||||||
|
|
||||||
|
@ -378,7 +384,7 @@ gst_gl_window_quit_loop (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
LRESULT res = PostMessage (priv->internal_win_id, WM_GST_GL_WINDOW_QUIT,
|
LRESULT res = PostMessage (priv->internal_win_id, WM_GST_GL_WINDOW_QUIT,
|
||||||
(WPARAM) data, (LPARAM) callback);
|
(WPARAM) data, (LPARAM) callback);
|
||||||
g_assert (SUCCEEDED (res));
|
g_return_if_fail (SUCCEEDED (res));
|
||||||
g_debug ("end loop requested\n");
|
g_debug ("end loop requested\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,7 +398,7 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
LRESULT res = SendMessage (priv->internal_win_id, WM_GST_GL_WINDOW_CUSTOM,
|
LRESULT res = SendMessage (priv->internal_win_id, WM_GST_GL_WINDOW_CUSTOM,
|
||||||
(WPARAM) data, (LPARAM) callback);
|
(WPARAM) data, (LPARAM) callback);
|
||||||
g_assert (SUCCEEDED (res));
|
g_return_if_fail (SUCCEEDED (res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,11 +443,11 @@ gst_gl_window_set_pixel_format (GstGLWindow * window)
|
||||||
|
|
||||||
pixelformat = ChoosePixelFormat (priv->device, &pfd);
|
pixelformat = ChoosePixelFormat (priv->device, &pfd);
|
||||||
|
|
||||||
g_assert (pixelformat);
|
g_return_if_fail (pixelformat);
|
||||||
|
|
||||||
res = SetPixelFormat (priv->device, pixelformat, &pfd);
|
res = SetPixelFormat (priv->device, pixelformat, &pfd);
|
||||||
|
|
||||||
g_assert (res);
|
g_return_if_fail (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
|
@ -469,15 +475,16 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
g_assert (priv->gl_context);
|
g_assert (priv->gl_context);
|
||||||
ReleaseDC (hWnd, priv->device);
|
ReleaseDC (hWnd, priv->device);
|
||||||
if (!wglMakeCurrent (priv->device, priv->gl_context))
|
if (!wglMakeCurrent (priv->device, priv->gl_context))
|
||||||
g_debug ("failed to make opengl context current %lud, %lud\n", (gulong) hWnd,
|
g_debug ("failed to make opengl context current %lud, %lud\n",
|
||||||
GetLastError ());
|
(gulong) hWnd, GetLastError ());
|
||||||
|
|
||||||
if (priv->external_gl_context) {
|
if (priv->external_gl_context) {
|
||||||
if (!wglShareLists (priv->external_gl_context, priv->gl_context))
|
if (!wglShareLists (priv->external_gl_context, priv->gl_context))
|
||||||
g_debug ("failed to share opengl context %lud with %lud\n",
|
g_debug ("failed to share opengl context %lud with %lud\n",
|
||||||
(gulong) priv->gl_context, (gulong) priv->external_gl_context);
|
(gulong) priv->gl_context, (gulong) priv->external_gl_context);
|
||||||
else
|
else
|
||||||
g_debug ("share opengl context succeed %lud\n", (gulong) priv->external_gl_context);
|
g_debug ("share opengl context succeed %lud\n",
|
||||||
|
(gulong) priv->external_gl_context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,7 +504,8 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
g_assert (priv->internal_win_id == hWnd);
|
g_assert (priv->internal_win_id == hWnd);
|
||||||
|
|
||||||
g_assert (!wglGetCurrentContext() || priv->gl_context == wglGetCurrentContext ());
|
g_assert (!wglGetCurrentContext ()
|
||||||
|
|| priv->gl_context == wglGetCurrentContext ());
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
|
|
||||||
|
@ -552,8 +560,7 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
g_assert (parent_proc);
|
g_assert (parent_proc);
|
||||||
|
|
||||||
SetWindowLongPtr (parent_id, GWL_WNDPROC,
|
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc);
|
||||||
(LONG) parent_proc);
|
|
||||||
SetParent (hWnd, NULL);
|
SetParent (hWnd, NULL);
|
||||||
|
|
||||||
RemoveProp (parent_id, "gl_window_parent_proc");
|
RemoveProp (parent_id, "gl_window_parent_proc");
|
||||||
|
@ -564,12 +571,13 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
RemoveProp (hWnd, "gl_window");
|
RemoveProp (hWnd, "gl_window");
|
||||||
|
|
||||||
if (!wglMakeCurrent (NULL, NULL))
|
if (!wglMakeCurrent (NULL, NULL))
|
||||||
g_debug ("failed to make current %lud, %lud\n", (gulong) hWnd, GetLastError ());
|
g_debug ("failed to make current %lud, %lud\n", (gulong) hWnd,
|
||||||
|
GetLastError ());
|
||||||
|
|
||||||
if (priv->gl_context) {
|
if (priv->gl_context) {
|
||||||
if (!wglDeleteContext (priv->gl_context))
|
if (!wglDeleteContext (priv->gl_context))
|
||||||
g_debug ("failed to destroy context %lud, %lud\n", (gulong) priv->gl_context,
|
g_debug ("failed to destroy context %lud, %lud\n",
|
||||||
GetLastError ());
|
(gulong) priv->gl_context, GetLastError ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->internal_win_id) {
|
if (priv->internal_win_id) {
|
||||||
|
@ -603,13 +611,13 @@ window_proc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
/* transmit messages to the parrent (ex: mouse/keyboard input) */
|
/* transmit messages to the parrent (ex: mouse/keyboard input) */
|
||||||
HWND parent_id = GetProp (hWnd, "gl_window_parent_id");
|
HWND parent_id = GetProp (hWnd, "gl_window_parent_id");
|
||||||
if (parent_id)
|
if (parent_id)
|
||||||
PostMessage (parent_id, uMsg, wParam, lParam);
|
PostMessage (parent_id, uMsg, wParam, lParam);
|
||||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -66,7 +66,8 @@ G_DEFINE_TYPE (GstGLWindow, gst_gl_window, G_TYPE_OBJECT);
|
||||||
|
|
||||||
gboolean _gst_gl_window_debug = FALSE;
|
gboolean _gst_gl_window_debug = FALSE;
|
||||||
|
|
||||||
void gst_gl_window_init_platform ()
|
void
|
||||||
|
gst_gl_window_init_platform ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +252,7 @@ gst_gl_window_set_external_window_id (GstGLWindow * window, gulong id)
|
||||||
|
|
||||||
g_debug ("release parent %lud\n", (gulong) parent_id);
|
g_debug ("release parent %lud\n", (gulong) parent_id);
|
||||||
|
|
||||||
g_assert (parent_proc);
|
g_return_if_fail (parent_proc);
|
||||||
|
|
||||||
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc);
|
SetWindowLongPtr (parent_id, GWL_WNDPROC, (LONG) parent_proc);
|
||||||
SetParent (priv->internal_win_id, NULL);
|
SetParent (priv->internal_win_id, NULL);
|
||||||
|
@ -389,7 +390,7 @@ gst_gl_window_quit_loop (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
LRESULT res = PostMessage (priv->internal_win_id, WM_GST_GL_WINDOW_QUIT,
|
LRESULT res = PostMessage (priv->internal_win_id, WM_GST_GL_WINDOW_QUIT,
|
||||||
(WPARAM) data, (LPARAM) callback);
|
(WPARAM) data, (LPARAM) callback);
|
||||||
g_assert (SUCCEEDED (res));
|
g_return_if_fail (SUCCEEDED (res));
|
||||||
g_debug ("end loop requested\n");
|
g_debug ("end loop requested\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,7 +404,7 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
|
||||||
GstGLWindowPrivate *priv = window->priv;
|
GstGLWindowPrivate *priv = window->priv;
|
||||||
LRESULT res = SendMessage (priv->internal_win_id, WM_GST_GL_WINDOW_CUSTOM,
|
LRESULT res = SendMessage (priv->internal_win_id, WM_GST_GL_WINDOW_CUSTOM,
|
||||||
(WPARAM) data, (LPARAM) callback);
|
(WPARAM) data, (LPARAM) callback);
|
||||||
g_assert (SUCCEEDED (res));
|
g_return_if_fail (SUCCEEDED (res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -515,7 +515,7 @@ gst_gl_test_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
|
||||||
src->running_time = 0;
|
src->running_time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert (src->running_time <= time);
|
g_return_val_if_fail (src->running_time <= time, FALSE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue