summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authoruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-01 06:52:19 +0000
committeruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-01 06:52:19 +0000
commit1844e1dd0c15c18ea4781475fd1f1d62c0098ebc (patch)
treec2e851fccc75aa0bac60aefba6d9bb36f727a95b /mplayer.c
parenta6d6f182167dbb2fe16ef12faf36a6668eaaa9af (diff)
downloadmpv-1844e1dd0c15c18ea4781475fd1f1d62c0098ebc.tar.bz2
mpv-1844e1dd0c15c18ea4781475fd1f1d62c0098ebc.tar.xz
Change decode_audio() interface
Rewrite decode_audio to better deal with filters that handle input in large blocks. It now always places output in sh_audio->a_out_buffer (which was always given as a parameter before) and reallocates the buffer if needed. After the changes filters can return arbitrarily large blocks of data without some of it being lost. The new version also allows simplifying some code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24920 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/mplayer.c b/mplayer.c
index 9b7c87ba64..205864a254 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1779,22 +1779,12 @@ static int fill_audio_out_buffers(void)
// Fill buffer if needed:
current_module="decode_audio";
t = GetTimer();
- while (sh_audio->a_out_buffer_len < playsize) {
- int buflen = sh_audio->a_out_buffer_len;
- int ret = decode_audio(sh_audio, &sh_audio->a_out_buffer[buflen],
- playsize - buflen, // min bytes
- sh_audio->a_out_buffer_size - buflen // max
- );
- if (ret <= 0) { // EOF?
- if (mpctx->d_audio->eof) {
- audio_eof = 1;
- if (sh_audio->a_out_buffer_len == 0)
- return 0;
- }
- break;
+ if (decode_audio(sh_audio, playsize) < 0) // EOF or error
+ if (mpctx->d_audio->eof) {
+ audio_eof = 1;
+ if (sh_audio->a_out_buffer_len == 0)
+ return 0;
}
- sh_audio->a_out_buffer_len += ret;
- }
t = GetTimer() - t;
tt = t*0.000001f; audio_time_usage+=tt;
if (playsize > sh_audio->a_out_buffer_len) {