mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
examples/sdlshare: Initialize GL as part of the event loop
And unref additional buffers we never use for rendering directly instead of going via the output queue.
This commit is contained in:
parent
0bcba6a3ec
commit
e750ea40b6
1 changed files with 9 additions and 4 deletions
|
@ -216,6 +216,8 @@ sdl_event_loop (GstBus * bus)
|
||||||
SDL_GL_MakeCurrent (sdl_window, sdl_gl_context);
|
SDL_GL_MakeCurrent (sdl_window, sdl_gl_context);
|
||||||
SDL_GL_SetSwapInterval (1);
|
SDL_GL_SetSwapInterval (1);
|
||||||
|
|
||||||
|
InitGL (640, 480);
|
||||||
|
|
||||||
while (!quit) {
|
while (!quit) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
|
@ -270,9 +272,14 @@ sdl_event_loop (GstBus * bus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buf) {
|
||||||
|
g_async_queue_push (queue_output_buf, buf);
|
||||||
|
buf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
while (g_async_queue_length (queue_input_buf) > 3) {
|
while (g_async_queue_length (queue_input_buf) > 3) {
|
||||||
if (buf)
|
if (buf)
|
||||||
g_async_queue_push (queue_output_buf, buf);
|
gst_buffer_unref (buf);
|
||||||
buf = (GstBuffer *) g_async_queue_pop (queue_input_buf);
|
buf = (GstBuffer *) g_async_queue_pop (queue_input_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,13 +336,11 @@ main (int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create GL context and a wrapped GStreamer context around it */
|
||||||
sdl_gl_context = SDL_GL_CreateContext (sdl_window);
|
sdl_gl_context = SDL_GL_CreateContext (sdl_window);
|
||||||
|
|
||||||
SDL_GL_MakeCurrent (sdl_window, sdl_gl_context);
|
SDL_GL_MakeCurrent (sdl_window, sdl_gl_context);
|
||||||
|
|
||||||
/* Loop, drawing and checking events */
|
|
||||||
InitGL (640, 480);
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
gl_context = wglGetCurrentContext ();
|
gl_context = wglGetCurrentContext ();
|
||||||
sdl_dc = wglGetCurrentDC ();
|
sdl_dc = wglGetCurrentDC ();
|
||||||
|
|
Loading…
Reference in a new issue