[FFmpeg-devel] [PATCH] FFplay : Fix segfault when playing mono audio streams.

Michael Niedermayer michaelni
Wed Jul 7 20:01:42 CEST 2010


On Wed, Jul 07, 2010 at 07:51:27PM +0530, Jai Menon wrote:
> On Wed, Jul 7, 2010 at 7:41 PM, Tomas H?rdin <tomas.hardin at codemill.se> wrote:
> > 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.
> 
> fine with me. i'll change it in the commit.

ok with fixed verticl alignment

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100707/fdaa1bdb/attachment.pgp>



More information about the ffmpeg-devel mailing list