From patchwork Fri Feb 28 16:24:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Corfu, ValentinX" X-Patchwork-Id: 3742621 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 07EF69F2ED for ; Fri, 28 Feb 2014 16:26:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1BA4520266 for ; Fri, 28 Feb 2014 16:26:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5139A200E6 for ; Fri, 28 Feb 2014 16:26:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3AF0D265543; Fri, 28 Feb 2014 17:26:22 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id AFD142652B7; Fri, 28 Feb 2014 17:26:11 +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 C3B912652B7; Fri, 28 Feb 2014 17:26:10 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 2906A265218; Fri, 28 Feb 2014 17:26:02 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 28 Feb 2014 08:21:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,562,1389772800"; d="scan'208,223";a="491675108" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga002.jf.intel.com with ESMTP; 28 Feb 2014 08:24:50 -0800 Received: from irsmsx105.ger.corp.intel.com (163.33.3.28) by IRSMSX104.ger.corp.intel.com (163.33.3.159) with Microsoft SMTP Server (TLS) id 14.3.123.3; Fri, 28 Feb 2014 16:24:49 +0000 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.244]) by IRSMSX105.ger.corp.intel.com ([169.254.7.146]) with mapi id 14.03.0123.003; Fri, 28 Feb 2014 16:24:49 +0000 From: "Corfu, ValentinX" To: "patch@alsa-project.org" Thread-Topic: [alsa-plugins] [PATCH 1/1] Allow number of channels Thread-Index: Ac80oZBViVXYZJtsTLW9tcXuXE2nyA== Date: Fri, 28 Feb 2014 16:24:47 +0000 Message-ID: <9900E8BE2ADAAB43B2A4471493EDB7F94B3F8B@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.255.86.157] MIME-Version: 1.0 Cc: "alsa-devel@alsa-project.org" , "Trandafir, IonutX" Subject: [alsa-devel] [alsa-plugins] [PATCH 1/1] Allow number of channels 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 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 f80d5665fdc1c5c42f2616eacbe548c1d0e7aba6 Mon Sep 17 00:00:00 2001 From: Valentin Corfu Date: Fri, 28 Feb 2014 10:29:01 -0500 Subject: [PATCH] Allow number of channels The modification allows to specify the number of channels as parameters in the configuration file. The given number of channels are then created but not connected Signed-off-by: Valentin Corfu diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c index 4213708..059c60d 100644 --- a/jack/pcm_jack.c +++ b/jack/pcm_jack.c @@ -325,7 +325,7 @@ static int make_nonblock(int fd) static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, snd_config_t *playback_conf, snd_config_t *capture_conf, - snd_pcm_stream_t stream, int mode) + snd_pcm_stream_t stream, int mode, unsigned int num_channels) { snd_pcm_jack_t *jack; int err; @@ -341,11 +341,21 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, jack->fd = -1; jack->io.poll_fd = -1; - err = parse_ports(jack, stream == SND_PCM_STREAM_PLAYBACK ? - playback_conf : capture_conf); - if (err) { - snd_pcm_jack_free(jack); - return err; + if (num_channels > 0) { + jack->num_ports = num_channels; + jack->port_names = calloc(num_channels, sizeof(char*)); + if (jack->port_names == NULL) { + snd_pcm_jack_free(jack); + return -ENOMEM; + } + } + else { + err = parse_ports(jack, stream == SND_PCM_STREAM_PLAYBACK ? + playback_conf : capture_conf); + if (err) { + snd_pcm_jack_free(jack); + return err; + } } jack->channels = jack->num_ports; @@ -422,6 +432,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(jack) snd_config_t *playback_conf = NULL; snd_config_t *capture_conf = NULL; int err; + unsigned int num_channels = 0; snd_config_for_each(i, next, conf) { snd_config_t *n = snd_config_iterator_entry(i); @@ -434,6 +445,10 @@ SND_PCM_PLUGIN_DEFINE_FUNC(jack) snd_config_get_string(n, &name); continue; } + if (strcmp(id, "channels") == 0) { + snd_config_get_integer(n, &num_channels); + continue; + } if (strcmp(id, "playback_ports") == 0) { if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) { SNDERR("Invalid type for %s", id); @@ -454,7 +469,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(jack) return -EINVAL; } - err = snd_pcm_jack_open(pcmp, name, playback_conf, capture_conf, stream, mode); + err = snd_pcm_jack_open(pcmp, name, playback_conf, capture_conf, stream, mode, num_channels); return err; } -- 1.8.1.4