Mercurial > mplayer.hg
comparison mplayer.c @ 16290:8a2585bc494f
ensure that audio-only files are decoded till the end by not only
waiting for eof but also checking that the a_in_buffer is empty.
author | reimar |
---|---|
date | Tue, 23 Aug 2005 07:56:29 +0000 |
parents | 4b2b8c90d370 |
children | 175eb8754ff3 |
comparison
equal
deleted
inserted
replaced
16289:cafa391ff89c | 16290:8a2585bc494f |
---|---|
2284 if(playsize>MAX_OUTBURST) playsize=MAX_OUTBURST; // we shouldn't exceed it! | 2284 if(playsize>MAX_OUTBURST) playsize=MAX_OUTBURST; // we shouldn't exceed it! |
2285 | 2285 |
2286 // Fill buffer if needed: | 2286 // Fill buffer if needed: |
2287 current_module="decode_audio"; // Enter AUDIO decoder module | 2287 current_module="decode_audio"; // Enter AUDIO decoder module |
2288 t=GetTimer(); | 2288 t=GetTimer(); |
2289 while(sh_audio->a_out_buffer_len<playsize && !d_audio->eof){ | 2289 while(sh_audio->a_out_buffer_len<playsize && |
2290 (!d_audio->eof || sh_audio->a_in_buffer_len > 0)){ | |
2290 int ret=decode_audio(sh_audio,&sh_audio->a_out_buffer[sh_audio->a_out_buffer_len], | 2291 int ret=decode_audio(sh_audio,&sh_audio->a_out_buffer[sh_audio->a_out_buffer_len], |
2291 playsize-sh_audio->a_out_buffer_len,sh_audio->a_out_buffer_size-sh_audio->a_out_buffer_len); | 2292 playsize-sh_audio->a_out_buffer_len,sh_audio->a_out_buffer_size-sh_audio->a_out_buffer_len); |
2292 if(ret<=0) break; // EOF? | 2293 if(ret<=0) { // EOF? |
2294 if (d_audio->eof) | |
2295 sh_audio->a_in_buffer_len = 0; // make sure we don't hang if something's broken | |
2296 break; | |
2297 } | |
2293 sh_audio->a_out_buffer_len+=ret; | 2298 sh_audio->a_out_buffer_len+=ret; |
2294 } | 2299 } |
2295 t=GetTimer()-t; | 2300 t=GetTimer()-t; |
2296 tt = t*0.000001f; audio_time_usage+=tt; | 2301 tt = t*0.000001f; audio_time_usage+=tt; |
2297 if(playsize>sh_audio->a_out_buffer_len) playsize=sh_audio->a_out_buffer_len; | 2302 if(playsize>sh_audio->a_out_buffer_len) playsize=sh_audio->a_out_buffer_len; |
2314 // handle audio-only case: | 2319 // handle audio-only case: |
2315 if(!quiet) { | 2320 if(!quiet) { |
2316 float a_pos = sh_audio->delay - audio_out->get_delay() * playback_speed; | 2321 float a_pos = sh_audio->delay - audio_out->get_delay() * playback_speed; |
2317 print_status(a_pos, 0, 0); | 2322 print_status(a_pos, 0, 0); |
2318 } | 2323 } |
2319 if(d_audio->eof) eof = PT_NEXT_ENTRY; | 2324 if(d_audio->eof && sh_audio->a_in_buffer_len <= 0) eof = PT_NEXT_ENTRY; |
2320 | 2325 |
2321 } else { | 2326 } else { |
2322 | 2327 |
2323 /*========================== PLAY VIDEO ============================*/ | 2328 /*========================== PLAY VIDEO ============================*/ |
2324 | 2329 |