From patchwork Wed Oct 3 23:45:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guedes, Andre" X-Patchwork-Id: 10625399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41D0715A6 for ; Wed, 3 Oct 2018 23:47:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9762906E for ; Wed, 3 Oct 2018 23:47:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 235182907B; Wed, 3 Oct 2018 23:47:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3240F2906E for ; Wed, 3 Oct 2018 23:47:24 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 411DC2678F7; Thu, 4 Oct 2018 01:47:03 +0200 (CEST) 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 E611B2678AB; Thu, 4 Oct 2018 01:46:55 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 9D25826783D for ; Thu, 4 Oct 2018 01:46:51 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2018 16:46:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,338,1534834800"; d="scan'208";a="269308270" Received: from aguedesl-mobl1.jf.intel.com ([10.24.14.71]) by fmsmga006.fm.intel.com with ESMTP; 03 Oct 2018 16:46:42 -0700 From: Andre Guedes To: alsa-devel@alsa-project.org Date: Wed, 3 Oct 2018 16:45:41 -0700 Message-Id: <20181003234547.16839-2-andre.guedes@intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181003234547.16839-1-andre.guedes@intel.com> References: <20181003234547.16839-1-andre.guedes@intel.com> Cc: tiwai@suse.de, liam.r.girdwood@intel.com Subject: [alsa-devel] [PATCH - AAF PCM plugin 1/7] aaf: Introduce plugin skeleton 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The patch introduces the skeleton code from the AAF plugin as well as the buildsystem bits in order to get the plugin built. Following the approach from other plugins, the AAF plugin is only built if its dependency (libavtp) is detected by configure. Follow-up patches implement support for both playback and capture modes. Signed-off-by: Andre Guedes --- Makefile.am | 3 ++ aaf/Makefile.am | 9 ++++++ aaf/pcm_aaf.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 9 ++++++ doc/aaf.txt | 18 ++++++++++++ 5 files changed, 130 insertions(+) create mode 100644 aaf/Makefile.am create mode 100644 aaf/pcm_aaf.c create mode 100644 doc/aaf.txt diff --git a/Makefile.am b/Makefile.am index 27f61a4..af0e9c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,6 +35,9 @@ endif if HAVE_SPEEXDSP SUBDIRS += speex endif +if HAVE_AAF +SUBDIRS += aaf +endif EXTRA_DIST = gitcompile version COPYING.GPL m4/attributes.m4 AUTOMAKE_OPTIONS = foreign diff --git a/aaf/Makefile.am b/aaf/Makefile.am new file mode 100644 index 0000000..492b883 --- /dev/null +++ b/aaf/Makefile.am @@ -0,0 +1,9 @@ +asound_module_pcm_aaf_LTLIBRARIES = libasound_module_pcm_aaf.la + +asound_module_pcm_aafdir = @ALSA_PLUGIN_DIR@ + +AM_CFLAGS = @ALSA_CFLAGS@ @AVTP_CFLAGS@ +AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED) + +libasound_module_pcm_aaf_la_SOURCES = pcm_aaf.c +libasound_module_pcm_aaf_la_LIBADD = @ALSA_LIBS@ @AVTP_LIBS@ diff --git a/aaf/pcm_aaf.c b/aaf/pcm_aaf.c new file mode 100644 index 0000000..7890e10 --- /dev/null +++ b/aaf/pcm_aaf.c @@ -0,0 +1,91 @@ +/* + * AVTP Audio Format (AAF) PCM Plugin + * + * Copyright (c) 2018, Intel Corporation + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +typedef struct { + snd_pcm_ioplug_t io; +} snd_pcm_aaf_t; + +static int aaf_close(snd_pcm_ioplug_t *io) +{ + snd_pcm_aaf_t *aaf = io->private_data; + + if (!aaf) + return -EBADFD; + + free(aaf); + aaf = NULL; + return 0; +} + +static snd_pcm_sframes_t aaf_pointer(snd_pcm_ioplug_t *io) +{ + return 0; +} + +static int aaf_start(snd_pcm_ioplug_t *io) +{ + return 0; +} + +static int aaf_stop(snd_pcm_ioplug_t *io) +{ + return 0; +} + +static const snd_pcm_ioplug_callback_t aaf_callback = { + .close = aaf_close, + .pointer = aaf_pointer, + .start = aaf_start, + .stop = aaf_stop, +}; + +SND_PCM_PLUGIN_DEFINE_FUNC(aaf) +{ + snd_pcm_aaf_t *aaf; + int res; + + aaf = calloc(1, sizeof(*aaf)); + if (!aaf) { + SNDERR("Failed to allocate memory"); + return -ENOMEM; + } + + aaf->io.version = SND_PCM_IOPLUG_VERSION; + aaf->io.name = "AVTP Audio Format (AAF) Plugin"; + aaf->io.callback = &aaf_callback; + aaf->io.private_data = aaf; + res = snd_pcm_ioplug_create(&aaf->io, name, stream, mode); + if (res < 0) { + SNDERR("Failed to create ioplug instance"); + goto err; + } + + *pcmp = aaf->io.pcm; + return 0; + +err: + free(aaf); + return res; +} + +SND_PCM_PLUGIN_SYMBOL(aaf); diff --git a/configure.ac b/configure.ac index cc3740b..6d0e14b 100644 --- a/configure.ac +++ b/configure.ac @@ -176,6 +176,14 @@ fi test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix=$prefix +AC_ARG_ENABLE([aaf], + AS_HELP_STRING([--disable-aaf], [Disable building of AAF plugin])) + +if test "x$enable_aaf" != "xno"; then + PKG_CHECK_MODULES(AVTP, avtp >= 0.1, [HAVE_AAF=yes], [HAVE_AAF=no]) +fi +AM_CONDITIONAL(HAVE_AAF, test x$HAVE_AAF = xyes) + dnl ALSA plugin directory AC_ARG_WITH(plugindir, AS_HELP_STRING([--with-plugindir=dir], @@ -251,6 +259,7 @@ AC_OUTPUT([ usb_stream/Makefile speex/Makefile arcam-av/Makefile + aaf/Makefile ]) dnl Show the build conditions diff --git a/doc/aaf.txt b/doc/aaf.txt new file mode 100644 index 0000000..b260a26 --- /dev/null +++ b/doc/aaf.txt @@ -0,0 +1,18 @@ +AVTP Audio Format (AAF) Plugin +============================== + +Overview +-------- + +The AAF plugin is a PCM plugin that uses Audio Video Transport Protocol (AVTP) +to transmit/receive audio samples through a Time-Sensitive Network (TSN) +capable network. The plugin enables media applications to easily implement AVTP +Talker and Listener functionalities. + +Plugin Dependencies +------------------- + +The AAF plugin uses libavtp to handle AVTP packetization. Libavtp source code +can be found in https://github.com/AVnu/libavtp as well as instructions to +build and install it. If libavtp isn't detected by configure, the plugin isn't +built.