[MPlayer-dev-eng] [PATCH] oss mixer into ao_arts.c

gpanco - gpanco at tiscali.it
Mon Oct 20 13:13:10 CEST 2003


hello to all,

thanks a lot for your wonderfull work, i'am not a coder but i've try a
little patch.

i've thinked (?) to add alsa mixer and modify ao_esd.c too (and add
config options ?)

what do you think about ?

excuse my for my bad english...

bye,
giovanni.
-------------- next part --------------
diff -r MPlayer-1.0pre2-my/libao2/ao_arts.c MPlayer-1.0pre2/libao2/ao_arts.c
13,24d12
< #include <stdlib.h>
< 
< #include <sys/ioctl.h>
< #include <unistd.h>
< #include <sys/time.h>
< #include <sys/types.h>
< #include <sys/stat.h>
< #include <fcntl.h>
< #include <errno.h>
< #include <string.h>
< #include <sys/soundcard.h>
< 
31,32d18
< #include "../mixer.h"
< 
51,104c37,39
< // copied as-is from ao_oss.c
< // 
< static char *dsp=PATH_DEV_DSP;
< static char *oss_mixer_device = PATH_DEV_MIXER;
< 
< // to set/get/query special features/parameters
< static int control(int cmd,void *arg){
<     switch(cmd){
< 	case AOCONTROL_SET_DEVICE:
< 	    dsp=(char*)arg;
< 	    return CONTROL_OK;
< 	case AOCONTROL_GET_DEVICE:
< 	    (char*)arg=dsp;
< 	    return CONTROL_OK;
< 	case AOCONTROL_QUERY_FORMAT:
< 	    return CONTROL_TRUE;
< 	case AOCONTROL_GET_VOLUME:
< 	case AOCONTROL_SET_VOLUME:
< 	{
< 	    ao_control_vol_t *vol = (ao_control_vol_t *)arg;
< 	    int fd, v, devs;
< 
< 	    if(ao_data.format == AFMT_AC3)
< 		return CONTROL_TRUE;
<     
< 	    if ((fd = open(oss_mixer_device, O_RDONLY)) > 0)
< 	    {
< 		ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs);
< 		if (devs & SOUND_MASK_PCM)
< 		{
< 		    if (cmd == AOCONTROL_GET_VOLUME)
< 		    {
< 		        ioctl(fd, SOUND_MIXER_READ_PCM, &v);
< 			vol->right = (v & 0xFF00) >> 8;
< 			vol->left = v & 0x00FF;
< 		    }
< 		    else
< 		    {
< 		        v = ((int)vol->right << 8) | (int)vol->left;
< 			ioctl(fd, SOUND_MIXER_WRITE_PCM, &v);
< 		    }
< 		}
< 		else
< 		{
< 		    close(fd);
< 		    return CONTROL_ERROR;
< 		}
< 		close(fd);
< 		return CONTROL_OK;
< 	    }
< 	}
< 	return CONTROL_ERROR;
<     }
<     return CONTROL_UNKNOWN;
---
> static int control(int cmd, void *arg)
> {
> 	return(CONTROL_UNKNOWN);
107d41
< 


More information about the MPlayer-dev-eng mailing list