Re: Re: Minor bug: setvolume > 65535 - wierd stuff happens..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 26 Sep 2001, Gerd Knorr wrote:

> Stephen Davies wrote:
> >  
> >  Hi Gerd,
> >  
> >  If you call VIDIOCSAUDIO with a volume > 65535 on my msp3400-equipped
> >  board then "bad stuff" happens:
> 
> How do you do that?  video_audio.volume is __u16, you can hardly put
> anything > 65535 in there ...

/me digs deeper

Ah.  Then:

If volume has been set to 0 then VIDIOCGAUDIO returns balance 0.

The application I'm having trouble with uses VIDIOCGAUDIO to fetch the
audio settings, resets the volume and calls VIDIOCSAUDIO.  Result is that
the balance gets "stuck" over to the one side.

It's got to do with this code in msp3400.c for VIDIOCGAUDIO:


    va->volume=MAX(msp->left,msp->right);		// =0
    va->balance=(32768*MIN(msp->left,msp->right))/
                (va->volume ? va->volume : 1);		// =0
    va->balance=(msp->left<msp->right)?
                (65535-va->balance) : va->balance;	// =0

I suppose the best fix is to remember the balance as set - but an OK fix
could be just to insert:

    va->volume=MAX(msp->left,msp->right);               // =0
    if (va->volume == 0)
	va->balance = 32768;
    else {
	va->balance=(32768*MIN(msp->left,msp->right)) /
                (va->volume ? va->volume : 1);          // =32768
        va->balance=(msp->left<msp->right)?
                (65535-va->balance) : va->balance;      // =32768
    }

Probably there's a better way to tweak it but I'm tired and this works for
me!

Secondary question: how can you set this balance in xawtv?  No control
shows up for balance on my system, and you can't set the left and right
separately.

Steve






[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux