mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Create drivers_data array and no longer use recording_data
This commit is contained in:
parent
f751199860
commit
e049b7e1f0
@ -502,7 +502,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples)
|
|||||||
src_data.output_frames = 0;
|
src_data.output_frames = 0;
|
||||||
src_data.ratio = 0.0f;
|
src_data.ratio = 0.0f;
|
||||||
|
|
||||||
if (recording_data)
|
if (drivers_data[DRIVER_RECORDING])
|
||||||
recording_push_audio(data, samples);
|
recording_push_audio(data, samples);
|
||||||
|
|
||||||
if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || settings->audio.mute_enable)
|
if (runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL) || settings->audio.mute_enable)
|
||||||
|
2
driver.c
2
driver.c
@ -52,6 +52,8 @@
|
|||||||
#define HASH_RECORD_DRIVER 0x144cd2cfU
|
#define HASH_RECORD_DRIVER 0x144cd2cfU
|
||||||
#define HASH_WIFI_DRIVER 0x64d7d17fU
|
#define HASH_WIFI_DRIVER 0x64d7d17fU
|
||||||
|
|
||||||
|
void *drivers_data[DRIVER_LAST+1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find_driver_nonempty:
|
* find_driver_nonempty:
|
||||||
* @label : string of driver type to be found.
|
* @label : string of driver type to be found.
|
||||||
|
9
driver.h
9
driver.h
@ -45,7 +45,9 @@ enum
|
|||||||
DRIVER_LOCATION,
|
DRIVER_LOCATION,
|
||||||
DRIVER_MENU,
|
DRIVER_MENU,
|
||||||
DRIVERS_VIDEO_INPUT,
|
DRIVERS_VIDEO_INPUT,
|
||||||
DRIVER_WIFI
|
DRIVER_WIFI,
|
||||||
|
DRIVER_RECORDING,
|
||||||
|
DRIVER_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -57,7 +59,8 @@ enum
|
|||||||
DRIVER_LOCATION_MASK = 1 << DRIVER_LOCATION,
|
DRIVER_LOCATION_MASK = 1 << DRIVER_LOCATION,
|
||||||
DRIVER_MENU_MASK = 1 << DRIVER_MENU,
|
DRIVER_MENU_MASK = 1 << DRIVER_MENU,
|
||||||
DRIVERS_VIDEO_INPUT_MASK = 1 << DRIVERS_VIDEO_INPUT,
|
DRIVERS_VIDEO_INPUT_MASK = 1 << DRIVERS_VIDEO_INPUT,
|
||||||
DRIVER_WIFI_MASK = 1 << DRIVER_WIFI
|
DRIVER_WIFI_MASK = 1 << DRIVER_WIFI,
|
||||||
|
DRIVER_RECORDING_MASK = 1 << DRIVER_RECORDING
|
||||||
};
|
};
|
||||||
|
|
||||||
enum driver_ctl_state
|
enum driver_ctl_state
|
||||||
@ -122,6 +125,8 @@ typedef struct driver_ctx_info
|
|||||||
|
|
||||||
bool driver_ctl(enum driver_ctl_state state, void *data);
|
bool driver_ctl(enum driver_ctl_state state, void *data);
|
||||||
|
|
||||||
|
extern void *drivers_data[DRIVER_LAST+1];
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1114,7 +1114,7 @@ static bool video_driver_frame_filter(const void *data,
|
|||||||
data, width, height, pitch);
|
data, width, height, pitch);
|
||||||
performance_counter_stop(&softfilter_process);
|
performance_counter_stop(&softfilter_process);
|
||||||
|
|
||||||
if (settings->video.post_filter_record && recording_data)
|
if (settings->video.post_filter_record && drivers_data[DRIVER_RECORDING])
|
||||||
recording_dump_frame(video_driver_state_buffer,
|
recording_dump_frame(video_driver_state_buffer,
|
||||||
*output_width, *output_height, *output_pitch);
|
*output_width, *output_height, *output_pitch);
|
||||||
|
|
||||||
@ -1147,7 +1147,7 @@ bool video_driver_cached_frame(void)
|
|||||||
void *recording = recording_driver_get_data_ptr();
|
void *recording = recording_driver_get_data_ptr();
|
||||||
|
|
||||||
/* Cannot allow recording when pushing duped frames. */
|
/* Cannot allow recording when pushing duped frames. */
|
||||||
recording_data = NULL;
|
drivers_data[DRIVER_RECORDING] = NULL;
|
||||||
|
|
||||||
/* Not 100% safe, since the library might have
|
/* Not 100% safe, since the library might have
|
||||||
* freed the memory, but no known implementations do this.
|
* freed the memory, but no known implementations do this.
|
||||||
@ -1161,7 +1161,7 @@ bool video_driver_cached_frame(void)
|
|||||||
|
|
||||||
core_frame(&info);
|
core_frame(&info);
|
||||||
|
|
||||||
recording_data = recording;
|
drivers_data[DRIVER_RECORDING] = recording;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2091,7 +2091,7 @@ void video_driver_frame(const void *data, unsigned width,
|
|||||||
|| !settings->video.post_filter_record
|
|| !settings->video.post_filter_record
|
||||||
|| !data
|
|| !data
|
||||||
|| video_driver_record_gpu_buffer
|
|| video_driver_record_gpu_buffer
|
||||||
) && recording_data
|
) && drivers_data[DRIVER_RECORDING]
|
||||||
)
|
)
|
||||||
recording_dump_frame(data, width, height, pitch);
|
recording_dump_frame(data, width, height, pitch);
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ static bool recording_enable = false;
|
|||||||
static bool recording_use_output_dir = false;
|
static bool recording_use_output_dir = false;
|
||||||
|
|
||||||
static const record_driver_t *recording_driver = NULL;
|
static const record_driver_t *recording_driver = NULL;
|
||||||
void *recording_data = NULL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* record_driver_find_ident:
|
* record_driver_find_ident:
|
||||||
@ -244,22 +243,22 @@ void recording_dump_frame(const void *data, unsigned width,
|
|||||||
ffemu_data.is_dupe = !data;
|
ffemu_data.is_dupe = !data;
|
||||||
|
|
||||||
if (recording_driver && recording_driver->push_video)
|
if (recording_driver && recording_driver->push_video)
|
||||||
recording_driver->push_video(recording_data, &ffemu_data);
|
recording_driver->push_video(drivers_data[DRIVER_RECORDING], &ffemu_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool recording_deinit(void)
|
bool recording_deinit(void)
|
||||||
{
|
{
|
||||||
if (!recording_data || !recording_driver)
|
if (!drivers_data[DRIVER_RECORDING] || !recording_driver)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (recording_driver->finalize)
|
if (recording_driver->finalize)
|
||||||
recording_driver->finalize(recording_data);
|
recording_driver->finalize(drivers_data[DRIVER_RECORDING]);
|
||||||
|
|
||||||
if (recording_driver->free)
|
if (recording_driver->free)
|
||||||
recording_driver->free(recording_data);
|
recording_driver->free(drivers_data[DRIVER_RECORDING]);
|
||||||
|
|
||||||
recording_data = NULL;
|
drivers_data[DRIVER_RECORDING] = NULL;
|
||||||
recording_driver = NULL;
|
recording_driver = NULL;
|
||||||
|
|
||||||
command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL);
|
command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL);
|
||||||
|
|
||||||
@ -284,7 +283,7 @@ void recording_push_audio(const int16_t *data, size_t samples)
|
|||||||
ffemu_data.frames = samples / 2;
|
ffemu_data.frames = samples / 2;
|
||||||
|
|
||||||
if (recording_driver && recording_driver->push_audio)
|
if (recording_driver && recording_driver->push_audio)
|
||||||
recording_driver->push_audio(recording_data, &ffemu_data);
|
recording_driver->push_audio(drivers_data[DRIVER_RECORDING], &ffemu_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -426,7 +425,7 @@ bool recording_init(void)
|
|||||||
params.fb_width, params.fb_height,
|
params.fb_width, params.fb_height,
|
||||||
(unsigned)params.pix_fmt);
|
(unsigned)params.pix_fmt);
|
||||||
|
|
||||||
if (!record_driver_init_first(&recording_driver, &recording_data, ¶ms))
|
if (!record_driver_init_first(&recording_driver, &drivers_data[DRIVER_RECORDING], ¶ms))
|
||||||
{
|
{
|
||||||
RARCH_ERR("%s\n", msg_hash_to_str(MSG_FAILED_TO_START_RECORDING));
|
RARCH_ERR("%s\n", msg_hash_to_str(MSG_FAILED_TO_START_RECORDING));
|
||||||
command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL);
|
command_event(CMD_EVENT_GPU_RECORD_DEINIT, NULL);
|
||||||
@ -439,17 +438,17 @@ bool recording_init(void)
|
|||||||
|
|
||||||
void *recording_driver_get_data_ptr(void)
|
void *recording_driver_get_data_ptr(void)
|
||||||
{
|
{
|
||||||
return recording_data;
|
return drivers_data[DRIVER_RECORDING];
|
||||||
}
|
}
|
||||||
|
|
||||||
void recording_driver_clear_data_ptr(void)
|
void recording_driver_clear_data_ptr(void)
|
||||||
{
|
{
|
||||||
recording_data = NULL;
|
drivers_data[DRIVER_RECORDING] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void recording_driver_set_data_ptr(void *data)
|
void recording_driver_set_data_ptr(void *data)
|
||||||
{
|
{
|
||||||
recording_data = data;
|
drivers_data[DRIVER_RECORDING] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool *recording_driver_get_use_output_dir_ptr(void)
|
bool *recording_driver_get_use_output_dir_ptr(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user