read stream and client name from $PADSP_STREAM_NAME resp. $PADSP_CLIENT_NAME, if...
authorLennart Poettering <lennart@poettering.net>
Thu, 25 May 2006 01:19:56 +0000 (01:19 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 25 May 2006 01:19:56 +0000 (01:19 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@965 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/utils/padsp.c

index 2f0f726..5987ec5 100644 (file)
@@ -201,7 +201,7 @@ static int padsp_disabled(void) {
      * The symbol must be an int containing a three bit bitmask: bit 1
      * -> disable /dev/dsp emulation, bit 2 -> disable /dev/sndstat
      * emulation, bit 3 -> disable /dev/mixer emulation. Hence a value
-     * 7 disables padsp entirely. */
+     * of 7 disables padsp entirely. */
     
     pthread_mutex_lock(&func_mutex);
     if (!sym_resolved) {
@@ -363,15 +363,28 @@ static void reset_params(fd_info *i) {
 
 static char *client_name(char *buf, size_t n) {
     char p[PATH_MAX];
+    const char *e;
+
+    if ((e = getenv("PADSP_CLIENT_NAME")))
+        return e;
     
     if (pa_get_binary_name(p, sizeof(p)))
-        snprintf(buf, n, "oss[%s]", pa_path_get_filename(p));
+        snprintf(buf, n, "OSS Emulation[%s]", pa_path_get_filename(p));
     else
-        snprintf(buf, n, "oss");
+        snprintf(buf, n, "OSS");
 
     return buf;
 }
 
+static char *stream_name(void) {
+    const char *e;
+
+    if ((e = getenv("PADSP_STREAM_NAME")))
+        return e;
+
+    return "Audio Stream";
+}
+
 static void atfork_prepare(void) {
     fd_info *i;
 
@@ -740,7 +753,7 @@ static int create_stream(fd_info *i) {
 
     fix_metrics(i);
 
-    if (!(i->stream = pa_stream_new(i->context, "Audio Stream", &i->sample_spec, NULL))) {
+    if (!(i->stream = pa_stream_new(i->context, stream_name(), &i->sample_spec, NULL))) {
         debug(__FILE__": pa_stream_new() failed: %s\n", pa_strerror(pa_context_errno(i->context)));
         goto fail;
     }