|
|
@ -810,20 +810,20 @@ static void video_audio_display(VideoState *s) |
|
|
|
|
|
|
|
|
|
|
|
i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE); |
|
|
|
i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE); |
|
|
|
if(s->show_audio==1){ |
|
|
|
if(s->show_audio==1){ |
|
|
|
h= INT_MIN; |
|
|
|
h= INT_MIN; |
|
|
|
for(i=0; i<1000; i+=channels){ |
|
|
|
for(i=0; i<1000; i+=channels){ |
|
|
|
int idx= (SAMPLE_ARRAY_SIZE + x - i) % SAMPLE_ARRAY_SIZE; |
|
|
|
int idx= (SAMPLE_ARRAY_SIZE + x - i) % SAMPLE_ARRAY_SIZE; |
|
|
|
int a= s->sample_array[idx]; |
|
|
|
int a= s->sample_array[idx]; |
|
|
|
int b= s->sample_array[(idx + 4*channels)%SAMPLE_ARRAY_SIZE]; |
|
|
|
int b= s->sample_array[(idx + 4*channels)%SAMPLE_ARRAY_SIZE]; |
|
|
|
int c= s->sample_array[(idx + 5*channels)%SAMPLE_ARRAY_SIZE]; |
|
|
|
int c= s->sample_array[(idx + 5*channels)%SAMPLE_ARRAY_SIZE]; |
|
|
|
int d= s->sample_array[(idx + 9*channels)%SAMPLE_ARRAY_SIZE]; |
|
|
|
int d= s->sample_array[(idx + 9*channels)%SAMPLE_ARRAY_SIZE]; |
|
|
|
int score= a-d; |
|
|
|
int score= a-d; |
|
|
|
if(h<score && (b^c)<0){ |
|
|
|
if(h<score && (b^c)<0){ |
|
|
|
h= score; |
|
|
|
h= score; |
|
|
|
i_start= idx; |
|
|
|
i_start= idx; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s->last_i_start = i_start; |
|
|
|
s->last_i_start = i_start; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -832,45 +832,45 @@ static void video_audio_display(VideoState *s) |
|
|
|
|
|
|
|
|
|
|
|
bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); |
|
|
|
bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); |
|
|
|
if(s->show_audio==1){ |
|
|
|
if(s->show_audio==1){ |
|
|
|
fill_rectangle(screen, |
|
|
|
fill_rectangle(screen, |
|
|
|
s->xleft, s->ytop, s->width, s->height, |
|
|
|
s->xleft, s->ytop, s->width, s->height, |
|
|
|
bgcolor); |
|
|
|
bgcolor); |
|
|
|
|
|
|
|
|
|
|
|
fgcolor = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff); |
|
|
|
fgcolor = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff); |
|
|
|
|
|
|
|
|
|
|
|
/* total height for one channel */ |
|
|
|
/* total height for one channel */ |
|
|
|
h = s->height / nb_display_channels; |
|
|
|
h = s->height / nb_display_channels; |
|
|
|
/* graph height / 2 */ |
|
|
|
/* graph height / 2 */ |
|
|
|
h2 = (h * 9) / 20; |
|
|
|
h2 = (h * 9) / 20; |
|
|
|
for(ch = 0;ch < nb_display_channels; ch++) { |
|
|
|
for(ch = 0;ch < nb_display_channels; ch++) { |
|
|
|
i = i_start + ch; |
|
|
|
i = i_start + ch; |
|
|
|
y1 = s->ytop + ch * h + (h / 2); /* position of center line */ |
|
|
|
y1 = s->ytop + ch * h + (h / 2); /* position of center line */ |
|
|
|
for(x = 0; x < s->width; x++) { |
|
|
|
for(x = 0; x < s->width; x++) { |
|
|
|
y = (s->sample_array[i] * h2) >> 15; |
|
|
|
y = (s->sample_array[i] * h2) >> 15; |
|
|
|
if (y < 0) { |
|
|
|
if (y < 0) { |
|
|
|
y = -y; |
|
|
|
y = -y; |
|
|
|
ys = y1 - y; |
|
|
|
ys = y1 - y; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ys = y1; |
|
|
|
ys = y1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fill_rectangle(screen, |
|
|
|
|
|
|
|
s->xleft + x, ys, 1, y, |
|
|
|
|
|
|
|
fgcolor); |
|
|
|
|
|
|
|
i += channels; |
|
|
|
|
|
|
|
if (i >= SAMPLE_ARRAY_SIZE) |
|
|
|
|
|
|
|
i -= SAMPLE_ARRAY_SIZE; |
|
|
|
} |
|
|
|
} |
|
|
|
fill_rectangle(screen, |
|
|
|
|
|
|
|
s->xleft + x, ys, 1, y, |
|
|
|
|
|
|
|
fgcolor); |
|
|
|
|
|
|
|
i += channels; |
|
|
|
|
|
|
|
if (i >= SAMPLE_ARRAY_SIZE) |
|
|
|
|
|
|
|
i -= SAMPLE_ARRAY_SIZE; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff); |
|
|
|
fgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff); |
|
|
|
|
|
|
|
|
|
|
|
for(ch = 1;ch < nb_display_channels; ch++) { |
|
|
|
for(ch = 1;ch < nb_display_channels; ch++) { |
|
|
|
y = s->ytop + ch * h; |
|
|
|
y = s->ytop + ch * h; |
|
|
|
fill_rectangle(screen, |
|
|
|
fill_rectangle(screen, |
|
|
|
s->xleft, y, s->width, 1, |
|
|
|
s->xleft, y, s->width, 1, |
|
|
|
fgcolor); |
|
|
|
fgcolor); |
|
|
|
} |
|
|
|
} |
|
|
|
SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height); |
|
|
|
SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
nb_display_channels= FFMIN(nb_display_channels, 2); |
|
|
|
nb_display_channels= FFMIN(nb_display_channels, 2); |
|
|
|
if(rdft_bits != s->rdft_bits){ |
|
|
|
if(rdft_bits != s->rdft_bits){ |
|
|
|