[MPlayer-dev-eng] calling earth ... PATCHES!

Oswald Buddenhagen ossi at kde.org
Sun Feb 8 17:47:30 CET 2004


i'm amazed by the amount of feedback i got to these mails ... ;)

On Sun, Feb 01, 2004 at 03:36:10AM +0100, Oswald Buddenhagen wrote:
> On Fri, Jan 30, 2004 at 01:23:29PM +0100, Oswald Buddenhagen wrote:
> > surprise surprise, it still does not work. :[
> > 
> > On Fri, Jan 16, 2004 at 02:52:34PM +0100, Oswald Buddenhagen wrote:
> > > this must have been introduced somewhen between my last cvs update (no
> > > more than two weeks) and today.
> > > 
> > more concretely, it was between jan 8 and jan 16.
> > 
> i tracked it down to rev 1.7 of libmpdemux/ai_oss.c
> 
> > things do work fine with -oac pcm, so the problem is possibly in the
> > liblame interface code. liblame is current cvs HEAD (works fine when i
> > downgrade mencoder).
> > 
> the problem is the combination of my soundcard with liblame: my card (or
> the driver, whatever) says the actual sample rate is 44101, instead of
> 44100. as a consequence, liblame cannot handle the data:
> 
> > > my command line is (as ever):
> > > 
> > >  mencoder tv:// -tv \
> > >   driver=v4l:width=768:height=576:volume=65535:bass=32768:treble=32768 \
> > >   -vf crop=720:540:24:18,pp=lb,denoise3d -ovc lavc -lavcopts \
> > >   vcodec=mpeg4:vqscale=4:keyint=300 -oac mp3lame -lameopts fast:vbr=4:q=4
> > > 
> > > output is: [...]
> > > 
> > > Video stream:  665.036 kbit/s  (83129 bps)  size: 3358431 bytes  40.400 secs  1009 frames
> > > 
> > > Audio stream:      nan kbit/s  (-2147483648 bps)  size: 0 bytes  0.000 secs
> > >   MJP: returning!
> > > 
> 
> two consequences:
> - the attached patch: if the actual rate is within +/- 10 hz of the
>   requested rate, pretend that it is the requested rate. the 10 is
>   arbitrary - maybe it would be better to use 1, so only rounding errors
>   are caught.
> - we know that liblame cannot handle "odd" rates, so we should refuse
>   them.
> 

> Index: ai_oss.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpdemux/ai_oss.c,v
> retrieving revision 1.8
> diff -U2 -r1.8 ai_oss.c
> --- ai_oss.c	29 Jan 2004 12:43:54 -0000	1.8
> +++ ai_oss.c	1 Feb 2004 02:33:02 -0000
> @@ -24,9 +24,14 @@
>  #include "mp_msg.h"
>  
> +#define TOL 10 /* rate tolerance for broken audio cards/drivers */
> +
>  int ai_oss_set_samplerate(audio_in_t *ai)
>  {
>      int tmp = ai->req_samplerate;
>      if (ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &tmp) == -1) return -1;
> -    ai->samplerate = tmp;
> +    if (tmp < ai->req_samplerate - TOL || tmp > ai->req_samplerate + TOL)
> +    	ai->samplerate = tmp;
> +    else
> +    	ai->samplerate = ai->req_samplerate;
>      return 0;
>  }
> @@ -104,5 +109,9 @@
>  	return -1;
>      }
> -    ai->samplerate = ioctl_param;
> +    if (ioctl_param < ai->req_samplerate - TOL ||
> +	ioctl_param > ai->req_samplerate + TOL)
> +	ai->samplerate = ioctl_param;
> +    else
> +	ai->samplerate = ai->req_samplerate;
>  
>      mp_msg(MSGT_TV, MSGL_V, "ioctl dsp trigger: %d\n",


On Sun, Feb 01, 2004 at 04:04:13AM +0100, Oswald Buddenhagen wrote:
> heya,
> 
> the attached patch removes several superflous volume settings - setting
> the mute flag should be sufficient. *)
> this fixes the major annoyance that every time i start xawtv after
> mencoder had run, the volume is zero and i have to manually increase it
> again.
> 
> i'm not sure that having tv_param_volume -1 is a good default, but one
> can't set it to -1 explicitly ... maybe a big fat warning should be
> emited if the volume is detected to be (close to) zero.
> 
> *) if it's not on some (broken) setups, one could go a different route:
> save the current setting and restore it at shutdown.
> 

> Index: tvi_v4l.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_v4l.c,v
> retrieving revision 1.70
> diff -U2 -r1.70 tvi_v4l.c
> --- tvi_v4l.c	20 Jan 2004 13:32:05 -0000	1.70
> +++ tvi_v4l.c	1 Feb 2004 02:58:13 -0000
> @@ -333,5 +333,4 @@
>  
>  	/* mute all channels */
> -	priv->audio[i].volume = 0;
>  	priv->audio[i].flags |= VIDEO_AUDIO_MUTE;
>  	reqmode = -1;
> @@ -697,5 +696,4 @@
>  
>      if (priv->capability.audios) {
> -	priv->audio[priv->audio_id].volume = 0;
>  	priv->audio[priv->audio_id].flags |= VIDEO_AUDIO_MUTE;
>  	ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
> @@ -1129,5 +1127,4 @@
>  	    
>  	    if (priv->capability.audios) {
> -		priv->audio[priv->audio_id].volume = 0;
>  		priv->audio[priv->audio_id].flags |= VIDEO_AUDIO_MUTE;
>  		ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
> @@ -1148,5 +1145,4 @@
>  
>  	    if (priv->capability.audios) {
> -		priv->audio[priv->audio_id].volume = tv_param_volume;
>  		priv->audio[priv->audio_id].flags &= ~VIDEO_AUDIO_MUTE;
>  		ioctl(priv->video_fd, VIDIOCSAUDIO, &priv->audio[priv->audio_id]);
> Index: tv.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
> retrieving revision 1.65
> diff -U2 -r1.65 tv.c
> --- tv.c	11 Jan 2004 17:07:32 -0000	1.65
> +++ tv.c	1 Feb 2004 02:58:13 -0000
> @@ -61,5 +61,5 @@
>  #if defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)
>  int tv_param_amode = -1;
> -int tv_param_volume = 60000;
> +int tv_param_volume = -1;
>  int tv_param_bass = -1;
>  int tv_param_treble = -1;

greetings

-- 
Chaos, panic, and disorder - my work here is done.




More information about the MPlayer-dev-eng mailing list