From ce1f31af8daf6e1ae56a03d2061d364f2e1f073d Mon Sep 17 00:00:00 2001 From: Jesse Talavera Date: Mon, 16 Dec 2024 21:53:37 -0500 Subject: [PATCH] Don't pass in the driver context to `camera_driver::device_list_new` - Unlike some other drivers, the camera driver is only initialized when a core actually asks for it - Therefore, the driver context isn't available when it's time to ask for devices - I could refactor the camera driver to be created earlier, but then I'd need to refactor the other drivers as well - That'll come later in another PR --- camera/camera_driver.c | 4 ++-- camera/camera_driver.h | 4 ++-- camera/drivers/ffmpeg.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/camera/camera_driver.c b/camera/camera_driver.c index 922565cd68..d5794faf49 100644 --- a/camera/camera_driver.c +++ b/camera/camera_driver.c @@ -34,8 +34,8 @@ static bool nullcamera_start(void *data) { return true; } static bool nullcamera_poll(void *a, retro_camera_frame_raw_framebuffer_t b, retro_camera_frame_opengl_texture_t c) { return true; } -static struct string_list *nullcamera_device_list_new(const void *data) { return NULL; } -static void nullcamera_device_list_free(const void *data, struct string_list *devices) {} +static struct string_list *nullcamera_device_list_new() { return NULL; } +static void nullcamera_device_list_free(struct string_list *devices) {} static camera_driver_t camera_null = { nullcamera_init, diff --git a/camera/camera_driver.h b/camera/camera_driver.h index 30f3cdebad..086ce155d5 100644 --- a/camera/camera_driver.h +++ b/camera/camera_driver.h @@ -49,8 +49,8 @@ typedef struct camera_driver retro_camera_frame_raw_framebuffer_t frame_raw_cb, retro_camera_frame_opengl_texture_t frame_gl_cb); - struct string_list *(*device_list_new)(const void *driver_context); - void (*device_list_free)(const void *driver_context, struct string_list *devices); + struct string_list *(*device_list_new)(void); + void (*device_list_free)(struct string_list *devices); const char *ident; } camera_driver_t; diff --git a/camera/drivers/ffmpeg.c b/camera/drivers/ffmpeg.c index 3ef410864a..1a68d4c0ba 100644 --- a/camera/drivers/ffmpeg.c +++ b/camera/drivers/ffmpeg.c @@ -500,7 +500,7 @@ static bool ffmpeg_camera_poll( return true; } -static struct string_list *ffmpeg_camera_device_list_new(const void *driver_context) +static struct string_list *ffmpeg_camera_device_list_new(void) { const AVInputFormat *input = NULL; struct string_list *list = string_list_new(); @@ -517,7 +517,7 @@ static struct string_list *ffmpeg_camera_device_list_new(const void *driver_cont return list; } -static void ffmpeg_camera_device_list_free(const void *driver_context, struct string_list *devices) +static void ffmpeg_camera_device_list_free(struct string_list *devices) { struct string_list *sl = (struct string_list*)devices;