# HG changeset patch # User William Pitcock # Date 1204923564 21600 # Node ID 6b07b92a0308e12b465dfb39c38281922ce10a68 # Parent 7576404c8415b0536f4a13ade917e3f0ecabd621 Drop wma_playbuff(). Not re-entrant. diff -r 7576404c8415 -r 6b07b92a0308 src/wma/wma.c --- a/src/wma/wma.c Fri Mar 07 14:56:23 2008 -0600 +++ b/src/wma/wma.c Fri Mar 07 14:59:24 2008 -0600 @@ -290,25 +290,6 @@ (*title_real) = aud_tuple_formatter_make_title_string(tuple, aud_get_gentitle_format()); } -static void wma_playbuff(InputPlayback *playback, int channels, int out_size) -{ - FifoBuffer f; - int sst_buff; - - fifo_init(&f, out_size*2); - fifo_write(&f, wma_outbuf, out_size, &f.wptr); - while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode) - { - sst_buff = wma_st_buff; - if(wma_pause) memset(wma_s_outbuf, 0, sst_buff); - playback->pass_audio(playback, FMT_S16_NE, - channels, sst_buff, (short *)wma_s_outbuf, NULL); - memset(wma_s_outbuf, 0, sst_buff); - } - fifo_free(&f); - return; -} - static void wma_play_file(InputPlayback *playback) { AVCodec *codec; @@ -370,13 +351,29 @@ if(size == 0) break; while(size > 0){ + FifoBuffer f; + int sst_buff; + len = avcodec_decode_audio(c, (short *)wma_outbuf, &out_size, inbuf_ptr, size); if(len < 0) break; if(out_size <= 0) continue; - wma_playbuff(playback, c->channels, out_size); + fifo_init(&f, out_size*2); + fifo_write(&f, wma_outbuf, out_size, &f.wptr); + + while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode) + { + sst_buff = wma_st_buff; + if (wma_pause) + memset(wma_s_outbuf, 0, sst_buff); + playback->pass_audio(playback, FMT_S16_NE, + c->channels, sst_buff, (short *)wma_s_outbuf, NULL); + memset(wma_s_outbuf, 0, sst_buff); + } + + fifo_free(&f); size -= len; inbuf_ptr += len;