config.h may contain defines like _FILE_OFFSET_BITS which influence
the system wide include files (off_t types, open -> open64 function
usage etc.).
Related: https://github.com/alsa-project/alsa-utils/pull/223
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
- ERESTART not supported platform: use EINTR instead
- add include/os_compat.h, well-used OS specific definition
- copied include/bswap.h from alsa-lib
- EPIPE and ESTRPIPE are different usage, but currently
EPIPE is used when ESTRPIPE is not defined.
To fix this problem, assign ESPIPE instead.
Fixes: https://github.com/alsa-project/alsa-utils/pull/186
Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Also replace lseek64 with lseek.
_FILE_OFFSET_BITS=64 is passed to needed platforms since configure uses
AC_SYS_LARGEFILE macro. Therefore off_t is already 64-bit and lseek is
same as lseek64.
Additionally this fixes buils with latest musl where these lfs64
functions are moved out from _GNU_SOURCE and under _LARGEFILE64_SOURCE
macro alone. This makes the builds fail on 32-bit platforms even though
default off_t on musl is 64-bit always.
Fixes: https://github.com/alsa-project/alsa-utils/pull/183
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The spelling of 'aborted' was 'aboeted' in the manual. This commit fixes
it.
Fixes: a37703614a ("axfer: fulfill manual section for libffado backend")
Fixes: https://github.com/alsa-project/alsa-utils/pull/156
Reported-by: Chao Song chao.song@linux.intel.com
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In timer-based scheduling model, event waiting is just to measure time
elapse since no event is expected to occur. However, as a result to
applying commit e5e6a7838b, -ETIMEDOUT returns in the case and
the caller handles it as error. This results in disorder of the
scheduling model.
This commit fixes the regression so that the -ETIMEDOUT case is expected.
Reported-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/alsa-devel/687f9871-7484-1370-04d1-9c968e86f72b@linux.intel.com/
Fixes: e5e6a7838b ("axfer: return ETIMEDOUT when no event occurs after waiter expiration")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit reduces test case for maximum number of samples per frame so
that overall time is shortened. The count of total iteration is also
reduced by one quarter.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This reverts commit e1551de8dd since tests
run for in-memory files now.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit reduces test case for maximum number of frame count so that
overall time is shortened. The count of total iteration is still the same.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The mapper test program writes audio data frame to files, and read
them from the files, then validate them. For the operations, usage of
any in-memory file is good to shorten time of overall operations.
This commit uses shm by memfd_create().
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In mapper test program, two set of file descriptors open to the same files
for container builder and parser contexts, however the same file descriptor
is available for the case.
This commit arranges to use the same file descriptor for the contexts.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The container test program writes audio data frame to file, and read
them from the file, then validate them. For the operations, usage of
any in-memory file is good to shorten time of overall operations.
This commit uses shm via memfd_create(). As a result, overall time to
run is shorten one half of before, depending on machine environment.
I note that we can achieve the same result by using O_TMPFILE flag in
open(2) system call, however the implementation of O_TMPFILE is to add
i-node without name on underling file system, thus it has overhead
depending on implementation in each file system. On the other hand,
memfd_create() is directly relevant to shm and expected to be less
overhead.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In container test program, two file descriptors open to the same file
for builder and parser contexts, however the same file descriptor is
available for the case.
This commit arranges to use the same file descriptor for the contexts.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit closes file descriptor outside of container module so
that maintenance of lifetime for the descriptor is delegated to container
user.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Internal container module operates file descriptor to media file. For
this purpose, the structure has fd member and any file operation is done
internally. However, the case to use special file descriptor such as
memfd requires to maintain file descriptor externally.
This commit opens file descriptor outside of container module. The
internal APIs to initialize container get an argument for the file
descriptor instead of file path.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit unifies duplicated code to allocate for container structure.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit arranges assignment to fd member after checking file
descriptor.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Current implementation sets stdio member in a condition branch, however
it's convenient to set it always regardless of any condition.
This commit arranges assignment to the member.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In internal container module, any file descriptor is expected as
non-blocking mode. Current implementation distinguish the case of
standard input and output from the case to open actual file since
O_NONBLOCK is used for the latter case. However, in both cases,
fcntl(2) is available to set non-blocking mode to the file descriptor.
This commit arranges to use fcntl(2) for both cases.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The pointer operand to the binary `+` operator must be to a complete
object type.
Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
uint64_t evaluates to unsigned long long on 32-bit, not unsigned long.
Use the proper formats.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.
This commit outputs report it for non-blocking operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit applies code refactoring for waiting PCM event queued
per period of PCM buffer in copying operation for IRQ-based scheduling
model.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.
This commit outputs report it for mmap operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Although the waiter abstraction handles timeout as success, it should
report for callers to know timeout.
This commit takes the waiter to return -ETIMEDOUT when timeout expires.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
A call of select(2) returns negative code and report errors via errno
local variable, howver current waiter implementation for select(2)
returns the negative code instead of errno.
This commit fixes it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
A call of select(2) returns error code at failure, the number of file
descriptors available I/O at success. Current implementation of
waiter abstraction for select(2) returns 0 at success and callers
can't get the number.
This commit fixes it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
In system V ABIs with ILP32 data model, bit shift for '1ul' can brings
undefined behaviour when the calculation result is over 32 bit width.
This commit fixes the bug.
Reported-by: Rolf Eike Beer <eike@sf-mail.de>
Reference: https://bugs.gentoo.org/681652
Reference: https://github.com/alsa-project/alsa-utils/issues/23
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Each container should be configured to store one saple per frame in
demuxer case. This commit fixes the bug.
Fixes: 25c8e3bebb ('axfer: add support for a mapper for multiple target')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit fixes uninitialized return value from a call of test_mux() and
text_demux() to suppress warnings below:
$ make check
...
gcc -DHAVE_CONFIG_H -I. -I../../include -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_mapper’:
mapper-test.c:241:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
return err;
^~~
mapper-test.c:231:5: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (err < 0)
^
Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit fixes uninitialized return value from a call of test_vector()
to suppress a warning below.
gcc -DHAVE_CONFIG_H -I. -I../../include -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_vector’:
mapper-test.c:293:6: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
int err;
^~~
Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This avoids multiple definitions of the same global variable (one in
each file that includes this header), and fixes a linking error when
compiled with -fno-common.
Fixes: 96110793b3 ("axfer: add support for a container of raw data")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
struct block_v120_format defines these members as uint8_t. On
little-endian systems, no swapping is done, and the generated block
header is fine. However, on big-endian machines, the value is swapped to
the high byte and then truncated by the assignment, causing both
bits_per_sample and samples_per_frame to be zero.
This fixes an assertion failure in container-test when later
parsing the header ["assert(*samples_per_frame > 0);" in
container_context_pre_process()].
Fixes: 4ab7510f3a: ("axfer: add support for a container of Creative Tech. voice format")
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The file 'axfer/test/generator.h' is missing in distribution and brings
FTBFS for unit tests of axfer.
This commit fixes to add it.
Reported-by: Elimar Riesebieter <riesebie@lxtec.de>
Fixes: b878df1ff0: ('axfer: add unit test for container interface')
Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The program, axfer, was developed in userspace with glibc-2.28. This
userspace is mostly compliant to POSIX:2008 and some additional macros
for poll event are officially available. The glibc supports them as a
default since its v2.12 release. It will be failed to be compiled with
old glibc or the other libraries for C standard APIs.
One of the purpose of axfer is an better alternative of aplay. In a
point of the purpose, it's preferable to be compiled with the old
libraries.
This commit adds conditional macros to be compiled with libraries for
old compliance level of POSIX.
Reported-by: Jay Foster <jay@systech.com>
Fixes: fce16d9279 ('axfer: add an implementation of waiter for select(2)')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit supplements value of options for the manual of transfer
subcommand.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now help message is available to give help option to command line.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The libffado library can listen to isochronous channels to which unit on
IEEE 1394 bus transfers packets as long as the unit allows software to
read the channel from its register.
This commit corrects description about snoop mode.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
At present, axfer losts backward compatibility to aplay in a point of
'chmap' option.
This commit filfills a section to describe lose of backward compatibility
of chmap option.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Two unit tests are available to check internal implementation of axfer.
They perform file I/O for many times and take much time to finish.
This commit adds a section about it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Timer-based scheduling model has some merits against IRQ-based
scheduling model. However, as of Linux kernel v4.21, ALSA PCM interface
between kernel/userspace has a lack of some features.
This commit adds a subsection to describe it.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>