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

Jai Menon jmenon86
Wed Jul 7 20:15:24 CEST 2010


On Wed, Jul 7, 2010 at 11:31 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> 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

applied.

-- 
Jai Menon



More information about the ffmpeg-devel mailing list