mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 14:40:22 +00:00
SDL: audio small fixes (crash with -r analog)
This commit is contained in:
@@ -101,6 +101,8 @@ extern "C" {
|
||||
#define DISPLAY_FLAG_AUDIO_EMBEDDED (1<<1)
|
||||
#define DISPLAY_FLAG_AUDIO_AESEBU (1<<2)
|
||||
#define DISPLAY_FLAG_AUDIO_ANALOG (1<<3)
|
||||
|
||||
#define DISPLAY_FLAG_AUDIO_ANY (DISPLAY_FLAG_AUDIO_EMBEDDED | DISPLAY_FLAG_AUDIO_AESEBU | DISPLAY_FLAG_AUDIO_ANALOG)
|
||||
/** @} */
|
||||
|
||||
struct audio_frame;
|
||||
|
||||
@@ -557,9 +557,18 @@ static void *display_sdl_init(struct module *parent, const char *fmt, unsigned i
|
||||
}
|
||||
loadSplashscreen(s);
|
||||
|
||||
if(flags & DISPLAY_FLAG_AUDIO_EMBEDDED) {
|
||||
s->play_audio = TRUE;
|
||||
configure_audio(s);
|
||||
if (flags) {
|
||||
if (flags & DISPLAY_FLAG_AUDIO_EMBEDDED) {
|
||||
s->play_audio = TRUE;
|
||||
configure_audio(s);
|
||||
} else {
|
||||
if (flags & DISPLAY_FLAG_AUDIO_ANY) {
|
||||
log_msg(LOG_LEVEL_ERROR, "[SDL] Only accepted audio output for SDL is \"embedded\".\n");
|
||||
} else {
|
||||
log_msg(LOG_LEVEL_ERROR, "[SDL] Unsupported/unknown flag passed.\n");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
s->play_audio = FALSE;
|
||||
}
|
||||
@@ -690,6 +699,9 @@ static void configure_audio(struct state_sdl *s)
|
||||
static int display_sdl_reconfigure_audio(void *state, int quant_samples, int channels,
|
||||
int sample_rate) {
|
||||
struct state_sdl *s = (struct state_sdl *)state;
|
||||
if (!s->play_audio) {
|
||||
return FALSE;
|
||||
}
|
||||
SDL_AudioSpec desired, obtained;
|
||||
int sample_type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user