* [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants
@ 2020-12-22 14:57 David Henningsson
2020-12-22 14:57 ` [PATCH 1/2] pcm: Add " David Henningsson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Henningsson @ 2020-12-22 14:57 UTC (permalink / raw)
To: alsa-devel, tiwai; +Cc: David Henningsson
Hi,
Sorry if this message reaches you twice. Apparently I tried to send
this earlier from an address which I no longer has access to. :-(
So if you sent a reply I could never read it.
Hopefully it'll work better this time around.
Anyhow, testing of these patches are limited to running "gitcompile",
which does not seem to compile the tests, is there an easy command to
compile them as well?
David Henningsson (2):
pcm: Add snd_pcm_audio_tstamp_type_t constants
test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants
include/pcm.h | 14 ++++++++++++++
test/audio_time.c | 26 +++++++++++++-------------
2 files changed, 27 insertions(+), 13 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] pcm: Add snd_pcm_audio_tstamp_type_t constants
2020-12-22 14:57 [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants David Henningsson
@ 2020-12-22 14:57 ` David Henningsson
2020-12-22 14:57 ` [PATCH 2/2] test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants David Henningsson
2020-12-22 15:11 ` [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants Takashi Iwai
2 siblings, 0 replies; 4+ messages in thread
From: David Henningsson @ 2020-12-22 14:57 UTC (permalink / raw)
To: alsa-devel, tiwai; +Cc: David Henningsson, Alex Moon
These are mostly a copy-paste from the kernel headers. But since functions
snd_pcm_audio_tstamp_config make use of these they should be added to the
public API as well.
Reported-by: Alex Moon <alex.r.moon@gmail.com>
Signed-off-by: David Henningsson <coding@diwic.se>
---
include/pcm.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/pcm.h b/include/pcm.h
index 5b078231..cf1eea8b 100644
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -350,6 +350,20 @@ typedef enum _snd_pcm_tstamp_type {
SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
} snd_pcm_tstamp_type_t;
+typedef enum _snd_pcm_audio_tstamp_type {
+ /**
+ * first definition for backwards compatibility only,
+ * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
+ */
+ SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
+ SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /**< DMA time, reported as per hw_ptr */
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /**< link time reported by sample or wallclock counter, reset on startup */
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /**< link time reported by sample or wallclock counter, not reset on startup */
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /**< link time estimated indirectly */
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /**< link time synchronized with system time */
+ SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
+} snd_pcm_audio_tstamp_type_t;
+
typedef struct _snd_pcm_audio_tstamp_config {
/* 5 of max 16 bits used */
unsigned int type_requested:4;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants
2020-12-22 14:57 [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants David Henningsson
2020-12-22 14:57 ` [PATCH 1/2] pcm: Add " David Henningsson
@ 2020-12-22 14:57 ` David Henningsson
2020-12-22 15:11 ` [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants Takashi Iwai
2 siblings, 0 replies; 4+ messages in thread
From: David Henningsson @ 2020-12-22 14:57 UTC (permalink / raw)
To: alsa-devel, tiwai; +Cc: David Henningsson
Also fixup the usage row which seemed wrong to me.
Signed-off-by: David Henningsson <coding@diwic.se>
---
test/audio_time.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/test/audio_time.c b/test/audio_time.c
index 530922d9..e4d4a944 100644
--- a/test/audio_time.c
+++ b/test/audio_time.c
@@ -32,7 +32,7 @@ static void usage(char *command)
"-d, --delay add delay \n"
"-D, --device=NAME select PCM by name \n"
"-p, --playback playback tstamps \n"
- "-t, --ts_type=TYPE Default(0),link(1),link_estimated(2),synchronized(3) \n"
+ "-t, --ts_type=TYPE Compat(0),default(1),link(2),link_absolute(3),link_estimated(4),link_synchronized(5) \n"
"-r, --report show audio timestamp and accuracy validity\n"
, command);
}
@@ -201,17 +201,17 @@ int main(int argc, char *argv[])
goto _exit;
}
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 0))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT))
printf("Playback supports audio compat timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 1))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT))
printf("Playback supports audio default timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 2))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK))
printf("Playback supports audio link timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 3))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE))
printf("Playback supports audio link absolute timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 4))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED))
printf("Playback supports audio link estimated timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 5))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED))
printf("Playback supports audio link synchronized timestamps\n");
snd_pcm_sw_params_alloca(&swparams_p);
@@ -269,17 +269,17 @@ int main(int argc, char *argv[])
goto _exit;
}
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 0))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT))
printf("Capture supports audio compat timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 1))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT))
printf("Capture supports audio default timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 2))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK))
printf("Capture supports audio link timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 3))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE))
printf("Capture supports audio link absolute timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 4))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED))
printf("Capture supports audio link estimated timestamps\n");
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 5))
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED))
printf("Capture supports audio link synchronized timestamps\n");
snd_pcm_sw_params_alloca(&swparams_c);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants
2020-12-22 14:57 [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants David Henningsson
2020-12-22 14:57 ` [PATCH 1/2] pcm: Add " David Henningsson
2020-12-22 14:57 ` [PATCH 2/2] test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants David Henningsson
@ 2020-12-22 15:11 ` Takashi Iwai
2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2020-12-22 15:11 UTC (permalink / raw)
To: David Henningsson; +Cc: alsa-devel
On Tue, 22 Dec 2020 15:57:26 +0100,
David Henningsson wrote:
>
> Hi,
>
> Sorry if this message reaches you twice. Apparently I tried to send
> this earlier from an address which I no longer has access to. :-(
> So if you sent a reply I could never read it.
>
> Hopefully it'll work better this time around.
I've already applied your patches and pushed out.
> Anyhow, testing of these patches are limited to running "gitcompile",
> which does not seem to compile the tests, is there an easy command to
> compile them as well?
The easy way to build test programs is to run "make check" after the
normal "make".
... and this exposed indeed a typo in your patch. It was wrongly
suffixed with SNDRV_ instead of SND_. I'll fix it up.
thanks,
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-22 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-22 14:57 [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants David Henningsson
2020-12-22 14:57 ` [PATCH 1/2] pcm: Add " David Henningsson
2020-12-22 14:57 ` [PATCH 2/2] test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants David Henningsson
2020-12-22 15:11 ` [PATCH 0/2] Publish snd_pcm_audio_tstamp_type_t constants Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox