diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-02-05 15:16:38 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-02-05 15:16:38 +0000 |
commit | 4c7c76456dbe58c8604ae6351e6e265cc713851c (patch) | |
tree | 335dcd2f5448c38b57914fe0433403ad34e490b0 /ffplay.c | |
parent | ffdf0d48fc7911ca6b818c38544436858cb92304 (diff) | |
download | ffmpeg-4c7c76456dbe58c8604ae6351e6e265cc713851c.tar.gz |
Make sure the rdft has enough audio available.
10l (looks cleaner now)
Originally committed as revision 21645 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -782,11 +782,17 @@ static void video_audio_display(VideoState *s) int i, i_start, x, y1, y, ys, delay, n, nb_display_channels; int ch, channels, h, h2, bgcolor, fgcolor; int16_t time_diff; + int rdft_bits, nb_freq; + + for(rdft_bits=1; (1<<rdft_bits)<2*s->height; rdft_bits++) + ; + nb_freq= 1<<(rdft_bits-1); /* compute display index : center on currently output samples */ channels = s->audio_st->codec->channels; nb_display_channels = channels; if (!s->paused) { + int data_used= s->show_audio==1 ? s->width : (2*nb_freq); n = 2 * channels; delay = audio_write_get_buf_size(s); delay /= n; @@ -798,9 +804,9 @@ static void video_audio_display(VideoState *s) delay += (time_diff * s->audio_st->codec->sample_rate) / 1000000; } - delay -= s->width / 2; - if (delay < s->width) - delay = s->width; + delay -= data_used / 2; + if (delay < data_used) + delay = data_used; i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE); if(s->show_audio==1){ @@ -866,16 +872,12 @@ static void video_audio_display(VideoState *s) } SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height); }else{ - int rdft_bits, nb_freq; nb_display_channels= FFMIN(nb_display_channels, 2); - for(rdft_bits=1; (1<<rdft_bits)<2*s->height; rdft_bits++) - ; if(rdft_bits != s->rdft_bits){ ff_rdft_end(&s->rdft); ff_rdft_init(&s->rdft, rdft_bits, RDFT); s->rdft_bits= rdft_bits; } - nb_freq= 1<<(rdft_bits-1); { FFTSample data[2][2*nb_freq]; for(ch = 0;ch < nb_display_channels; ch++) { |