logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: e4f1e4f50393a005ae1bb9a9ccbf02b8bd3c7670
parent 80ad9f758b233dc2e806607bbae8338029093cd6
Author: Michael Forney <mforney@mforney.org>
Date:   Mon, 30 Aug 2021 20:13:14 -0700

Add tinyalsa 2.0.0

Diffstat:

M.gitmodules4++++
Apkg/tinyalsa/gen.lua33+++++++++++++++++++++++++++++++++
Apkg/tinyalsa/patch/0001-fix-remaining_data_size-is-0-when-not-playing-a-wave.patch73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/tinyalsa/patch/0002-fix-the-zero-fd-closing-problem.patch36++++++++++++++++++++++++++++++++++++
Apkg/tinyalsa/patch/0003-make-use-of-snd_utils_close_dev_node-conditional-on-.patch27+++++++++++++++++++++++++++
Apkg/tinyalsa/patch/0004-expose-pcm_state-in-public-API.patch25+++++++++++++++++++++++++
Apkg/tinyalsa/src1+
Apkg/tinyalsa/ver1+
8 files changed, 200 insertions(+), 0 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -324,6 +324,10 @@ path = pkg/the_silver_searcher/src url = https://github.com/ggreer/the_silver_searcher ignore = all +[submodule "pkg/tinyalsa/src"] + path = pkg/tinyalsa/src + url = https://github.com/tinyalsa/tinyalsa.git + ignore = all [submodule "pkg/tz/src"] path = pkg/tz/src url = https://github.com/eggert/tz diff --git a/pkg/tinyalsa/gen.lua b/pkg/tinyalsa/gen.lua @@ -0,0 +1,33 @@ +cflags{ + '-std=c99', '-Wall', '-Wpedantic', '-Wno-overflow', + '-D _POSIX_C_SOURCE=201112L', + '-I $srcdir/include', + '-isystem $builddir/pkg/linux-headers/include', +} + +pkg.deps = {'pkg/linux-headers/headers'} + +pkg.hdrs = copy('$outdir/include/tinyalsa', '$srcdir/include/tinyalsa', { + 'attributes.h', + 'pcm.h', + 'mixer.h', + 'asoundlib.h', + 'version.h', +}) + +lib('libtinyalsa.a', [[ + src/( + limits.c + pcm.c + pcm_hw.c + mixer.c + mixer_hw.c + ) +]]) + +for _, tool in ipairs{'tinycap', 'tinymix', 'tinypcminfo', 'tinyplay'} do + file('bin/'..tool, '755', exe(tool, {'utils/'..tool..'.c', 'libtinyalsa.a'})) + man{'$srcdir/utils/'..tool..'.1'} +end + +fetch 'git' 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 @@ -0,0 +1,73 @@ +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/0002-fix-the-zero-fd-closing-problem.patch b/pkg/tinyalsa/patch/0002-fix-the-zero-fd-closing-problem.patch @@ -0,0 +1,36 @@ +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 @@ -0,0 +1,27 @@ +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 @@ -0,0 +1,25 @@ +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/src b/pkg/tinyalsa/src @@ -0,0 +1 @@ +Subproject commit 1c5fb68ced57d838f2b7ecd0c00bc1fefc9ab60d diff --git a/pkg/tinyalsa/ver b/pkg/tinyalsa/ver @@ -0,0 +1 @@ +2.0.0 r0