[Mplayer-cvslog] CVS: main cfg-mplayer.h,1.133,1.134 mixer.h,1.2,1.3 mixer.c,1.10,1.11 mplayer.c,1.400,1.401
Anders Johansson
anders at mplayer.dev.hu
Thu Feb 21 17:02:29 CET 2002
- Previous message: [Mplayer-cvslog] CVS: main/libao2 Makefile,1.18,1.19 ao_mpegpes.c,1.5,1.6 ao_oss.c,1.17,1.18 ao_sun.c,1.12,1.13 audio_out.c,1.21,1.22
- Next message: [Mplayer-cvslog] CVS: main/libao2 pl_resample.c,1.6,1.7 fir.h,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv11301
Modified Files:
cfg-mplayer.h mixer.h mixer.c mplayer.c
Log Message:
Moved HW dependent mixer stuff to libao and removed master switch
Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- cfg-mplayer.h 20 Feb 2002 22:43:33 -0000 1.133
+++ cfg-mplayer.h 21 Feb 2002 16:02:26 -0000 1.134
@@ -141,7 +141,7 @@
// {"dsp", &dsp, CONF_TYPE_STRING, CONF_NOCFG, 0, 0, NULL},
{"dsp", "Use -ao oss:dsp_path!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
{"mixer", &mixer_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"master", &mixer_usemaster, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ {"master", "Option -master was obsolete and has been removed\n" , CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
{"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 2, 6, NULL},
#ifdef HAVE_X11
{"display", &mDisplayName, CONF_TYPE_STRING, 0, 0, 0, NULL},
Index: mixer.h
===================================================================
RCS file: /cvsroot/mplayer/main/mixer.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mixer.h 5 Jun 2001 18:40:44 -0000 1.2
+++ mixer.h 21 Feb 2002 16:02:26 -0000 1.3
@@ -2,9 +2,6 @@
#ifndef __MPLAYER_MIXER
#define __MPLAYER_MIXER
-#define DEV_MIXER "/dev/mixer"
-
-extern int mixer_usemaster;
extern char * mixer_device;
extern void mixer_getvolume( float *l,float *r );
Index: mixer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mixer.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- mixer.c 17 Feb 2002 20:43:24 -0000 1.10
+++ mixer.c 21 Feb 2002 16:02:26 -0000 1.11
@@ -7,157 +7,34 @@
#include "config.h"
#include "mixer.h"
+#include "libao2/audio_out.h"
-#ifdef HAVE_DVB
-#include <ost/audio.h>
-audioMixer_t dvb_mixer={255,255};
-extern int vo_mpegpes_fd;
-extern int vo_mpegpes_fd2;
-#endif
+extern ao_functions_t *audio_out;
-#if defined(USE_OSS_AUDIO)
-
-/*
- * Mixer interface using OSS style soundcard commands.
- */
-
-#include <sys/soundcard.h>
-
-
-char * mixer_device=DEV_MIXER;
-int mixer_usemaster=0;
-
-void mixer_getvolume( float *l,float *r )
-{
- int fd,v,cmd,devs;
-
-#ifdef HAVE_DVB
- if(vo_mpegpes_fd2>=0){
- // DVB card
- *l=dvb_mixer.volume_left/2.56;
- *r=dvb_mixer.volume_right/2.56;
- return;
- }
-#endif
-
- fd=open( mixer_device,O_RDONLY );
- if ( fd != -1 )
- {
- ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs );
- if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_READ_PCM;
- else
- if ( ( devs & SOUND_MASK_VOLUME ) && ( mixer_usemaster==1 ) ) cmd=SOUND_MIXER_READ_VOLUME;
- else
- {
- close( fd );
- return;
- }
- ioctl( fd,cmd,&v );
- *r=( v & 0xFF00 ) >> 8;
- *l=( v & 0x00FF );
- close( fd );
- }
-}
-
-void mixer_setvolume( float l,float r )
-{
- int fd,v,cmd,devs;
-
-#ifdef HAVE_DVB
- if(vo_mpegpes_fd2>=0){
- // DVB card
- dvb_mixer.volume_left=l*2.56;
- dvb_mixer.volume_right=r*2.56;
- if(dvb_mixer.volume_left>255) dvb_mixer.volume_left=255;
- if(dvb_mixer.volume_right>255) dvb_mixer.volume_right=255;
-// printf("Setting DVB volume: %d ; %d \n",dvb_mixer.volume_left,dvb_mixer.volume_right);
- if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MIXER, &dvb_mixer) < 0)){
- perror("DVB AUDIO SET MIXER: ");
- return -1;
- }
- return;
- }
-#endif
-
- fd=open( mixer_device,O_RDONLY );
- if ( fd != -1 )
- {
- ioctl( fd,SOUND_MIXER_READ_DEVMASK,&devs );
- if ( ( devs & SOUND_MASK_PCM ) && ( mixer_usemaster==0 ) ) cmd=SOUND_MIXER_WRITE_PCM;
- else
- if ( ( devs & SOUND_MASK_VOLUME ) && ( mixer_usemaster==1 ) ) cmd=SOUND_MIXER_WRITE_VOLUME;
- else
- {
- close( fd );
- return;
- }
- v=( (int)r << 8 ) | (int)l;
- ioctl( fd,cmd,&v );
- close( fd );
- }
-}
-
-#elif defined(USE_SUN_AUDIO)
-
-/*
- * Mixer interface using Sun style soundcard commands.
- */
-
-#include <sys/audioio.h>
-
-
-char * mixer_device="/dev/audioctl";
-int mixer_usemaster=0;
+char * mixer_device=NULL;
void mixer_getvolume( float *l,float *r )
{
- int fd,v,cmd,devs;
-
- fd=open( mixer_device,O_RDONLY );
- if ( fd != -1 )
- {
- struct audio_info info;
-
- ioctl( fd,AUDIO_GETINFO,&info);
- *r=info.play.gain * 100. / AUDIO_MAX_GAIN;
- *l=info.play.gain * 100. / AUDIO_MAX_GAIN;
- close( fd );
+ ao_control_vol_t vol;
+ *l=0; *r=0;
+ if(audio_out){
+ if(CONTROL_OK != audio_out->control(AOCONTROL_GET_VOLUME,(int)&vol))
+ return;
+ *r=vol.right;
+ *l=vol.left;
}
}
void mixer_setvolume( float l,float r )
{
- int fd,v,cmd,devs;
-
- fd=open( mixer_device,O_RDONLY );
- if ( fd != -1 )
- {
- struct audio_info info;
- AUDIO_INITINFO(&info);
- info.play.gain = (r+l) * AUDIO_MAX_GAIN / 100 / 2;
- ioctl( fd,AUDIO_SETINFO,&info );
- close( fd );
+ ao_control_vol_t vol;
+ vol.right=r; vol.left=l;
+ if(audio_out){
+ if(CONTROL_OK != audio_out->control(AOCONTROL_SET_VOLUME,(int)&vol))
+ return;
}
}
-#else
-
-/*
- * No usable Mixer interface selected.
- * Just some stub routines.
- */
-
-char * mixer_device=NULL;
-int mixer_usemaster=0;
-
-void mixer_getvolume( float *l,float *r ){
- *l = *r = 50.0;
-}
-void mixer_setvolume( float l,float r ){
-}
-
-#endif
-
#define MIXER_CHANGE 3
void mixer_incvolume( void )
@@ -188,3 +65,8 @@
mixer_getvolume( &mixer_l,&mixer_r );
return ( mixer_l + mixer_r ) / 2;
}
+
+
+
+
+
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.400
retrieving revision 1.401
diff -u -r1.400 -r1.401
--- mplayer.c 21 Feb 2002 15:44:51 -0000 1.400
+++ mplayer.c 21 Feb 2002 16:02:26 -0000 1.401
@@ -171,7 +171,7 @@
#else
static vo_functions_t *video_out=NULL;
#endif
-static ao_functions_t *audio_out=NULL;
+ao_functions_t *audio_out=NULL;
// benchmark:
double video_time_usage=0;
@@ -2193,9 +2193,6 @@
#endif
}
break;
- case 'm':
- mixer_usemaster=!mixer_usemaster;
- break;
#if 0 // change to 1 for absolute seeking tests
case '1':
@@ -2451,7 +2448,6 @@
#endif
} break;
case MP_CMD_MIXER_USEMASTER : {
- mixer_usemaster=!mixer_usemaster;
} break;
case MP_CMD_CONTRAST : {
int v = cmd->args[0].v.i, abs = cmd->args[1].v.i;
- Previous message: [Mplayer-cvslog] CVS: main/libao2 Makefile,1.18,1.19 ao_mpegpes.c,1.5,1.6 ao_oss.c,1.17,1.18 ao_sun.c,1.12,1.13 audio_out.c,1.21,1.22
- Next message: [Mplayer-cvslog] CVS: main/libao2 pl_resample.c,1.6,1.7 fir.h,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list