diff -u -r ../../mplayer-cvs.orig/main/ChangeLog ./ChangeLog --- ../../mplayer-cvs.orig/main/ChangeLog 2005-10-06 21:24:06.000000000 +0200 +++ ./ChangeLog 2005-10-08 21:13:26.156298862 +0200 @@ -24,6 +24,7 @@ * support for custom fragment programs for -vo gl (see TOOLS/*.fp) * use libvbe from vesautils as VESA video driver * several fixes for the GGI video output driver + * -ao esd support the TCP port as second parameter Decoders: * Indeo2 (RT21) support via lavc diff -u -r ../../mplayer-cvs.orig/main/DOCS/man/en/mplayer.1 ./DOCS/man/en/mplayer.1 --- ../../mplayer-cvs.orig/main/DOCS/man/en/mplayer.1 2005-10-06 14:42:48.000000000 +0200 +++ ./DOCS/man/en/mplayer.1 2005-10-08 20:57:45.000000000 +0200 @@ -1959,6 +1959,15 @@ .RSs .IPs Explicitly choose the ESD server to use (default: localhost). +.IPs +Explicitly choose the TCP port where ESD server listens. +If specified this must be the second suboption. (default: 16001) +.sp 1 +.I \ \ \ \ \ \ \ EXAMPLES: +.RSs +.IPs -ao\ esd +.IPs -ao\ esd:server +.IPs -ao\ esd:server:16001 .RE .PD 1 . diff -u -r ../../mplayer-cvs.orig/main/help/help_mp-en.h ./help/help_mp-en.h --- ../../mplayer-cvs.orig/main/help/help_mp-en.h 2005-09-19 16:07:11.000000000 +0200 +++ ./help/help_mp-en.h 2005-10-08 20:55:06.000000000 +0200 @@ -990,6 +990,7 @@ #define MSGTR_AO_ESD_CantOpenSound "[AO ESD] esd_open_sound failed: %s\n" #define MSGTR_AO_ESD_LatencyInfo "[AO ESD] latency: [server: %0.2fs, net: %0.2fs] (adjust %0.2fs)\n" #define MSGTR_AO_ESD_CantOpenPBStream "[AO ESD] failed to open esd playback stream: %s\n" +#define MSGTR_AO_ESD_OutOfMemory "[AO ESD] out of memory\n" // ao_mpegpes.c #define MSGTR_AO_MPEGPES_CantSetMixer "[AO MPEGPES] DVB audio set mixer failed: %s\n" diff -u -r ../../mplayer-cvs.orig/main/libao2/ao_esd.c ./libao2/ao_esd.c --- ../../mplayer-cvs.orig/main/libao2/ao_esd.c 2005-01-12 23:00:02.000000000 +0100 +++ ./libao2/ao_esd.c 2005-10-08 20:52:27.000000000 +0200 @@ -50,6 +50,14 @@ #define ESD_CLIENT_NAME "MPlayer" #define ESD_MAX_DELAY (1.0f) /* max amount of data buffered in esd (#sec) */ +#define AO_ESD_OVERWRITES_PARAMETER + +#ifdef AO_ESD_OVERWRITES_PARAMETER +#define AO_ESD_FREE_BUFFER(var_name) if (var_name) free(var_name); +#else +#define AO_ESD_FREE_BUFFER(var_name) +#endif + static ao_info_t info = { "EsounD audio output", @@ -138,19 +146,49 @@ /* * open & setup audio device * return: 1=success 0=fail + * + * We receive the driver's suboptions in ao_subdevice. + * We can use the suboptions string as is, because subotions + * are separated with ':', and esd_open_sound()'s and + * esd_play_stream_fallback()'s "host" parameter can be + * - NULL + * - host (for example "localhost") + * - host:port (for example "localhost:16001", which is the default) */ static int init(int rate_hz, int channels, int format, int flags) { esd_format_t esd_fmt; int bytes_per_sample; int fl; +#ifdef AO_ESD_OVERWRITES_PARAMETER + char *server = NULL; + int server_len; +#else char *server = ao_subdevice; /* NULL for localhost */ +#endif float lag_seconds, lag_net, lag_serv; struct timeval proto_start, proto_end; +#ifdef AO_ESD_OVERWRITES_PARAMETER + if (ao_subdevice) { + /* unfortunately esd_open_sound(const char* host) will + truncate its "host" parameter after the first ':', + so make a copy to variable "server" and use only the copy. + */ + server_len = strlen(ao_subdevice); + server = (char*)malloc(server_len+1); + if (!server) { + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ESD_OutOfMemory); + return 0; + } + memcpy(server, ao_subdevice, server_len+1); + } +#endif + if (esd_fd < 0) { esd_fd = esd_open_sound(server); if (esd_fd < 0) { + AO_ESD_FREE_BUFFER(server); mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ESD_CantOpenSound, strerror(errno)); return 0; @@ -232,9 +270,16 @@ lag_serv, lag_net, lag_seconds); } +#ifdef AO_ESD_OVERWRITES_PARAMETER + /* copy the server parameter again because it was likely truncated */ + if (server) + memcpy(server, ao_subdevice, server_len+1); +#endif + esd_play_fd = esd_play_stream_fallback(esd_fmt, rate_hz, server, ESD_CLIENT_NAME); if (esd_play_fd < 0) { + AO_ESD_FREE_BUFFER(server); mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ESD_CantOpenPBStream, strerror(errno)); return 0; } @@ -261,6 +306,7 @@ esd_play_start.tv_sec = 0; esd_samples_written = 0; esd_bytes_per_sample = bytes_per_sample; + AO_ESD_FREE_BUFFER(server); return 1; }