[alsa-devel] [PATCH 01/11] sound: core: Add debug-print helper function

Ola Lilja ola.o.lilja at stericsson.com
Tue May 8 15:56:25 CEST 2012


Adds a function getting the stream-name as a string for
a specific stream.

Signed-off-by: Ola Lilja <ola.o.lilja at stericsson.com>
---
 include/sound/pcm.h |    2 ++
 sound/core/pcm.c    |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 0d11128..8a153e6 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1073,4 +1073,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
 
 const char *snd_pcm_format_name(snd_pcm_format_t format);
 
+const char *snd_pcm_stream_str(struct snd_pcm_substream *substream);
+
 #endif /* __SOUND_PCM_H */
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 1a3070b..9e83f00 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -1187,6 +1187,16 @@ static void snd_pcm_proc_done(void)
 #define snd_pcm_proc_done()
 #endif /* CONFIG_PROC_FS */
 
+/**
+ * Get a string naming the direction of a stream
+ */
+const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
+{
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		return "Playback";
+	else
+		return "Capture";
+}
 
 /*
  *  ENTRY functions
-- 
1.7.8.3



More information about the Alsa-devel mailing list