mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-12 04:27:45 -05:00
pcm: support for audio timestamps
add new snd_pcm_status_get_audio_htstamp() routine to query the audio timestamps provided by the kernel. This change provides applications with better ways to track elapsed time. Before this patch, applications would subtract queued samples (delay) from written samples, resulting in a 1-2 sample error. Also add snd_pcm_hw_params_supports_audio_wallclock_ts() to query what the hardware supports. TODO: check protocol compatibility? Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
4bdb09126a
commit
cf40ea169a
4 changed files with 96 additions and 12 deletions
|
|
@ -160,7 +160,7 @@ enum {
|
|||
* *
|
||||
*****************************************************************************/
|
||||
|
||||
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10)
|
||||
#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 11)
|
||||
|
||||
typedef unsigned long sndrv_pcm_uframes_t;
|
||||
typedef long sndrv_pcm_sframes_t;
|
||||
|
|
@ -285,6 +285,7 @@ enum sndrv_pcm_subformat {
|
|||
#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
|
||||
#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
|
||||
#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */
|
||||
#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000 /* has audio wall clock for audio/system time sync */
|
||||
|
||||
enum sndrv_pcm_state {
|
||||
SNDRV_PCM_STATE_OPEN = 0, /* stream is open */
|
||||
|
|
@ -426,7 +427,8 @@ struct sndrv_pcm_status {
|
|||
sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */
|
||||
sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
|
||||
int suspended_state; /* suspended stream state */
|
||||
unsigned char reserved[60]; /* must be filled with zero */
|
||||
struct timespec audio_tstamp; /* from sample counter or wall clock */
|
||||
unsigned char reserved[60-sizeof(struct timespec)]; /* must be filled with zero */
|
||||
};
|
||||
|
||||
struct sndrv_pcm_mmap_status {
|
||||
|
|
@ -435,6 +437,7 @@ struct sndrv_pcm_mmap_status {
|
|||
sndrv_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */
|
||||
struct timespec tstamp; /* Timestamp */
|
||||
int suspended_state; /* RO: suspended stream state */
|
||||
struct timespec audio_tstamp; /* from sample counter or wall clock */
|
||||
};
|
||||
|
||||
struct sndrv_pcm_mmap_control {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue