commit: 75ce80bd7e003775855d1343989d6f1ffd1b4bcd
parent ef092b8e2d5e167be0bfaea44dccf6b91257bd55
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 30 Oct 2022 15:27:33 -0700
tinyalsa: Update to latest git
Diffstat:
7 files changed, 53 insertions(+), 162 deletions(-)
diff --git a/pkg/tinyalsa/patch/0001-fix-remaining_data_size-is-0-when-not-playing-a-wave.patch b/pkg/tinyalsa/patch/0001-fix-remaining_data_size-is-0-when-not-playing-a-wave.patch
@@ -1,73 +0,0 @@
-From 7ebd3ac08a537207851eb631bdcab01f03ab91b6 Mon Sep 17 00:00:00 2001
-From: dvdli <dvdli@google.com>
-Date: Tue, 29 Jun 2021 21:35:37 +0800
-Subject: [PATCH] fix remaining_data_size is 0 when not playing a wave file
-
----
- utils/tinyplay.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/utils/tinyplay.c b/utils/tinyplay.c
-index 4c7ccf6..b2c60bc 100644
---- a/utils/tinyplay.c
-+++ b/utils/tinyplay.c
-@@ -27,6 +27,7 @@
- */
-
- #include <tinyalsa/asoundlib.h>
-+#include <stdbool.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
-@@ -98,6 +99,7 @@ struct ctx {
- struct chunk_fmt chunk_fmt;
-
- FILE *file;
-+ size_t file_size;
- };
-
- int ctx_init(struct ctx* ctx, const struct cmd *cmd)
-@@ -113,6 +115,9 @@ int ctx_init(struct ctx* ctx, const struct cmd *cmd)
- ctx->file = stdin;
- } else {
- ctx->file = fopen(cmd->filename, "rb");
-+ fseek(ctx->file, 0L, SEEK_END);
-+ ctx->file_size = ftell(ctx->file);
-+ fseek(ctx->file, 0L, SEEK_SET);
- }
-
- if (ctx->file == NULL) {
-@@ -162,6 +167,7 @@ int ctx_init(struct ctx* ctx, const struct cmd *cmd)
- config.channels = ctx->chunk_fmt.num_channels;
- config.rate = ctx->chunk_fmt.sample_rate;
- bits = ctx->chunk_fmt.bits_per_sample;
-+ ctx->file_size = (size_t) ctx->chunk_header.sz;
- }
-
- if (bits == 8) {
-@@ -396,9 +402,10 @@ int sample_is_playable(const struct cmd *cmd)
- int play_sample(struct ctx *ctx)
- {
- char *buffer;
-+ bool is_stdin_source = ctx->file == stdin;
- size_t buffer_size = 0;
- size_t num_read = 0;
-- size_t remaining_data_size = ctx->chunk_header.sz;
-+ size_t remaining_data_size = is_stdin_source ? SIZE_MAX : ctx->file_size;
- size_t read_size = 0;
- const struct pcm_config *config = pcm_get_config(ctx->pcm);
-
-@@ -426,7 +433,9 @@ int play_sample(struct ctx *ctx)
- fprintf(stderr, "error playing sample\n");
- break;
- }
-- remaining_data_size -= num_read;
-+ if (!is_stdin_source) {
-+ remaining_data_size -= num_read;
-+ }
- }
- } while (!close && num_read > 0 && remaining_data_size > 0);
-
---
-2.32.0
-
diff --git a/pkg/tinyalsa/patch/0001-make-use-of-snd_utils_close_dev_node-conditional-on-.patch b/pkg/tinyalsa/patch/0001-make-use-of-snd_utils_close_dev_node-conditional-on-.patch
@@ -0,0 +1,27 @@
+From 6dc78a2ca2a3f4e74816a014c73b71201a1290c6 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 30 Aug 2021 20:11:37 -0700
+Subject: [PATCH] make use of snd_utils_close_dev_node conditional on
+ TINYALSA_USES_PLUGINS
+
+---
+ src/pcm.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/pcm.c b/src/pcm.c
+index d681563..287b4a2 100644
+--- a/src/pcm.c
++++ b/src/pcm.c
+@@ -986,7 +986,9 @@ int pcm_close(struct pcm *pcm)
+ pcm->ops->munmap(pcm->data, pcm->mmap_buffer, pcm_frames_to_bytes(pcm, pcm->buffer_size));
+ }
+
++#if TINYALSA_USES_PLUGINS
+ snd_utils_close_dev_node(pcm->snd_node);
++#endif
+ pcm->ops->close(pcm->data);
+ pcm->buffer_size = 0;
+ pcm->fd = -1;
+--
+2.37.3
+
diff --git a/pkg/tinyalsa/patch/0002-expose-pcm_state-in-public-API.patch b/pkg/tinyalsa/patch/0002-expose-pcm_state-in-public-API.patch
@@ -0,0 +1,25 @@
+From a307284f4d4dce9974444f9b304c6bcbbf039780 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Tue, 31 Aug 2021 14:24:09 -0700
+Subject: [PATCH] expose pcm_state in public API
+
+---
+ include/tinyalsa/pcm.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h
+index 9fca92d..ddf58f0 100644
+--- a/include/tinyalsa/pcm.h
++++ b/include/tinyalsa/pcm.h
+@@ -363,6 +363,8 @@ int pcm_start(struct pcm *pcm);
+
+ int pcm_stop(struct pcm *pcm);
+
++int pcm_state(struct pcm *pcm);
++
+ int pcm_wait(struct pcm *pcm, int timeout);
+
+ long pcm_get_delay(struct pcm *pcm);
+--
+2.37.3
+
diff --git a/pkg/tinyalsa/patch/0002-fix-the-zero-fd-closing-problem.patch b/pkg/tinyalsa/patch/0002-fix-the-zero-fd-closing-problem.patch
@@ -1,36 +0,0 @@
-From 27a6c9e762297ce37f28619166b9dd134ffbdf92 Mon Sep 17 00:00:00 2001
-From: dvdli <dvdli@google.com>
-Date: Tue, 13 Jul 2021 14:47:47 +0800
-Subject: [PATCH] fix the zero fd closing problem
-
-The pcm_hw_close refused to close the zero fd. Add "equal to"
-condition and modify the type of fd to int to close the zero fd.
----
- src/pcm_hw.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/pcm_hw.c b/src/pcm_hw.c
-index 38b2e83..9f01fb0 100644
---- a/src/pcm_hw.c
-+++ b/src/pcm_hw.c
-@@ -50,7 +50,7 @@ struct pcm_hw_data {
- /** Device number for the pcm device */
- unsigned int device;
- /** File descriptor to the pcm device file node */
-- unsigned int fd;
-+ int fd;
- /** Pointer to the pcm node from snd card definiton */
- struct snd_node *node;
- };
-@@ -59,7 +59,7 @@ static void pcm_hw_close(void *data)
- {
- struct pcm_hw_data *hw_data = data;
-
-- if (hw_data->fd > 0)
-+ if (hw_data->fd >= 0)
- close(hw_data->fd);
-
- free(hw_data);
---
-2.32.0
-
diff --git a/pkg/tinyalsa/patch/0003-make-use-of-snd_utils_close_dev_node-conditional-on-.patch b/pkg/tinyalsa/patch/0003-make-use-of-snd_utils_close_dev_node-conditional-on-.patch
@@ -1,27 +0,0 @@
-From d11a02d9217b7713415be4bb6a4b6ee54df894c7 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Mon, 30 Aug 2021 20:11:37 -0700
-Subject: [PATCH] make use of snd_utils_close_dev_node conditional on
- TINYALSA_USES_PLUGINS
-
----
- src/pcm.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/pcm.c b/src/pcm.c
-index 10e477b..8a2c6be 100644
---- a/src/pcm.c
-+++ b/src/pcm.c
-@@ -975,7 +975,9 @@ int pcm_close(struct pcm *pcm)
- pcm->ops->munmap(pcm->data, pcm->mmap_buffer, pcm_frames_to_bytes(pcm, pcm->buffer_size));
- }
-
-+#if TINYALSA_USES_PLUGINS
- snd_utils_close_dev_node(pcm->snd_node);
-+#endif
- pcm->ops->close(pcm->data);
- pcm->buffer_size = 0;
- pcm->fd = -1;
---
-2.32.0
-
diff --git a/pkg/tinyalsa/patch/0004-expose-pcm_state-in-public-API.patch b/pkg/tinyalsa/patch/0004-expose-pcm_state-in-public-API.patch
@@ -1,25 +0,0 @@
-From f5a956cbb1ad414b8da0127cf997cfe43d7a6bcb Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Tue, 31 Aug 2021 14:24:09 -0700
-Subject: [PATCH] expose pcm_state in public API
-
----
- include/tinyalsa/pcm.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/include/tinyalsa/pcm.h b/include/tinyalsa/pcm.h
-index b40550c..1d77e53 100644
---- a/include/tinyalsa/pcm.h
-+++ b/include/tinyalsa/pcm.h
-@@ -359,6 +359,8 @@ int pcm_start(struct pcm *pcm);
-
- int pcm_stop(struct pcm *pcm);
-
-+int pcm_state(struct pcm *pcm);
-+
- int pcm_wait(struct pcm *pcm, int timeout);
-
- long pcm_get_delay(struct pcm *pcm);
---
-2.32.0
-
diff --git a/pkg/tinyalsa/ver b/pkg/tinyalsa/ver
@@ -1 +1 @@
-2.0.0 r0
+2.0.0-45-g4fbaeef r0