mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
eglglessink: Correctly implement ::expose()
We don't need the past buffer for this, the old one is still available as texture and we just need to draw our rectangle again.
This commit is contained in:
parent
18e473307f
commit
2323c40f1b
1 changed files with 131 additions and 137 deletions
|
@ -1163,9 +1163,6 @@ gst_eglglessink_create_window (GstEglGlesSink * eglglessink, gint width,
|
|||
return window;
|
||||
}
|
||||
|
||||
/* XXX: Should implement (redisplay)
|
||||
* We need at least the last buffer stored for this to work
|
||||
*/
|
||||
static void
|
||||
gst_eglglessink_expose (GstXOverlay * overlay)
|
||||
{
|
||||
|
@ -1178,7 +1175,6 @@ gst_eglglessink_expose (GstXOverlay * overlay)
|
|||
/* Logic would be to get _render_and_display() to use
|
||||
* last seen buffer to render from when NULL it's
|
||||
* passed on */
|
||||
GST_WARNING_OBJECT (eglglessink, "_expose() not implemented");
|
||||
ret = gst_eglglessink_render_and_display (eglglessink, NULL);
|
||||
if (ret == GST_FLOW_ERROR)
|
||||
GST_ERROR_OBJECT (eglglessink, "Redisplay failed");
|
||||
|
@ -1814,17 +1810,12 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
};
|
||||
#endif
|
||||
|
||||
if (!buf) {
|
||||
GST_ERROR_OBJECT (eglglessink, "Null buffer, no past queue implemented");
|
||||
goto HANDLE_ERROR;
|
||||
}
|
||||
|
||||
w = GST_VIDEO_SINK_WIDTH (eglglessink);
|
||||
h = GST_VIDEO_SINK_HEIGHT (eglglessink);
|
||||
|
||||
GST_DEBUG_OBJECT (eglglessink,
|
||||
"Got good buffer %p. Sink geometry is %dx%d size %d", buf, w, h,
|
||||
GST_BUFFER_SIZE (buf));
|
||||
buf ? GST_BUFFER_SIZE (buf) : -1);
|
||||
|
||||
switch (eglglessink->rendering_path) {
|
||||
#ifdef EGL_FAST_RENDERING_POSSIBLE
|
||||
|
@ -1845,6 +1836,7 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
#endif
|
||||
default: /* case GST_EGLGLESSINK_RENDER_SLOW */
|
||||
|
||||
if (buf) {
|
||||
switch (eglglessink->selected_fmt->fmt) {
|
||||
case GST_EGLGLESSINK_IMAGE_RGB888:
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
|
@ -1887,10 +1879,10 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
gint coffset, cw, ch;
|
||||
|
||||
coffset =
|
||||
gst_video_format_get_component_offset (eglglessink->format, 0,
|
||||
w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format, 0,
|
||||
w);
|
||||
gst_video_format_get_component_offset (eglglessink->format,
|
||||
0, w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format,
|
||||
0, w);
|
||||
ch = gst_video_format_get_component_height (eglglessink->format,
|
||||
0, h);
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
|
@ -1899,10 +1891,10 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
cw, ch, 0, GL_LUMINANCE,
|
||||
GL_UNSIGNED_BYTE, GST_BUFFER_DATA (buf) + coffset);
|
||||
coffset =
|
||||
gst_video_format_get_component_offset (eglglessink->format, 1,
|
||||
w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format, 1,
|
||||
w);
|
||||
gst_video_format_get_component_offset (eglglessink->format,
|
||||
1, w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format,
|
||||
1, w);
|
||||
ch = gst_video_format_get_component_height (eglglessink->format,
|
||||
1, h);
|
||||
glActiveTexture (GL_TEXTURE1);
|
||||
|
@ -1911,10 +1903,10 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
cw, ch, 0, GL_LUMINANCE,
|
||||
GL_UNSIGNED_BYTE, GST_BUFFER_DATA (buf) + coffset);
|
||||
coffset =
|
||||
gst_video_format_get_component_offset (eglglessink->format, 2,
|
||||
w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format, 2,
|
||||
w);
|
||||
gst_video_format_get_component_offset (eglglessink->format,
|
||||
2, w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format,
|
||||
2, w);
|
||||
ch = gst_video_format_get_component_height (eglglessink->format,
|
||||
2, h);
|
||||
glActiveTexture (GL_TEXTURE2);
|
||||
|
@ -1942,10 +1934,10 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
gint coffset, cw, ch;
|
||||
|
||||
coffset =
|
||||
gst_video_format_get_component_offset (eglglessink->format, 0,
|
||||
w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format, 0,
|
||||
w);
|
||||
gst_video_format_get_component_offset (eglglessink->format,
|
||||
0, w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format,
|
||||
0, w);
|
||||
ch = gst_video_format_get_component_height (eglglessink->format,
|
||||
0, h);
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
|
@ -1956,9 +1948,10 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
|
||||
coffset =
|
||||
gst_video_format_get_component_offset (eglglessink->format,
|
||||
(eglglessink->format == GST_VIDEO_FORMAT_NV12 ? 1 : 2), w, h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format, 1,
|
||||
w);
|
||||
(eglglessink->format == GST_VIDEO_FORMAT_NV12 ? 1 : 2), w,
|
||||
h);
|
||||
cw = gst_video_format_get_component_width (eglglessink->format,
|
||||
1, w);
|
||||
ch = gst_video_format_get_component_height (eglglessink->format,
|
||||
1, h);
|
||||
glActiveTexture (GL_TEXTURE1);
|
||||
|
@ -1976,6 +1969,7 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
|
|||
|
||||
if (got_gl_error ("glTexImage2D"))
|
||||
goto HANDLE_ERROR;
|
||||
}
|
||||
|
||||
/* If no one has set a display rectangle on us initialize
|
||||
* a sane default. According to the docs on the xOverlay
|
||||
|
|
Loading…
Reference in a new issue