aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Li <dvdli@google.com>2020-12-02 07:46:19 +0000
committerDavid Li <dvdli@google.com>2020-12-02 07:46:19 +0000
commitc0d68b1cfc5e91e5b154b1b69af04b4d6006a122 (patch)
tree7028f39cbd40f356e0be427e8b436e6099f86f6b /include
parent40867609e738919872c88b7716b17c30d96211a4 (diff)
fix build breakage
1. Add a missing field and a function 2. Disable the deprecated attribute in Android temporarily to allow us to use "pcm_read/write" which are deprecated upstream 3. Remove an unused define and an include in mixer.h 4. Add mixer_ctl_event and copy the snd_ctl_event to mixer_ctl_event 5. Add pcm_ioctl function and mark as deprecated function
Diffstat (limited to 'include')
-rw-r--r--include/tinyalsa/attributes.h11
-rw-r--r--include/tinyalsa/mixer.h25
-rw-r--r--include/tinyalsa/pcm.h4
3 files changed, 32 insertions, 8 deletions
diff --git a/include/tinyalsa/attributes.h b/include/tinyalsa/attributes.h
index e33f46a..f465ba1 100644
--- a/include/tinyalsa/attributes.h
+++ b/include/tinyalsa/attributes.h
@@ -6,7 +6,12 @@
* when the library is being used incorrectly.
* */
-#ifdef __GNUC__
+// FIXME: Disable the deprecated attribute in Android temporarily. pcm_read/write are marked as
+// deprecated functions in the latest tinyalsa in GitHub. However, there are lots of libraries in
+// Android using these functions and building with -Werror flags. Besides build breakage, the
+// behavior and interface of the successors, pcm_readi/writei, are also changed. Once all have
+// been cleaned up, we will enable this again.
+#if defined(__GNUC__) && !defined(ANDROID)
/** Issues a warning when a function is being
* used that is now deprecated.
@@ -20,7 +25,7 @@
* */
#define TINYALSA_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-#else /* __GNUC__ */
+#else /* __GNUC__ && !ANDROID */
/** This is just a placeholder for compilers
* that aren't GCC or Clang.
@@ -34,6 +39,6 @@
* */
#define TINYALSA_WARN_UNUSED_RESULT
-#endif /* __GNUC__ */
+#endif /* __GNUC__ && !ANDROID */
#endif /* TINYALSA_ATTRIBUTES_H */
diff --git a/include/tinyalsa/mixer.h b/include/tinyalsa/mixer.h
index 77d5d01..7d0580f 100644
--- a/include/tinyalsa/mixer.h
+++ b/include/tinyalsa/mixer.h
@@ -37,19 +37,34 @@
#include <sys/time.h>
#include <stddef.h>
-#include <sound/asound.h>
#if defined(__cplusplus)
extern "C" {
#endif
-/* TLV header size*/
-#define TLV_HEADER_SIZE sizeof(struct snd_ctl_tlv)
-
struct mixer;
struct mixer_ctl;
+// mixer_ctl_event is a mirroring structure of snd_ctl_event
+struct mixer_ctl_event {
+ int type;
+ union {
+ struct {
+ unsigned int mask;
+ struct {
+ unsigned int numid;
+ int iface;
+ unsigned int device;
+ unsigned int subdevice;
+ unsigned char name[44];
+ unsigned int index;
+ } id;
+ } element;
+ unsigned char data[60];
+ } data;
+};
+
/** Mixer control type.
* @ingroup libtinyalsa-mixer
*/
@@ -138,7 +153,7 @@ int mixer_ctl_get_range_min(const struct mixer_ctl *ctl);
int mixer_ctl_get_range_max(const struct mixer_ctl *ctl);
-int mixer_read_event(struct mixer *mixer, struct snd_ctl_event *ev);
+int mixer_read_event(struct mixer *mixer, struct mixer_ctl_event *event);
int mixer_consume_event(struct mixer *mixer);
#if defined(__cplusplus)
diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h
index cdc31a5..6569146 100644
--- a/include/tinyalsa/pcm.h
+++ b/include/tinyalsa/pcm.h
@@ -221,6 +221,8 @@ struct pcm_config {
/** The number of frames to overwrite the playback buffer when the playback underrun is greater
* than the silence threshold */
unsigned int silence_size;
+
+ unsigned int avail_min;
};
/** Enumeration of a PCM's hardware parameters.
@@ -361,6 +363,8 @@ int pcm_wait(struct pcm *pcm, int timeout);
long pcm_get_delay(struct pcm *pcm);
+int pcm_ioctl(struct pcm *pcm, int code, ...) TINYALSA_DEPRECATED;
+
#if defined(__cplusplus)
} /* extern "C" */
#endif