Ticket #44 (closed enhancement: fixed)

Opened 2 years ago

Last modified 10 months ago

Esound-sink module respecting the ESPEAKER enviroment variable

Reported by: michiel Assigned to: lennart
Priority: normal Milestone: 0.9.7
Component: module-esound-* Severity: normal
Keywords: sink, enviroment, cookie Cc:

Description

I want to have module-esound-sink to respect the ESPEAKER enviroment variable and use it. This is because, sometimes ESD is started with autospawn and that uses the ESPEAKER enviroment variable to connect with the ESD server. I also want it to use the cookie which is in the homedirectory of the user.

I want to use this feature, because I need to use ESD for network transparancy. I can't use PulseAudio for it. I only want PulseAudio to be a "sound proxy" and redirects all trafic to ESD.

The ESPEAKER enviroment variable isset as the following ESPEAKER="127.0.0.1:16001". The Esound cookie files are, in my case, located in the home folder (/home/<user>/.esd_auth).

I've created some C code for it, to respect the ESPEAKER enviroment variable, but I don't know if it's going to work (not tested yet).

/* Beginning from line 366 of the original src/modules/module-esound-sink.c of the stable (0.9.5) version */
    char* esdenviroment = getenv("ESPEAKER");
    char* envserver;
    char* envport;
    int intenvport = 16001;
    char* delimitpos = 0;

    delimitpos = strchr(*esdenviroment, ':');

    if (delimitpos != NULL)
    {
        strncpy(*envserver, *esdenviroment, delimitpos - esdenviroment + 1);
        esdenviroment = delimitpos;
        esdenviroment++;
        strncpy(*envport, *esdenviroment, strlen(esdenviroment));

        intenvport = atoi(envport);
    }


    if (!(u->client = pa_socket_client_new_string(u->core->mainloop, p = pa_modargs_get_value(ma, "server", ESD_UNIX_SOCKET_NAME), ESD_DEFAULT_PORT))) {
        pa_log("failed to connect to server. Trying to use the ESPEAKER enviroment variable.");

        if (!(u->client = pa_socket_client_new_string(u->core->mainloop, p = envserver, intenvport))) {
            pa_log("faild to connect to server.");

            goto fail;
        }
    }

Attachments

pulseaudio-esound-port.patch (1.1 kB) - added by Apatsch on 10/01/07 22:10:04.

Change History

10/01/07 22:10:04 changed by Apatsch

  • attachment pulseaudio-esound-port.patch added.

10/01/07 22:11:27 changed by Apatsch

I've attached a patch for setting the port of esd listening socket. This can be used like:

pulseaudio -L "module-esound-sink server=echo $ESPEAKER|cut -f1 -d: port=echo $ESPEAKER|cut -f2 -d:"

10/01/07 22:12:38 changed by Apatsch

The backquotes seem to have been removed, but it's easy to guess where they are ;)

10/30/07 15:08:30 changed by lennart

  • status changed from new to assigned.
  • milestone set to 0.9.7.

The version recently commited to SVN trunk handles ESPEAKER correctly.

10/30/07 15:11:13 changed by lennart

  • status changed from assigned to closed.
  • resolution set to fixed.

Commited to trunk