Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
cmake: specify c99
|
|
cmake: fix header install location
|
|
|
|
Set standard to c99, require it, disable language extensions.
Define _POSIX_C_SOURCE to 200809L so time.h declares struct timespec.
Add -Wpedantic to find use of language extensions.
snd_card_plugin.c: remove one unnecessary ';' to make -Wpedantic work
|
|
Older versions of linux's API header sound/asound.h accidentally rely on
indirect declaration of struct timespec, which isn't reliable, so
include time.h before it to support older versions of sound/asound.h
properly
|
|
Various cmake improvements
|
|
Use scripts/version.sh, and set version in project() using its output.
Instead of using a variable to store the definition of
TINYALSA_USES_PLUGINS, and adding it as a compile option, use a
generator expression to define it in target_compile_definitions when the
option is enabled.
Set BUILD_SHARED_LIBS to on by default.
Add options to disable examples and utils.
Instead of using SRCS and HDRS variables, set PUBLIC_HEADER property on
tinyalsa to install the headers along with the target.
Set library version, so the shared library will have version suffixes.
Check that C warning flags are supported instead of adding them
unconditionally.
Use ${CMAKE_DL_LIBS} instead of hardcoding "dl", and add it to
tinyalsa's link interface and link depends, instead of linking it in the
examples and utils.
Add the "include" directory as a PUBLIC include directory to tinyalsa,
instead of making it PRIVATE and adding it to examples and utils as
well, because anything linking the tinyalsa target will need to include
"include".
Instead of using macros for building examples and utils, use a for loop.
Include cmake's GNUInstallDirs to automatically correctly populate
installation dir variables, instead of doing it manually.
|
|
tinywavinfo: add wrapper for fread to check its return value
|
|
|
|
|
|
|
|
Add public domain header-only option-parsing library optparse
|
|
tinywavinfo: replace obsolete memalign with posix_memalign
|
|
This also removes the requirement for the file argument to come before
options.
|
|
add equivalent longopts that are available in other commands
|
|
|
|
|
|
https://github.com/skeeto/optparse
|
|
|
|
|
|
Mixer event plugin update
|
|
src/pcm.c: remove MAP_FILE mmap flag
|
|
scripts/version.sh: switch from bash to POSIX sh
|
|
Fix memory leak in mixer_wait_event(). Also, poll should be
unblocked after increasing event_cnt in mixer_plugin, otherwise
event_cnt can become negative during read_event. Fix the same.
|
|
snd_ctl_event is needed by client to get details of event received.
Introduce mixer_read_event() with plugin support to support this.
|
|
mixer_consume_event consumes subscribed events from the mixer
in order to allow monitoring of mixer control value changed.
|
|
MAP_FILE is a non-standard mmap flag, and has no effect on conformant
systems.
|
|
Change shebang to #!/bin/sh.
Remove usage of non-POSIX 'local' builtin, and replace it with using a
function's positional parameters to store variables, as they are local
to the function.
|
|
|
|
|
|
tinyalsa: use strncpy instead of memcpy to copy string constant
|
|
There does not really seem to be an usage for these dummy string,
so let's remove them.
|
|
memcpy() is arguably wrong when copying these string constants.
The string constants will usually just be as long as necessary,
so we might copy some random memory behind it and eventually crash.
Use strncpy() instead to avoid copying characters after the null
terminator. For some reason the strings in snd_ctl_card_info use
unsigned chars, so we need a cast to char* to make it compile
unfortunately...
This fixes the following compile error on ppc64le:
In function 'mixer_plug_get_card_info',
inlined from 'mixer_plug_ioctl' at mixer_plugin.c:371:15:
mixer_plugin.c:333:5: error: 'memcpy' forming offset [9, 16] is out of the bounds [0, 8] [-Werror=array-bounds]
333 | memcpy(card_info->id, "card_id", sizeof(card_info->id));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Not sure why that warning does not exist on other architectures.
|
|
tinyalsa: include <sys/types.h> for ssize_t
|
|
ssize_t is defined in <sys/types.h>, see
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
Add an include for it to avoid a compile error when building with musl:
../include/tinyalsa/plugin.h:184:5: error: expected specifier-qualifier-list before 'ssize_t'
184 | ssize_t (*read_event) (struct mixer_plugin *plugin,
| ^~~~~~~
|
|
|
|
pcm_hw_close: avoid SIGSEGV when pcm_hw_open fail
|
|
Prevent the call to pcm->ops-close() if pcm->ops->open() fail.
Fix memory leak in pcm_hw_open() in case of failure.
* thread #1, name = 'ut', stop reason = signal SIGSEGV: invalid address (fault address: 0x8)
frame #0: 0x00007ffff7f863e8 libtinyalsa.so.1`pcm_hw_close(data=0x0000000000000000) at pcm_hw.c:61:21
58 {
59 struct pcm_hw_data *hw_data = data;
60
-> 61 if (hw_data->fd > 0)
62 close(hw_data->fd);
63
64 free(hw_data);
(lldb) bt
* thread #1, name = 'ut', stop reason = signal SIGSEGV: invalid address (fault address: 0x8)
* frame #0: 0x00007ffff7f863e8 libtinyalsa.so.1`pcm_hw_close(data=0x0000000000000000) at pcm_hw.c:61:21
frame #1: 0x00007ffff7f8491c libtinyalsa.so.1`pcm_close(pcm=0x0000000000a9eba0) at pcm.c:820:5
frame #2: 0x00007ffff7f84e0a libtinyalsa.so.1`pcm_open(card=128, device=0, flags=13, config=0x00007fffffffd000) at pcm.c:957:5
Signed-off-by: Miguel GAIO <mgaio35@gmail.com>
|
|
tinyalsa: add plugin.h to install path
|
|
Export plugin.h so that it can be used by tinyalsa
clients.
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
|
|
pcm: avoid calling pcm_hw->close() twice
|
|
pcm: do not negate errno
|
|
sterror() surely doesn't appreciate that:
cannot set hw params: Unknown error -22
where it should've been:
cannot set hw params: Invalid argument
|
|
It would result in a double free:
$ tinyplay example.wav
failed to open for pcm 0,0
*** glibc detected *** ./utils/tinyplay: double free or corruption (fasttop): 0x402dc258 ***
Aborted
$
The crash happens here:
Program received signal SIGABRT, Aborted.
0x40070e78 in raise () from /lib/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.16-34.olpc.0.fc18.armv7hl libgcc-4.7.2-8.fc18.armv7hl
(gdb) bt
#0 0x40070e78 in raise () from /lib/libc.so.6
#1 0x400724b8 in abort () from /lib/libc.so.6
#2 0x400ad6e0 in ?? () from /lib/libc.so.6
#3 0x400b54e8 in ?? () from /lib/libc.so.6
#4 0x2a00486c in pcm_hw_close ()
#5 0x2a0032e0 in pcm_close ()
#6 0x2a0016b0 in ctx_init ()
#7 0x2a000c98 in main ()
(gdb)
The previous free was done here:
Breakpoint 1, 0x400b8b8c in free () from /lib/libc.so.6
(gdb) bt
#0 0x400b8b8c in free () from /lib/libc.so.6
#1 0x2a00486c in pcm_hw_close ()
#2 0x2a003674 in pcm_open ()
#3 0x2a0015e8 in ctx_init ()
#4 0x2a000c98 in main ()
(gdb)
|
|
|
|
Fix cross-compilation
|