title: MPlayer – changing ‘ao=’ codec order in mplayer.conf does not appear to work for per user config?
body: <p>Quoting mplayer.conf:<br>
  " Configuration files are read system-wide from /etc/mplayer/mplayer.conf<br>
   and per user from ~/.mplayer/config, where per-user settings override<br>
   system-wide settings, all of which are overrriden by the command line."<br>
  <br>
  However, changing the order of audio codec so that 'alsa' is first in user config file does not appear to work.</p>
  
  <p>My preference is to leave the /etc/mplayer/mplayer.conf file as is and make changes to the mplayer.conf file in ~/.mplayer/config</p>
  
  <p>Using the following line: 'ao=alsa,pulse,sdl:aalib' only works in the /etc/mplayer conf file and therefore don't appear to be overridden by the 'per-user' settings.</p>
  
  <p>Also, I would prefer not to start mplayer with the '-ao alsa' option either...</p>
  
  <p>Any thoughts on if this is a 'bug' or 'feature request' or have I missed something?</p>
  
  <p>Edit - adding that playing an mp3, the following warning is returned:
  "AO: [pulse] Init failed: Connection refused
  Failed to initialize audio driver 'pulse'
  AO: [alsa] 44100Hz 1ch floatle (4 bytes per sample)
  Video: no video
  Starting playback..."</p>
  
  <p>FIXED<br>
  MPlayer looks for the environment variable 'HOME' to determine where to look for the users mplayer config file.
  Apps such as lighttpd used to run scripts that in turn run mplayer do not by default set the 'HOME' environment variable. 
  One could argue and say there is a limitation with MPlayer only looking for an environment value 'HOME' rather than a more robust mechanism to determine a users 'home' directory.... </p>
  
  <p>Running MPlayer with 'env HOME=/var/www' will help MPlayer locate the users config file without having to edit /etc/mplayer/mplayer.conf. This also fixes the need to run MPlayer with sudo:</p>
  
  <p>As an example, the following instruction works in a python script called from a remote browser connecting to lightpd web server on a raspberry pi:
  playing_mplayer=subprocess.Popen(['env', 'HOME=/var/www', 'mplayer', '-slave', '-nocache', '-quiet', '-volume', '60', '-key-fifo-size', '2', '-input', 'file=/run/shm/mpcontrol', '-playlist', '<a href="http://tx.whatson.com/icecast.php?i=magic1054.mp3.m3u" rel="nofollow">http://tx.whatson.com/icecast.php?i=magic1054.mp3.m3u</a>' ], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)</p>