[FFmpeg-devel] [PATCH] FFplay : Fix segfault when playing mono audio streams.
Tomas Härdin
tomas.hardin
Wed Jul 7 16:11:12 CEST 2010
On Wed, 2010-07-07 at 19:26 +0530, Jai Menon wrote:
> ---
> ffplay.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/ffplay.c b/ffplay.c
> index a43dbb1..5dfb898 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -941,7 +941,8 @@ static void video_audio_display(VideoState *s)
> for(y=0; y<s->height; y++){
> double w= 1/sqrt(nb_freq);
> int a= sqrt(w*sqrt(data[0][2*y+0]*data[0][2*y+0] + data[0][2*y+1]*data[0][2*y+1]));
> - int b= sqrt(w*sqrt(data[1][2*y+0]*data[1][2*y+0] + data[1][2*y+1]*data[1][2*y+1]));
> + int b= (nb_display_channels == 2 ) ? sqrt(w*sqrt(data[1][2*y+0]*data[1][2*y+0]
> + + data[1][2*y+1]*data[1][2*y+1])) : 0;
> a= FFMIN(a,255);
> b= FFMIN(b,255);
> fgcolor = SDL_MapRGB(screen->format, a, b, (a+b)/2);
How about changing the else case from ": 0 " to ": a"? That way mono
audio should show up grayscale instead of red, which is consistent with
how that works for stereo.
/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100707/ebdfe363/attachment.pgp>
More information about the ffmpeg-devel
mailing list