diff options
author | wm4 <wm4@nowhere> | 2013-11-10 23:38:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-12 23:29:53 +0100 |
commit | 347a86198b214b5e79b45d198c5cd2cc3c3a759a (patch) | |
tree | a8adf255ac2cedfa4bb29384e02243550c7a6647 /mpvcore/player/loadfile.c | |
parent | d1ee9ea261798f94fe958578d9748a69864c3058 (diff) | |
download | mpv-347a86198b214b5e79b45d198c5cd2cc3c3a759a.tar.bz2 mpv-347a86198b214b5e79b45d198c5cd2cc3c3a759a.tar.xz |
audio: switch output to mp_audio_buffer
Replace the code that used a single buffer with mp_audio_buffer. This
also enables non-interleaved output operation, although it's still
disabled, and no AO supports it yet.
Diffstat (limited to 'mpvcore/player/loadfile.c')
-rw-r--r-- | mpvcore/player/loadfile.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mpvcore/player/loadfile.c b/mpvcore/player/loadfile.c index a35da703ed..fffb1566c2 100644 --- a/mpvcore/player/loadfile.c +++ b/mpvcore/player/loadfile.c @@ -43,6 +43,8 @@ #include "mpvcore/input/input.h" #include "audio/mixer.h" +#include "audio/audio.h" +#include "audio/audio_buffer.h" #include "audio/decode/dec_audio.h" #include "audio/out/ao.h" #include "demux/demux.h" @@ -163,11 +165,13 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask) // Note: with gapless_audio, stop_play is not correctly set if (opts->gapless_audio || mpctx->stop_play == AT_END_OF_FILE) { drain = true; - int len = ao->buffer_playable_size; - assert(len <= ao->buffer.len); - int played = ao_play(ao, ao->buffer.start, len, + struct mp_audio data; + mp_audio_buffer_peek(ao->buffer, &data); + int samples = ao->buffer_playable_samples; + assert(samples <= data.samples); + int played = ao_play(ao, data.planes, samples, AOPLAY_FINAL_CHUNK); - if (played < len) + if (played < samples) MP_WARN(ao, "Audio output truncated at end.\n"); } ao_uninit(ao, drain); |