GNOME Bugzilla – Bug 118230
esound should read esd.conf and friends whether it is to autospawn or not
Last modified: 2004-12-22 21:47:04 UTC
Currently when apps like gnome-session call esd and esd is not set to autospawn, esd does not read esd.conf ESD_SPAWN_OPTIONS or ~/.esd.conf. Since esd is often by default not set to autospawn, esd may not work with certain soundcards that need to specify a rate for esd to work at all (eg i810_audio needs '-r 48000' to work with esd). The proposed patch allows esd to work in a more standard way-- it will read environment variables (ESD_SPAWN_OPTIONS) and config files (esd.conf and ~/.esd.conf) in addition to parsing command line arguments. The basic idea of the patch is to take some stuff out of esd_config.c and put it into a new esd-config.h, so that esd.c can use it, then modify esd.c (main()) to put esd_spawn_options (as read from esd.conf and friends) into *opts[], and then put argv after esd_spawn_options in *opts[]. Then rather than looping through argv, the loop parses *opts[]. argv is after esd_spawn_options in *opts[] so that command line arguments take precedence over esd.conf. I use esd_config_read() in main() so that esd.conf, ~/.esd.conf and ESD_SPAWN_OPTIONS are all considered. The maximum number of combined arguments (argv + esd_spawn_options) is MAX_ARGS, which in the patch is 128. This is probably too high, but as the patch is now, arguments from esd_spawn_options and argv are read into *opts[], and stops at MAX_ARGS-- any more args are simply dropped. So I left it high. The proposed patch applies cleanly to 0.2.29 and was checked under memprof with no leaks.
Created attachment 18579 [details] [review] patch to make esd read esd.conf and friends when not autospawning
Modified version committed on CVS. Thanks.
*** Bug 97138 has been marked as a duplicate of this bug. ***