What version of aplay? If it is version 1.1.6, you might be running
into this issue:
From: Takashi Iwai <tiwai@xxxxxxx>
Subject: [PATCH] aplay: Fix invalid file size check for non-regular
files
aplay tries to check the file size via fstat() at parsing the format
headers and avoids parsing when the size is shorter than the given
size. This works fine for regular files, but when a special file
like
pipe is passed, it fails, eventually leading to the fallback mode
wrongly.
A proper fix is to do this sanity check only for a regular file.
Reported-by: Jay Foster <jay@xxxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
aplay/aplay.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/aplay/aplay.c b/aplay/aplay.c
index bbd7fffa04fc..63ec9efbebc1 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2821,7 +2821,8 @@ static int read_header(int *loaded, int
header_size)
/* don't be adventurous, get out if file size is smaller than
* requested header size */
- if (buf.st_size < header_size)
+ if ((buf.st_mode & S_IFMT) == S_IFREG &&
+ buf.st_size < header_size)
return -1;
if (*loaded < header_size) {
Jay
On 7/27/2018 11:54 AM, chris hermansen
wrote:
Fabian and list,
I'd like to pipe flac
files to aplay using the command:
flac -d -c file.flac | aplay
However, aplay does not read the audio file parameters and
assumes that
all stdin data is 8 kHz, 8-bit, mono. The following message
appears:
Playing raw data 'stdin' : Unsigned 8 bit, Rate 8000 Hz,
Mono
This message appears with *any* audio format.
Piping used to work properly with older versions of alsa but
with the latest
versions the parameters of the piped audio data cannot be
determined.
Have you tried specifying the parameters of the stream?
clh@avignon:~/Projects/TimberlineAVI/Converted/Version3$
aplay --help
Usage: aplay [OPTION]... [FILE]...
-h, --help help
--version print current version
-l, --list-devices list all soundcards and digital
audio devices
-L, --list-pcms list device names
-D, --device=NAME select PCM by name
-q, --quiet quiet mode
-t,
--file-type TYPE file type (voc, wav, raw or au)
-c, --channels=# channels
-f, --format=FORMAT sample format (case insensitive)
-r, --rate=# sample rate
-d, --duration=# interrupt after # seconds
-M, --mmap mmap stream
-N, --nonblock nonblocking mode
-F, --period-time=# distance between interrupts is #
microseconds
-B, --buffer-time=# buffer duration is # microseconds
--period-size=# distance between interrupts is #
frames
--buffer-size=# buffer duration is # frames
-A, --avail-min=# min available space for wakeup is #
microseconds
-R, --start-delay=# delay for automatic PCM start is #
microseconds
(relative to buffer size if <= 0)
-T, --stop-delay=# delay for automatic PCM stop is #
microseconds from xrun
-v, --verbose show PCM structure and setup
(accumulative)
-V, --vumeter=TYPE enable VU meter (TYPE: mono or
stereo)
-I, --separate-channels one file for each channel
-i, --interactive allow interactive operation from
stdin
-m, --chmap=ch1,ch2,.. Give the channel map to override or
follow
--disable-resample disable automatic rate resample
--disable-channels disable automatic channel
conversions
--disable-format disable automatic format conversions
--disable-softvol disable software volume control
(softvol)
--test-position test ring buffer position
--test-coef=# test coefficient for ring buffer
position (default 8)
_expression_ for validation is: coef *
(buffer_size / 2)
--test-nowait do not wait for ring buffer - eats
whole CPU
--max-file-time=# start another output file when the
old file has recorded
for this many seconds
--process-id-file write the process ID here
--use-strftime apply the strftime facility to the
output file name
--dump-hw-params dump hw_params of the device
--fatal-errors treat all errors as fatal
Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE
U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE
U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE
IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM
MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE
S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE
G723_24 G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE
DSD_U32_LE DSD_U16_BE DSD_U32_BE
Some of these may not be available on selected hardware
The available format shortcuts are:
-f cd (16 bit little endian, 44100, stereo)
-f cdr (16 bit big endian, 44100, stereo)
-f dat (16 bit little endian, 48000, stereo)
--
Chris Hermansen · clhermansen "at" gmail "dot"
com
C'est ma façon de parler.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user
|