Revision 4c7c7645 ffplay.c

View differences:

ffplay.c
782 782
    int i, i_start, x, y1, y, ys, delay, n, nb_display_channels;
783 783
    int ch, channels, h, h2, bgcolor, fgcolor;
784 784
    int16_t time_diff;
785
    int rdft_bits, nb_freq;
786

  
787
    for(rdft_bits=1; (1<<rdft_bits)<2*s->height; rdft_bits++)
788
        ;
789
    nb_freq= 1<<(rdft_bits-1);
785 790

  
786 791
    /* compute display index : center on currently output samples */
787 792
    channels = s->audio_st->codec->channels;
788 793
    nb_display_channels = channels;
789 794
    if (!s->paused) {
795
        int data_used= s->show_audio==1 ? s->width : (2*nb_freq);
790 796
        n = 2 * channels;
791 797
        delay = audio_write_get_buf_size(s);
792 798
        delay /= n;
......
798 804
            delay += (time_diff * s->audio_st->codec->sample_rate) / 1000000;
799 805
        }
800 806

  
801
        delay -= s->width / 2;
802
        if (delay < s->width)
803
            delay = s->width;
807
        delay -= data_used / 2;
808
        if (delay < data_used)
809
            delay = data_used;
804 810

  
805 811
        i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE);
806 812
        if(s->show_audio==1){
......
866 872
    }
867 873
    SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height);
868 874
    }else{
869
        int rdft_bits, nb_freq;
870 875
        nb_display_channels= FFMIN(nb_display_channels, 2);
871
        for(rdft_bits=1; (1<<rdft_bits)<2*s->height; rdft_bits++)
872
            ;
873 876
        if(rdft_bits != s->rdft_bits){
874 877
            ff_rdft_end(&s->rdft);
875 878
            ff_rdft_init(&s->rdft, rdft_bits, RDFT);
876 879
            s->rdft_bits= rdft_bits;
877 880
        }
878
        nb_freq= 1<<(rdft_bits-1);
879 881
        {
880 882
            FFTSample data[2][2*nb_freq];
881 883
            for(ch = 0;ch < nb_display_channels; ch++) {

Also available in: Unified diff