summaryrefslogtreecommitdiffstats
path: root/mencoder.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 /mencoder.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 'mencoder.c')
-rw-r--r--mencoder.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/mencoder.c b/mencoder.c
index 9ef7835c8f..219f3ff79c 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -337,14 +337,7 @@ static int dec_audio(sh_audio_t *sh_audio,unsigned char* buffer,int total){
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;