From patchwork Wed Feb 26 14:03:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Corfu, ValentinX" X-Patchwork-Id: 3724241 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3D235BF13A for ; Wed, 26 Feb 2014 14:06:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61C292017B for ; Wed, 26 Feb 2014 14:05:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DC48920166 for ; Wed, 26 Feb 2014 14:05:57 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 005CC265746; Wed, 26 Feb 2014 15:05:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id F129A26575C; Wed, 26 Feb 2014 15:05:38 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C03DE26575C; Wed, 26 Feb 2014 15:05:37 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 60965265716; Wed, 26 Feb 2014 15:05:25 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 26 Feb 2014 06:00:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,548,1389772800"; d="scan'208,223";a="490114237" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga002.jf.intel.com with ESMTP; 26 Feb 2014 06:05:10 -0800 Received: from irsmsx106.ger.corp.intel.com (163.33.3.31) by IRSMSX104.ger.corp.intel.com (163.33.3.159) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 26 Feb 2014 14:04:06 +0000 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.244]) by IRSMSX106.ger.corp.intel.com ([169.254.8.96]) with mapi id 14.03.0123.003; Wed, 26 Feb 2014 14:03:57 +0000 From: "Corfu, ValentinX" To: "patch@alsa-project.org" Thread-Topic: [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters Thread-Index: Ac8y+dSSlTip8FNjSPiLd1gRp0DUwQ== Date: Wed, 26 Feb 2014 14:03:56 +0000 Message-ID: <9900E8BE2ADAAB43B2A4471493EDB7F94B3EFB@IRSMSX104.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [10.254.22.52] MIME-Version: 1.0 Cc: "alsa-devel@alsa-project.org" , "Trandafir, IonutX" Subject: [alsa-devel] [alsa-plugins] [PATCH 1/2] Allow to specify a client name as parameters X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 From eba0b4ebeb34250f49f34776b288432fb782e092 Mon Sep 17 00:00:00 2001 From: Valentin Corfu 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 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