mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-23 09:19:55 +00:00
LIBRETRO: refactor av_status
Some checks failed
CI / Windows (arm64, --enable-discord --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx, arm64, arm64-windows) (push) Has been cancelled
CI / Windows (x64, --enable-discord --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx, x64, x64-windows) (push) Has been cancelled
CI / Windows (x86, --enable-discord --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx, win32, x86-windows, true) (push) Has been cancelled
CI / Xcode (-scheme ScummVM-iOS CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO, --use-xcframework --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx --disable-nasm --disable-taskbar --disable-tts, https://downloads.scummvm.org/frs/build/s… (push) Has been cancelled
CI / Xcode (a52dec faad2 flac fluid-synth freetype fribidi giflib jpeg mad libmikmod libmpeg2 libogg libpng libvorbis libvpx sdl2 sdl2_net theora, -scheme ScummVM-macOS -destination 'platform=macOS,arch=x86_64', --disable-nasm --enable-faad --enable-gif --e… (push) Has been cancelled
CI / Ubuntu (g++-4.8 liba52-dev libcurl4-openssl-dev libfaad-dev libflac-dev libfluidsynth-dev libfreetype6-dev libfribidi-dev libgif-dev libgtk-3-dev libjpeg-turbo8-dev libmad0-dev libmikmod-dev libmpeg2-4-dev libogg-dev libpng-dev libsdl-net1.2-dev libsdl… (push) Has been cancelled
CI / Ubuntu (liba52-dev libcurl4-openssl-dev libfaad-dev libflac-dev libfluidsynth-dev libfreetype6-dev libfribidi-dev libgif-dev libgtk-3-dev libjpeg-turbo8-dev libmad0-dev libmikmod-dev libmpeg2-4-dev libogg-dev libpng-dev libsdl2-dev libsdl2-net-dev libs… (push) Has been cancelled
Some checks failed
CI / Windows (arm64, --enable-discord --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx, arm64, arm64-windows) (push) Has been cancelled
CI / Windows (x64, --enable-discord --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx, x64, x64-windows) (push) Has been cancelled
CI / Windows (x86, --enable-discord --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx, win32, x86-windows, true) (push) Has been cancelled
CI / Xcode (-scheme ScummVM-iOS CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO, --use-xcframework --enable-faad --enable-gif --enable-mikmod --enable-mpeg2 --enable-vpx --disable-nasm --disable-taskbar --disable-tts, https://downloads.scummvm.org/frs/build/s… (push) Has been cancelled
CI / Xcode (a52dec faad2 flac fluid-synth freetype fribidi giflib jpeg mad libmikmod libmpeg2 libogg libpng libvorbis libvpx sdl2 sdl2_net theora, -scheme ScummVM-macOS -destination 'platform=macOS,arch=x86_64', --disable-nasm --enable-faad --enable-gif --e… (push) Has been cancelled
CI / Ubuntu (g++-4.8 liba52-dev libcurl4-openssl-dev libfaad-dev libflac-dev libfluidsynth-dev libfreetype6-dev libfribidi-dev libgif-dev libgtk-3-dev libjpeg-turbo8-dev libmad0-dev libmikmod-dev libmpeg2-4-dev libogg-dev libpng-dev libsdl-net1.2-dev libsdl… (push) Has been cancelled
CI / Ubuntu (liba52-dev libcurl4-openssl-dev libfaad-dev libflac-dev libfluidsynth-dev libfreetype6-dev libfribidi-dev libgif-dev libgtk-3-dev libjpeg-turbo8-dev libmad0-dev libmikmod-dev libmpeg2-4-dev libogg-dev libpng-dev libsdl2-dev libsdl2-net-dev libs… (push) Has been cancelled
This commit is contained in:
parent
958b6b74b1
commit
e09c521cd8
@ -37,9 +37,9 @@
|
||||
#define AUDIO_STATUS_BUFFER_ACTIVE (1 << 2)
|
||||
#define AUDIO_STATUS_BUFFER_UNDERRUN (1 << 3)
|
||||
#define AUDIO_STATUS_UPDATE_LATENCY (1 << 4)
|
||||
#define AUDIO_STATUS_UPDATE_AV_INFO (1 << 5)
|
||||
#define AUDIO_STATUS_RESET_PENDING (1 << 6)
|
||||
#define AUDIO_STATUS_UPDATE_GEOMETRY (1 << 7)
|
||||
#define AV_STATUS_UPDATE_AV_INFO (1 << 5)
|
||||
#define AV_STATUS_RESET_PENDING (1 << 6)
|
||||
#define AV_STATUS_UPDATE_GEOMETRY (1 << 7)
|
||||
#define AV_STATUS_UPDATE_GUI (1 << 8)
|
||||
|
||||
// Video status
|
||||
|
@ -96,7 +96,7 @@ static uint8 frameskip_type;
|
||||
static uint8 frameskip_threshold;
|
||||
static uint32 frameskip_counter = 0;
|
||||
|
||||
static uint16 audio_status = AUDIO_STATUS_MUTE;
|
||||
static uint16 av_status = AUDIO_STATUS_MUTE;
|
||||
|
||||
static unsigned retro_audio_buff_occupancy = 0;
|
||||
static uint8 retro_audio_buff_underrun_threshold = 25;
|
||||
@ -237,9 +237,9 @@ static void audio_run(void) {
|
||||
}
|
||||
|
||||
if (samples_produced)
|
||||
audio_status &= ~AUDIO_STATUS_MUTE;
|
||||
av_status &= ~AUDIO_STATUS_MUTE;
|
||||
else {
|
||||
audio_status |= AUDIO_STATUS_MUTE;
|
||||
av_status |= AUDIO_STATUS_MUTE;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -260,14 +260,14 @@ static void audio_run(void) {
|
||||
|
||||
static void retro_audio_buff_status_cb(bool active, unsigned occupancy, bool underrun_likely) {
|
||||
if (active)
|
||||
audio_status |= AUDIO_STATUS_BUFFER_ACTIVE;
|
||||
av_status |= AUDIO_STATUS_BUFFER_ACTIVE;
|
||||
else
|
||||
audio_status &= ~AUDIO_STATUS_BUFFER_ACTIVE;
|
||||
av_status &= ~AUDIO_STATUS_BUFFER_ACTIVE;
|
||||
|
||||
if (occupancy < retro_audio_buff_underrun_threshold)
|
||||
audio_status |= AUDIO_STATUS_BUFFER_UNDERRUN;
|
||||
av_status |= AUDIO_STATUS_BUFFER_UNDERRUN;
|
||||
else if (occupancy > (retro_audio_buff_underrun_threshold << 2))
|
||||
audio_status &= ~AUDIO_STATUS_BUFFER_UNDERRUN;
|
||||
av_status &= ~AUDIO_STATUS_BUFFER_UNDERRUN;
|
||||
|
||||
retro_audio_buff_occupancy = occupancy;
|
||||
}
|
||||
@ -566,7 +566,7 @@ static void update_variables(void) {
|
||||
var.value = NULL;
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
|
||||
uint16 new_gui_height = (int)atoi(var.value);
|
||||
audio_status |= new_gui_height != gui_height && LIBRETRO_G_SYSTEM->inLauncher() ? AV_STATUS_UPDATE_GUI : 0;
|
||||
av_status |= new_gui_height != gui_height && LIBRETRO_G_SYSTEM->inLauncher() ? AV_STATUS_UPDATE_GUI : 0;
|
||||
gui_height = new_gui_height;
|
||||
}
|
||||
|
||||
@ -580,12 +580,12 @@ static void update_variables(void) {
|
||||
den = 9;
|
||||
}
|
||||
uint16 new_gui_width = gui_height * num / den + (gui_height * num % den != 0);
|
||||
audio_status |= (new_gui_width != gui_width) && LIBRETRO_G_SYSTEM->inLauncher() ? AV_STATUS_UPDATE_GUI : 0;
|
||||
av_status |= (new_gui_width != gui_width) && LIBRETRO_G_SYSTEM->inLauncher() ? AV_STATUS_UPDATE_GUI : 0;
|
||||
gui_width = new_gui_width;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(audio_status & AUDIO_STATUS_BUFFER_SUPPORT)) {
|
||||
if (!(av_status & AUDIO_STATUS_BUFFER_SUPPORT)) {
|
||||
if (frameskip_type > 1) {
|
||||
retro_log_cb(RETRO_LOG_WARN, "Selected frameskip mode not available.\n");
|
||||
retro_osd_notification("Selected frameskip mode not available");
|
||||
@ -594,11 +594,11 @@ static void update_variables(void) {
|
||||
}
|
||||
|
||||
if (old_frameskip_type != frameskip_type || old_frame_rate != frame_rate || old_sample_rate != sample_rate) {
|
||||
audio_status |= AUDIO_STATUS_UPDATE_LATENCY;
|
||||
av_status |= AUDIO_STATUS_UPDATE_LATENCY;
|
||||
if (old_frame_rate != frame_rate || old_sample_rate != sample_rate) {
|
||||
audio_buffer_init(sample_rate, (uint16) frame_rate);
|
||||
if (g_system)
|
||||
audio_status |= (AUDIO_STATUS_UPDATE_AV_INFO & AUDIO_STATUS_RESET_PENDING);
|
||||
av_status |= (AV_STATUS_UPDATE_AV_INFO & AV_STATUS_RESET_PENDING);
|
||||
}
|
||||
}
|
||||
|
||||
@ -872,9 +872,9 @@ void retro_set_size(unsigned width, unsigned height) {
|
||||
} else if (width > max_width || height > max_height) {
|
||||
max_width = width;
|
||||
max_height = height;
|
||||
audio_status |= AUDIO_STATUS_UPDATE_AV_INFO;
|
||||
av_status |= AV_STATUS_UPDATE_AV_INFO;
|
||||
} else
|
||||
audio_status |= AUDIO_STATUS_UPDATE_GEOMETRY;
|
||||
av_status |= AV_STATUS_UPDATE_GEOMETRY;
|
||||
|
||||
base_width = width;
|
||||
base_height = height;
|
||||
@ -933,7 +933,7 @@ void retro_init(void) {
|
||||
|
||||
struct retro_audio_buffer_status_callback buf_status_cb;
|
||||
buf_status_cb.callback = retro_audio_buff_status_cb;
|
||||
audio_status = environ_cb(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK, &buf_status_cb) ? (audio_status | AUDIO_STATUS_BUFFER_SUPPORT) : (audio_status & ~AUDIO_STATUS_BUFFER_SUPPORT);
|
||||
av_status = environ_cb(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACK, &buf_status_cb) ? (av_status | AUDIO_STATUS_BUFFER_SUPPORT) : (av_status & ~AUDIO_STATUS_BUFFER_SUPPORT);
|
||||
|
||||
update_variables();
|
||||
max_width = gui_width > max_width ? gui_width : max_width;
|
||||
@ -1106,27 +1106,27 @@ void retro_run(void) {
|
||||
retro_update_options_display();
|
||||
|
||||
#ifdef USE_HIGHRES
|
||||
if (audio_status & AV_STATUS_UPDATE_GUI) {
|
||||
if (av_status & AV_STATUS_UPDATE_GUI) {
|
||||
retro_gui_res_reset();
|
||||
audio_status &= ~AV_STATUS_UPDATE_GUI;
|
||||
av_status &= ~AV_STATUS_UPDATE_GUI;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (audio_status & (AUDIO_STATUS_UPDATE_AV_INFO | AUDIO_STATUS_UPDATE_GEOMETRY)) {
|
||||
if (av_status & (AV_STATUS_UPDATE_AV_INFO | AV_STATUS_UPDATE_GEOMETRY)) {
|
||||
struct retro_system_av_info info;
|
||||
retro_get_system_av_info(&info);
|
||||
if (audio_status & AUDIO_STATUS_UPDATE_AV_INFO)
|
||||
if (av_status & AV_STATUS_UPDATE_AV_INFO)
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &info);
|
||||
else
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_GEOMETRY, &info);
|
||||
|
||||
audio_status &= ~(AUDIO_STATUS_UPDATE_AV_INFO | AUDIO_STATUS_UPDATE_GEOMETRY);
|
||||
av_status &= ~(AV_STATUS_UPDATE_AV_INFO | AV_STATUS_UPDATE_GEOMETRY);
|
||||
#ifdef USE_OPENGL
|
||||
context_reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (audio_status & AUDIO_STATUS_UPDATE_LATENCY) {
|
||||
if (av_status & AUDIO_STATUS_UPDATE_LATENCY) {
|
||||
uint32 audio_latency;
|
||||
float frame_time_msec = 1000.0f / frame_rate;
|
||||
|
||||
@ -1137,11 +1137,11 @@ void retro_run(void) {
|
||||
|
||||
/* This can only be called from within retro_run() */
|
||||
environ_cb(RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY, &audio_latency);
|
||||
audio_status &= ~AUDIO_STATUS_UPDATE_LATENCY;
|
||||
av_status &= ~AUDIO_STATUS_UPDATE_LATENCY;
|
||||
}
|
||||
|
||||
if (audio_status & AUDIO_STATUS_RESET_PENDING) {
|
||||
audio_status &= ~AUDIO_STATUS_RESET_PENDING;
|
||||
if (av_status & AV_STATUS_RESET_PENDING) {
|
||||
av_status &= ~AV_STATUS_RESET_PENDING;
|
||||
retro_reset();
|
||||
return;
|
||||
}
|
||||
@ -1156,7 +1156,7 @@ void retro_run(void) {
|
||||
|
||||
/* Determine frameskip need based on settings */
|
||||
if (frameskip_type == 2)
|
||||
skip_frame = ((audio_status & (AUDIO_STATUS_BUFFER_UNDERRUN | AUDIO_STATUS_BUFFER_ACTIVE)) == (AUDIO_STATUS_BUFFER_UNDERRUN | AUDIO_STATUS_BUFFER_ACTIVE));
|
||||
skip_frame = ((av_status & (AUDIO_STATUS_BUFFER_UNDERRUN | AUDIO_STATUS_BUFFER_ACTIVE)) == (AUDIO_STATUS_BUFFER_UNDERRUN | AUDIO_STATUS_BUFFER_ACTIVE));
|
||||
else if (frameskip_type == 1)
|
||||
skip_frame = !(current_frame % frameskip_no == 0);
|
||||
else if (frameskip_type == 3)
|
||||
@ -1165,7 +1165,7 @@ void retro_run(void) {
|
||||
/* No frame skipping if
|
||||
- no incoming audio (e.g. GUI)
|
||||
- doing a THREAD_SWITCH_UPDATE loop */
|
||||
skip_frame = skip_frame && !(audio_status & AUDIO_STATUS_MUTE);
|
||||
skip_frame = skip_frame && !(av_status & AUDIO_STATUS_MUTE);
|
||||
|
||||
/* Reset frameskip counter if not flagged */
|
||||
if ((!skip_frame && frameskip_counter) || frameskip_counter >= FRAMESKIP_MAX) {
|
||||
|
Loading…
Reference in New Issue
Block a user