[alsa-devel] [PATCH v3 kernel 2/3] Extend snd_pcm_ops and snd_pcm_runtime
Tim Cussins
timcussins at eml.cc
Fri Feb 6 17:16:27 CET 2015
snd_pcm_ops picks up methods for:
- start_at
- start_at_abort
- start_at_gettime
For startat requests involving audio hardware clocks, ALSA core
delegates to the driver using these methods, should they exist.
snd_pcm_runtime gains fields that contain the current state of
the startat timer, if any. This allows cancellation and querying.
Signed-off-by: Tim Cussins <timcussins at eml.cc>
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 07299b2..a414fec 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -73,6 +73,9 @@ struct snd_pcm_ops {
snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
int (*wall_clock)(struct snd_pcm_substream *substream,
struct timespec *audio_ts);
+ int (*start_at)(struct snd_pcm_substream *substream, int startat_clock_type, const struct timespec *ts);
+ int (*start_at_abort)(struct snd_pcm_substream *substream);
+ int (*start_at_gettime)(struct snd_pcm_substream *substream, int startat_clock_type, struct timespec *current_time);
int (*copy)(struct snd_pcm_substream *substream, int channel,
snd_pcm_uframes_t pos,
void __user *buf, snd_pcm_uframes_t count);
@@ -368,6 +371,12 @@ struct snd_pcm_runtime {
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
struct snd_pcm_hwptr_log *hwptr_log;
#endif
+
+ bool startat_timer_running;
+ /* The following values are valid if startat_timer_running == true */
+ int startat_clock_type; /* startat clock type of current timer */
+ struct timespec startat_start_time; /* start time of current timer */
+ void* startat_timer_data; /* data associated with current timer */
};
struct snd_pcm_group { /* keep linked substreams */
--
1.9.1
More information about the Alsa-devel
mailing list