diff options
author | wm4 <wm4@nowhere> | 2013-05-12 21:47:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-12 21:47:55 +0200 |
commit | e6e5a7b221ef2fcdd5a1982d6fdcb627100447d2 (patch) | |
tree | 08b54ef9bb771434fc7fbe9185793503d3ba314c /audio/out/ao_sdl.c | |
parent | 6a83ef1552de4a1a71da49e45647ce1a4ce64e53 (diff) | |
parent | 48f94311516dc1426644b3e68b2a48c22727e1e7 (diff) | |
download | mpv-e6e5a7b221ef2fcdd5a1982d6fdcb627100447d2.tar.bz2 mpv-e6e5a7b221ef2fcdd5a1982d6fdcb627100447d2.tar.xz |
Merge branch 'audio_changes'
Conflicts:
audio/out/ao_lavc.c
Diffstat (limited to 'audio/out/ao_sdl.c')
-rw-r--r-- | audio/out/ao_sdl.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/audio/out/ao_sdl.c b/audio/out/ao_sdl.c index 7cfb1ae1e2..6678cd3bd3 100644 --- a/audio/out/ao_sdl.c +++ b/audio/out/ao_sdl.c @@ -160,6 +160,13 @@ static int init(struct ao *ao, char *params) return -1; } + struct mp_chmap_sel sel = {0}; + mp_chmap_sel_add_waveext_def(&sel); + if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) { + uninit(ao, true); + return -1; + } + SDL_AudioSpec desired, obtained; int bytes = 0; @@ -185,7 +192,7 @@ static int init(struct ao *ao, char *params) #endif } desired.freq = ao->samplerate; - desired.channels = ao->channels; + desired.channels = ao->channels.num; desired.samples = FFMIN(32768, ceil_power_of_two(ao->samplerate * buflen)); desired.callback = audio_callback; desired.userdata = ao; @@ -236,9 +243,13 @@ static int init(struct ao *ao, char *params) return -1; } + if (!ao_chmap_sel_get_def(ao, &sel, &ao->channels, obtained.channels)) { + uninit(ao, true); + return -1; + } + ao->samplerate = obtained.freq; - ao->channels = obtained.channels; - ao->bps = ao->channels * ao->samplerate * bytes; + ao->bps = ao->channels.num * ao->samplerate * bytes; ao->buffersize = obtained.size * bufcnt; ao->outburst = obtained.size; priv->buffer = av_fifo_alloc(ao->buffersize); @@ -362,7 +373,6 @@ static float get_delay(struct ao *ao) } const struct ao_driver audio_out_sdl = { - .is_new = true, .info = &(const struct ao_info) { "SDL Audio", "sdl", |