Mercurial > mplayer.hg
diff mencoder.c @ 24892:80180dc13565
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.
author | uau |
---|---|
date | Thu, 01 Nov 2007 06:52:19 +0000 |
parents | fefb019faa90 |
children | 2bfc75674b71 |
line wrap: on
line diff
--- a/mencoder.c Thu Nov 01 06:52:14 2007 +0000 +++ b/mencoder.c Thu Nov 01 06:52:19 2007 +0000 @@ -337,14 +337,7 @@ while(size<total && !at_eof){ int len=total-size; if(len>MAX_OUTBURST) len=MAX_OUTBURST; - if(len>sh_audio->a_out_buffer_size) len=sh_audio->a_out_buffer_size; - if(len>sh_audio->a_out_buffer_len){ - int ret=decode_audio(sh_audio, - &sh_audio->a_out_buffer[sh_audio->a_out_buffer_len], - len-sh_audio->a_out_buffer_len, - sh_audio->a_out_buffer_size-sh_audio->a_out_buffer_len); - if(ret>0) sh_audio->a_out_buffer_len+=ret; else at_eof=1; - } + if (decode_audio(sh_audio, len) < 0) at_eof=1; if(len>sh_audio->a_out_buffer_len) len=sh_audio->a_out_buffer_len; fast_memcpy(buffer+size,sh_audio->a_out_buffer,len); sh_audio->a_out_buffer_len-=len; size+=len;