All of lore.kernel.org
 help / color / mirror / Atom feed
* [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters
@ 2014-02-26 14:03 Corfu, ValentinX
  2014-02-26 15:23 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Corfu, ValentinX @ 2014-02-26 14:03 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Trandafir, IonutX

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

Hi Takashi,

I reworked the patches and hope to be the final ones.  J
You will find attached at each of the emails.

Kind Regards,
Valentin Corfu
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-to-specify-a-client-name-as-parameters.patch --]
[-- Type: text/x-patch; name="0001-Allow-to-specify-a-client-name-as-parameters.patch", Size: 2929 bytes --]

From eba0b4ebeb34250f49f34776b288432fb782e092 Mon Sep 17 00:00:00 2001
From: Valentin Corfu <valentinx.corfu@intel.com>
Date: Tue, 11 Feb 2014 04:06:36 -0500
Subject: [PATCH 1/2] Allow to specify a client name as parameters

 The current jack client name contains the process id of the application
providing the audio samples. This leads to unpredictable jack client
names which makes handling of the connections by a controlling
application very hard.
 This modification now, allows to specify a client name as parameters
in the configuration file. The implementation is backward
compatible and simply adds a new configuration option to the plugin.

Signed-off-by: Valentin Corfu <valentinx.corfu@intel.com>

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index c51fe84..983878f 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -355,12 +355,19 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
 		snd_pcm_jack_free(jack);
 		return -EINVAL;
 	}
-
-	if (snprintf(jack_client_name, sizeof(jack_client_name), "alsa-jack.%s%s.%d.%d", name,
-		     stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", getpid(), num++)
-	    >= (int)sizeof(jack_client_name)) {
-		fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
-			__func__, jack_client_name, (int)strlen(jack_client_name));
+    if ( name == NULL ) {
+        if (snprintf(jack_client_name, sizeof(jack_client_name), "alsa-jack.%s%s.%d.%d", name,
+                stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", getpid(), num++)
+            >= (int)sizeof(jack_client_name)) {
+                fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
+                __func__, jack_client_name, (int)strlen(jack_client_name));
+        }
+    } else {
+        if (snprintf(jack_client_name, sizeof(jack_client_name), "%s", name)
+            >= (int)sizeof(jack_client_name)) {
+                fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
+                __func__, jack_client_name, (int)strlen(jack_client_name));
+        }
 	}
 
 	jack->client = jack_client_new(jack_client_name);
@@ -369,7 +376,7 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
 		snd_pcm_jack_free(jack);
 		return -ENOENT;
 	}
-	
+
 	jack->areas = calloc(jack->channels, sizeof(snd_pcm_channel_area_t));
 	if (! jack->areas) {
 		snd_pcm_jack_free(jack);
@@ -423,6 +430,10 @@ SND_PCM_PLUGIN_DEFINE_FUNC(jack)
 			continue;
 		if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strcmp(id, "hint") == 0)
 			continue;
+        if (strcmp(id, "name") == 0) {
+            snd_config_get_string(n, &name);
+            continue;
+        }
 		if (strcmp(id, "playback_ports") == 0) {
 			if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
 				SNDERR("Invalid type for %s", id);
-- 
1.8.1.4


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters
  2014-02-26 14:03 [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters Corfu, ValentinX
@ 2014-02-26 15:23 ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2014-02-26 15:23 UTC (permalink / raw)
  To: Corfu, ValentinX; +Cc: alsa-devel, Trandafir, IonutX

At Wed, 26 Feb 2014 14:03:56 +0000,
Corfu, ValentinX wrote:
> 
> Hi Takashi,
> 
> I reworked the patches and hope to be the final ones.  J
> You will find attached at each of the emails.

OK, I applied the first patch with cleanup and reformatting, and
pushed out to git tree.

But the second patch is certainly buggy, so please resubmit after
fixing the following:

- You can't assign a compound to an integer
	num_channels = n;
  Code it correctly.

- Use "channels" instead of "nchan"

- Align the tab level.  We use 8 chars hard tabs.

- Rebase your patch with the latest alsa-plugins git tree.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters
  2014-01-31 14:05 Corfu, ValentinX
@ 2014-02-06 10:27 ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2014-02-06 10:27 UTC (permalink / raw)
  To: Corfu, ValentinX; +Cc: alsa-devel, Trandafir, IonutX

At Fri, 31 Jan 2014 14:05:42 +0000,
Corfu, ValentinX wrote:
> 
> >From 1ac8268330df7564edf252a542a27f3cf4f4472f Mon Sep 17 00:00:00 2001
> From: Valentin Corfu <valentinx.corfu@intel.com>
> Date: Fri, 31 Jan 2014 08:06:23 -0500
> Subject: [PATCH 1/2] Allow to specify a client name as parameters
> 
> The current jack client name contains the process id of the application providing the audio samples.
> This leads to unpredictable jack client names which makes handling of the connections by a controlling application very hard.
> This modification now, allows to specify a client name as parameters in the configuration file.
> The implementation is backward compatible and simply adds a new configuration option to the plugin.

Thanks, now it's much simpler than previous versions.
But the patch you embedded in the mail couldn't be applied because
your mailer converted the spaces wrongly.  Please fix your mailer, or
use an attachment if it's difficult.

Also, it'd be better to break lines in some fixed width (less than 80
chars) in changelog.


thanks,

Takashi

> 
> Signed-off-by: Valentin Corfu <valentinx.corfu@intel.com>
> 
> diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
> index c51fe84..475c619 100644
> --- a/jack/pcm_jack.c
> +++ b/jack/pcm_jack.c
> @@ -355,12 +355,19 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
>          snd_pcm_jack_free(jack);
>          return -EINVAL;
>      }
> -
> -    if (snprintf(jack_client_name, sizeof(jack_client_name), "alsa-jack.%s%s.%d.%d", name,
> -             stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", getpid(), num++)
> -        >= (int)sizeof(jack_client_name)) {
> -        fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
> -            __func__, jack_client_name, (int)strlen(jack_client_name));
> +    if ( name == NULL ) {
> +        if (snprintf(jack_client_name, sizeof(jack_client_name), "alsa-jack.%s%s.%d.%d", name,
> +                stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", getpid(), num++)
> +            >= (int)sizeof(jack_client_name)) {
> +                fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
> +                __func__, jack_client_name, (int)strlen(jack_client_name));
> +        }
> +    } else {
> +        if (snprintf(jack_client_name, sizeof(jack_client_name), "%s", name)
> +            >= (int)sizeof(jack_client_name)) {
> +                fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
> +                __func__, jack_client_name, (int)strlen(jack_client_name));
> +        }
>      }
> 
>      jack->client = jack_client_new(jack_client_name);
> @@ -423,6 +430,10 @@ SND_PCM_PLUGIN_DEFINE_FUNC(jack)
>              continue;
>          if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strcmp(id, "hint") == 0)
>              continue;
> +        if (strcmp(id, "name") == 0) {
> +            snd_config_get_string(n, &name);
> +            continue;
> +        }
>          if (strcmp(id, "playback_ports") == 0) {
>              if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
>                  SNDERR("Invalid type for %s", id);
> --
> 1.8.1.4
> 
> --------------------------------------------------------------
> Intel Shannon Limited
> Registered in Ireland
> Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
> Registered Number: 308263
> Business address: Dromore House, East Park, Shannon, Co. Clare
> 
> This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters
@ 2014-01-31 14:05 Corfu, ValentinX
  2014-02-06 10:27 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Corfu, ValentinX @ 2014-01-31 14:05 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Trandafir, IonutX

>From 1ac8268330df7564edf252a542a27f3cf4f4472f Mon Sep 17 00:00:00 2001
From: Valentin Corfu <valentinx.corfu@intel.com>
Date: Fri, 31 Jan 2014 08:06:23 -0500
Subject: [PATCH 1/2] Allow to specify a client name as parameters

The current jack client name contains the process id of the application providing the audio samples.
This leads to unpredictable jack client names which makes handling of the connections by a controlling application very hard.
This modification now, allows to specify a client name as parameters in the configuration file.
The implementation is backward compatible and simply adds a new configuration option to the plugin.

Signed-off-by: Valentin Corfu <valentinx.corfu@intel.com>

diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index c51fe84..475c619 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -355,12 +355,19 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
         snd_pcm_jack_free(jack);
         return -EINVAL;
     }
-
-    if (snprintf(jack_client_name, sizeof(jack_client_name), "alsa-jack.%s%s.%d.%d", name,
-             stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", getpid(), num++)
-        >= (int)sizeof(jack_client_name)) {
-        fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
-            __func__, jack_client_name, (int)strlen(jack_client_name));
+    if ( name == NULL ) {
+        if (snprintf(jack_client_name, sizeof(jack_client_name), "alsa-jack.%s%s.%d.%d", name,
+                stream == SND_PCM_STREAM_PLAYBACK ? "P" : "C", getpid(), num++)
+            >= (int)sizeof(jack_client_name)) {
+                fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
+                __func__, jack_client_name, (int)strlen(jack_client_name));
+        }
+    } else {
+        if (snprintf(jack_client_name, sizeof(jack_client_name), "%s", name)
+            >= (int)sizeof(jack_client_name)) {
+                fprintf(stderr, "%s: WARNING: JACK client name '%s' truncated to %d characters, might not be unique\n",
+                __func__, jack_client_name, (int)strlen(jack_client_name));
+        }
     }

     jack->client = jack_client_new(jack_client_name);
@@ -423,6 +430,10 @@ SND_PCM_PLUGIN_DEFINE_FUNC(jack)
             continue;
         if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strcmp(id, "hint") == 0)
             continue;
+        if (strcmp(id, "name") == 0) {
+            snd_config_get_string(n, &name);
+            continue;
+        }
         if (strcmp(id, "playback_ports") == 0) {
             if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
                 SNDERR("Invalid type for %s", id);
--
1.8.1.4

--------------------------------------------------------------
Intel Shannon Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263
Business address: Dromore House, East Park, Shannon, Co. Clare

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-26 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26 14:03 [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters Corfu, ValentinX
2014-02-26 15:23 ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2014-01-31 14:05 Corfu, ValentinX
2014-02-06 10:27 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.