aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-26 09:37:30 +0200
committerMax Kellermann <max@duempel.org>2014-08-26 09:37:30 +0200
commit9d79c72c179208137c6dcdba07a1bfcc8ffa3799 (patch)
tree6ae58684dbb75c29b095363f9e2ed23aa661a90e /src
parenta86aaef4d0075df581857cdabb624a24885afa2b (diff)
downloadmpd-9d79c72c179208137c6dcdba07a1bfcc8ffa3799.tar.gz
mpd-9d79c72c179208137c6dcdba07a1bfcc8ffa3799.tar.xz
mpd-9d79c72c179208137c6dcdba07a1bfcc8ffa3799.zip
output/alsa: add API documentation
Diffstat (limited to 'src')
-rw-r--r--src/output/plugins/AlsaOutputPlugin.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx
index 9f299642e..04e2bced3 100644
--- a/src/output/plugins/AlsaOutputPlugin.cxx
+++ b/src/output/plugins/AlsaOutputPlugin.cxx
@@ -237,6 +237,11 @@ alsa_test_default_device(void)
return true;
}
+/**
+ * Convert MPD's #SampleFormat enum to libasound's snd_pcm_format_t
+ * enum. Returns SND_PCM_FORMAT_UNKNOWN if there is no according ALSA
+ * PCM format.
+ */
static snd_pcm_format_t
get_bitformat(SampleFormat sample_format)
{
@@ -271,6 +276,10 @@ get_bitformat(SampleFormat sample_format)
gcc_unreachable();
}
+/**
+ * Determine the byte-swapped PCM format. Returns
+ * SND_PCM_FORMAT_UNKNOWN if the format cannot be byte-swapped.
+ */
static snd_pcm_format_t
byteswap_bitformat(snd_pcm_format_t fmt)
{
@@ -292,6 +301,10 @@ byteswap_bitformat(snd_pcm_format_t fmt)
}
}
+/**
+ * Check if there is a "packed" version of the give PCM format.
+ * Returns SND_PCM_FORMAT_UNKNOWN if not.
+ */
static snd_pcm_format_t
alsa_to_packed_format(snd_pcm_format_t fmt)
{
@@ -307,6 +320,10 @@ alsa_to_packed_format(snd_pcm_format_t fmt)
}
}
+/**
+ * Attempts to configure the specified sample format. On failure,
+ * fall back to the packed version.
+ */
static int
alsa_try_format_or_packed(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams,
snd_pcm_format_t fmt, bool *packed_r)