diff --git a/gfx/video_driver.c b/gfx/video_driver.c index da09d0c0b1..333b0a7479 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1837,14 +1837,12 @@ bool video_driver_is_active(void) return video_driver_active; } -bool video_driver_has_gpu_record(void) +void video_driver_get_record_status( + bool *has_gpu_record, + uint8_t **gpu_buf) { - return video_driver_record_gpu_buffer != NULL; -} - -uint8_t *video_driver_get_gpu_record(void) -{ - return video_driver_record_gpu_buffer; + *gpu_buf = video_driver_record_gpu_buffer; + *has_gpu_record = video_driver_record_gpu_buffer != NULL; } bool video_driver_gpu_record_init(unsigned size) diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 943bd6a5ca..8976558040 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -328,8 +328,6 @@ void video_driver_set_video_cache_context_ack(void); bool video_driver_is_video_cache_context_ack(void); void video_driver_set_active(void); bool video_driver_is_active(void); -bool video_driver_has_gpu_record(void); -uint8_t *video_driver_get_gpu_record(void); bool video_driver_gpu_record_init(unsigned size); void video_driver_gpu_record_deinit(void); bool video_driver_get_current_software_framebuffer(struct @@ -558,6 +556,10 @@ void video_driver_reinit(void); void video_driver_get_window_title(char *buf, unsigned len); +void video_driver_get_record_status( + bool *has_gpu_record, + uint8_t **gpu_buf); + void video_driver_get_status(uint64_t *frame_count, bool * is_alive, bool *is_focused); diff --git a/record/record_driver.c b/record/record_driver.c index fc68b0cf87..a46954767a 100644 --- a/record/record_driver.c +++ b/record/record_driver.c @@ -185,16 +185,21 @@ bool record_driver_init_first(const record_driver_t **backend, void **data, void recording_dump_frame(const void *data, unsigned width, unsigned height, size_t pitch, bool is_idle) { - struct ffemu_video_data ffemu_data = {0}; + bool has_gpu_record = false; + uint8_t *gpu_buf = NULL; + struct ffemu_video_data + ffemu_data = {0}; - ffemu_data.pitch = pitch; - ffemu_data.width = width; - ffemu_data.height = height; - ffemu_data.data = data; + video_driver_get_record_status(&has_gpu_record, + &gpu_buf); - if (video_driver_has_gpu_record()) + ffemu_data.pitch = pitch; + ffemu_data.width = width; + ffemu_data.height = height; + ffemu_data.data = data; + + if (has_gpu_record) { - uint8_t *gpu_buf = NULL; struct video_viewport vp = {0}; video_driver_get_viewport_info(&vp); @@ -222,7 +227,6 @@ void recording_dump_frame(const void *data, unsigned width, return; } - gpu_buf = video_driver_get_gpu_record(); if (!gpu_buf) return; @@ -240,7 +244,7 @@ void recording_dump_frame(const void *data, unsigned width, ffemu_data.pitch = -ffemu_data.pitch; } - if (!video_driver_has_gpu_record()) + if (!has_gpu_record) ffemu_data.is_dupe = !data; if (recording_driver && recording_driver->push_video)