Ticket #69: patch

File patch, 3.1 KB (added by eyager@…, 15 years ago)

Patch to libao2/ao_alsa.c and manpage for mixer index support.

  • DOCS/man/en/mplayer.1

    RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v
    retrieving revision 1.688
    diff -u -r1.688 mplayer.1
     
    1 .\" $Revision: 1.688 $
     1.\" $Revision: 0.688 $
    22.\" MPlayer (C) 2000-2004 MPlayer Team
    33.\" This man page was/is done by Gabucino, Diego Biurrun, Jonas Jermann
    44.
     
    16651665For ALSA this is the mixer name.
    16661666.
    16671667.TP
    1668 .B \-mixer-channel <mixer line> (\-ao oss and \-ao alsa only)
     1668.B \-mixer-channel <mixer line>[,mixer index] (\-ao oss and \-ao alsa only)
    16691669This option will tell MPlayer to use a different channel for controlling
    16701670volume than the default PCM.
    16711671Options for OSS include
     
    16741674/usr/\:include/\:linux/\:soundcard.h.
    16751675For ALSA you can use the names e.g.\& alsamixer displays, like
    16761676.B Master, Line, PCM.
     1677.br
     1678.I NOTE: 
     1679ALSA mixer channel names followed by a number must be specified in the <name,number>
     1680format, i.e. a channel labled 'PCM 1' in alsamixer must be converted to
     1681.B PCM,1.
     1682
     1683
    16771684.
    16781685.TP
    16791686.B \-nowaveheader (\-ao pcm only)
  • libao2/ao_alsa.c

    RCS file: /cvsroot/mplayer/main/libao2/ao_alsa.c,v
    retrieving revision 1.7
    diff -u -r1.7 ao_alsa.c
     
    88  08/22/2002 iec958-init rewritten and merged with common init, zsolt
    99  04/13/2004 merged with ao_alsa1.x, fixes provided by Jindrich Makovicka
    1010  04/25/2004 printfs converted to mp_msg, Zsolt.
     11  08/30/2004 Mixer index support by Eric Yagerlener <eyager@chartermi.net>
    1112 
    1213  Any bugreports regarding to this driver are welcome.
    1314*/
     
    101102
    102103      static char *mix_name = "PCM";
    103104      static char *card = "default";
     105      static int mix_index = 0;
    104106
    105107      long pmin, pmax;
    106108      long get_vol, set_vol;
    107109      float f_multi;
    108110
    109       if(mixer_channel) mix_name = mixer_channel;
     111      if(mixer_channel){
     112         char *test_mix_index;
     113         mix_name = mixer_channel;
     114         
     115         /* Parser to support specifying a mixer index.
     116          * cmd arg -mixer-channel <CHANNEL>[,INDEX]
     117          * If no index specified, leave at 0. 
     118         */
     119         if (test_mix_index=strpbrk(mix_name,",")){
     120                /* If a comma is found mix_name will be truncated at the comma.
     121                 * Test for a number to the right of the comma, if true
     122                 * assign mix_index its value.  If false print error.
     123                */
     124                *(test_mix_index++)=0;
     125                if (isdigit(*test_mix_index)) mix_index=atoi(test_mix_index);
     126                else printf("alsa-control: non numeric or null mixer index. Defaulting to 0\n");
     127         }
     128      }
    110129      if(mixer_device) card = mixer_device;
    111130
    112131      if(ao_data.format == AFMT_AC3)
     
    116135      snd_mixer_selem_id_alloca(&sid);
    117136       
    118137      //sets simple-mixer index and name
    119       snd_mixer_selem_id_set_index(sid, 0);
     138      snd_mixer_selem_id_set_index(sid, mix_index);
    120139      snd_mixer_selem_id_set_name(sid, mix_name);
    121140
    122141      if ((err = snd_mixer_open(&handle, 0)) < 0) {