From patchwork Fri Feb 6 16:16:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Cussins X-Patchwork-Id: 5793051 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 92A399F336 for ; Fri, 6 Feb 2015 16:17:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC9F02015A for ; Fri, 6 Feb 2015 16:17:24 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9184320121 for ; Fri, 6 Feb 2015 16:17:23 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EE511265372; Fri, 6 Feb 2015 17:17:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 6D5F6265309; Fri, 6 Feb 2015 17:16:24 +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 C9F4B265311; Fri, 6 Feb 2015 17:16:23 +0100 (CET) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by alsa0.perex.cz (Postfix) with ESMTP id 6175A2651CE for ; Fri, 6 Feb 2015 17:16:14 +0100 (CET) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id F37E620B3B for ; Fri, 6 Feb 2015 11:16:13 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 06 Feb 2015 11:16:13 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=eml.cc; h= x-sasl-enc:from:to:cc:subject:date:message-id:in-reply-to :references; s=mesmtp; bh=uOFa9L4Tbs+qb3rFzEsjonpuWe4=; b=bmLPFe XsxQgc65F2EpcGvPqa0CuiGwWLu/gl0Djw5Ad8bkv5Mz23o/s1pAYYNd4WMdCKXy AG7kKlXJzZVpbQcS6ZApWVIG/vQgmRsq6XJt+sSdmIBe/dCh6tQcyco3x2sFuJu9 vY8fo4eRu2KfC43EZK6VLsthRfjlRHjxBi5pI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:cc:subject:date :message-id:in-reply-to:references; s=smtpout; bh=uOFa9L4Tbs+qb3 rFzEsjonpuWe4=; b=KTnG4i3EXQxmobkGK+CFiXe/6tY7C97Qs5P3WjNrXtLp0g MXw7rhCrTwhHzYGs/yIiXuNvdVgCRLXRtJpdPjRpd2IQNJe2cvFkNtZAQxOZxPNV ooaVGRCcXQH1yQFH02dT8oIP8vt0AlNsfqXwzAtdjTzrhs1KwhM8s5kz5IEeE= X-Sasl-enc: 7+jLVWHmpvF2n9UL1W4pzQbH+FccPWlrzGGRt1GcGFb9 1423239373 Received: from PC816.linn.co.uk (unknown [195.59.102.251]) by mail.messagingengine.com (Postfix) with ESMTPA id 6C6A8C0029D; Fri, 6 Feb 2015 11:16:13 -0500 (EST) From: Tim Cussins To: alsa-devel@alsa-project.org Date: Fri, 6 Feb 2015 16:16:01 +0000 Message-Id: <1423239361-17655-3-git-send-email-timcussins@eml.cc> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423239361-17655-1-git-send-email-timcussins@eml.cc> References: <1423239361-17655-1-git-send-email-timcussins@eml.cc> Cc: Tim Cussins Subject: [alsa-devel] [PATCH v3 alsa-lib 3/3] Support snd_pcm_status_dump() 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 Signed-off-by: Tim Cussins diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index f2cbd8e..656e521 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -1559,11 +1559,13 @@ int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsign #define SW_PARAM(v) [SND_PCM_SW_PARAM_##v] = #v #define FORMAT(v) [SND_PCM_FORMAT_##v] = #v #define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v +#define STARTAT_CLOCK(v) [SND_PCM_STARTAT_CLOCK_TYPE_##v] = #v #define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d #define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d + static const char *const snd_pcm_stream_names[] = { STREAM(PLAYBACK), STREAM(CAPTURE), @@ -1651,6 +1653,12 @@ static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = { FORMAT(IEC958_SUBFRAME), }; +static const char *const snd_pcm_startat_clock_names[SND_PCM_STARTAT_CLOCK_TYPE_LAST+1] = { + STARTAT_CLOCK(GETTIMEOFDAY), + STARTAT_CLOCK(MONOTONIC), + STARTAT_CLOCK(LINK), +}; + static const char *const snd_pcm_format_descriptions[] = { FORMATD(S8, "Signed 8 bit"), FORMATD(U8, "Unsigned 8 bit"), @@ -1949,6 +1957,18 @@ const char *snd_pcm_type_name(snd_pcm_type_t type) use_default_symbol_version(__snd_pcm_type_name, snd_pcm_type_name, ALSA_0.9.0); /** + * \brief get name of startat clock + * \param clock_type type of startat clock + * \return ascii name of startat clock + */ +const char *snd_pcm_startat_clock_name(snd_pcm_startat_clock_type_t clock_type) +{ + if (clock_type > SND_PCM_STARTAT_CLOCK_TYPE_LAST) + return NULL; + return snd_pcm_startat_clock_names[clock_type]; +} + +/** * \brief Dump current hardware setup for PCM * \param pcm PCM handle * \param out Output handle @@ -2035,6 +2055,13 @@ int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out) snd_output_printf(out, " delay : %ld\n", (long)status->delay); snd_output_printf(out, " avail : %ld\n", (long)status->avail); snd_output_printf(out, " avail_max : %ld\n", (long)status->avail_max); + if (status->start_at_pending == 1) { + snd_output_printf(out, " start_at : %s %ld.%06ld\n", snd_pcm_startat_clock_name(status->start_at_clock_type), + status->start_at_start_time.tv_sec, status->start_at_start_time.tv_nsec); + } + else { + snd_output_printf(out, " start_at : disabled\n"); + } return 0; }