diff options
author | Paul Kocialkowski <paul.kocialkowski@linux.intel.com> | 2017-08-21 18:27:19 +0300 |
---|---|---|
committer | Lyude <lyude@redhat.com> | 2017-08-21 13:53:38 -0400 |
commit | 1579692d6447d126552b5fb020a63b26427c9a12 (patch) | |
tree | 4604cccc0b2b6edbf880b49ef4169875c8a9c14f /lib/igt_alsa.h | |
parent | 39cc9bf89c293c92d55aad803c08816ad922585d (diff) |
lib: Add ALSA library with dedicated helpers
This introduces an ALSA library, with dedicated helpers for handling
playback and capture. It handles ALSA device identification and
configuration as well as a run loop with callback mechanisms for feeding
output data and handling input data.
This library paves the way for testing audio going through display
connectors, such as HDMI.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Diffstat (limited to 'lib/igt_alsa.h')
-rw-r--r-- | lib/igt_alsa.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/igt_alsa.h b/lib/igt_alsa.h new file mode 100644 index 00000000..f3949d26 --- /dev/null +++ b/lib/igt_alsa.h @@ -0,0 +1,60 @@ +/* + * Copyright © 2017 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Paul Kocialkowski <paul.kocialkowski@linux.intel.com> + */ + +#ifndef IGT_ALSA_H +#define IGT_ALSA_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "igt.h" +#include <stdbool.h> + +struct alsa; + +struct alsa *alsa_init(void); +int alsa_open_output(struct alsa *alsa, const char *device_name); +int alsa_open_input(struct alsa *alsa, const char *device_name); +void alsa_close_output(struct alsa *alsa); +void alsa_close_input(struct alsa *alsa); +bool alsa_test_output_configuration(struct alsa *alsa, int channels, + int sampling_rate); +bool alsa_test_input_configuration(struct alsa *alsa, int channels, + int sampling_rate); +void alsa_configure_output(struct alsa *alsa, int channels, + int sampling_rate); +void alsa_configure_input(struct alsa *alsa, int channels, + int sampling_rate); +void alsa_register_output_callback(struct alsa *alsa, + int (*callback)(void *data, short *buffer, int samples), + void *callback_data, int samples_trigger); +void alsa_register_input_callback(struct alsa *alsa, + int (*callback)(void *data, short *buffer, int samples), + void *callback_data, int samples_trigger); +int alsa_run(struct alsa *alsa, int duration_ms); + +#endif |