From 9f60e48a98d277aa8526e62a74edf692dfab6e1d Mon Sep 17 00:00:00 2001 From: Themaister Date: Sat, 23 Jun 2012 18:01:01 +0200 Subject: [PATCH] Redefine behavior of NULL in video_frame(). --- gfx/ext_gfx.c | 3 +++ gfx/gl.c | 8 +++++--- gfx/sdl_gfx.c | 3 +++ gfx/xvideo.c | 3 +++ retroarch.c | 16 ++++++---------- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/gfx/ext_gfx.c b/gfx/ext_gfx.c index be8736044e..5535cf4238 100644 --- a/gfx/ext_gfx.c +++ b/gfx/ext_gfx.c @@ -177,6 +177,9 @@ static void video_ext_set_nonblock_state(void *data, bool state) static bool video_ext_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg) { + if (!frame) + return true; + ext_t *ext = (ext_t*)data; return ext->driver->frame(ext->handle, frame, width, height, pitch, msg); } diff --git a/gfx/gl.c b/gfx/gl.c index a1e76f41d2..3b2b7a4fda 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -897,9 +897,11 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei gl_update_resize(gl); } - gl_update_input_size(gl, width, height, pitch); - - gl_copy_frame(gl, frame, width, height, pitch); + if (frame) // Can be NULL for frame dupe / NULL render. + { + gl_update_input_size(gl, width, height, pitch); + gl_copy_frame(gl, frame, width, height, pitch); + } struct gl_tex_info tex_info = {0}; tex_info.tex = gl->texture[gl->tex_index]; diff --git a/gfx/sdl_gfx.c b/gfx/sdl_gfx.c index 64dddcc882..56d07e3846 100644 --- a/gfx/sdl_gfx.c +++ b/gfx/sdl_gfx.c @@ -470,6 +470,9 @@ static void check_window(sdl_video_t *vid) static bool sdl_gfx_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg) { + if (!frame) + return true; + sdl_video_t *vid = (sdl_video_t*)data; if (SDL_MUSTLOCK(vid->buffer)) diff --git a/gfx/xvideo.c b/gfx/xvideo.c index 362a6df4a9..2abc230caf 100644 --- a/gfx/xvideo.c +++ b/gfx/xvideo.c @@ -700,6 +700,9 @@ static void xv_render_msg(xv_t *xv, const char *msg, unsigned width, unsigned he static bool xv_frame(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg) { + if (!frame) + return true; + xv_t *xv = (xv_t*)data; if (!check_resize(xv, width, height)) diff --git a/retroarch.c b/retroarch.c index e54ac4c89a..7bab2ddaa0 100644 --- a/retroarch.c +++ b/retroarch.c @@ -198,27 +198,23 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_ // Slightly messy code, // but we really need to do processing before blocking on VSync for best possible scheduling. - bool is_dupe = !data; #ifdef HAVE_FFMPEG - - if (g_extern.recording && (!g_extern.filter.active || !g_settings.video.post_filter_record || is_dupe)) + if (g_extern.recording && (!g_extern.filter.active || !g_settings.video.post_filter_record || !data)) { struct ffemu_video_data ffemu_data = {0}; ffemu_data.data = data; ffemu_data.pitch = pitch; ffemu_data.width = width; ffemu_data.height = height; - ffemu_data.is_dupe = is_dupe; + ffemu_data.is_dupe = !data; ffemu_push_video(g_extern.rec, &ffemu_data); } #endif - if (is_dupe) - return; const char *msg = msg_queue_pull(g_extern.msg_queue); #ifdef HAVE_DYLIB - if (g_extern.filter.active) + if (g_extern.filter.active && data) { unsigned owidth = width; unsigned oheight = height; @@ -248,10 +244,10 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_ g_extern.video_active = false; #endif - g_extern.frame_cache.data = data; - g_extern.frame_cache.width = width; + g_extern.frame_cache.data = data; + g_extern.frame_cache.width = width; g_extern.frame_cache.height = height; - g_extern.frame_cache.pitch = pitch; + g_extern.frame_cache.pitch = pitch; } #ifdef HAVE_GRIFFIN