forked from pool/alsa-utils
Accepting request 150682 from home:tiwai:branches:multimedia:libs
- Backport a few fix patches from upstream git tree: 0012-aplay-Add-the-support-for-big-endian-WAV-format-RIFX.patch 0013-configure-Fix-obsolete-AM_CONFIG_HEADER-macro.patch 0014-speaker-test-increase-the-maximum-supported-rate-to-.patch 0015-amixer-Fix-dB-value-outputs-in-amixer-contents.patch OBS-URL: https://build.opensuse.org/request/show/150682 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=69
This commit is contained in:
parent
90675f2c47
commit
0a874f0c1f
196
0012-aplay-Add-the-support-for-big-endian-WAV-format-RIFX.patch
Normal file
196
0012-aplay-Add-the-support-for-big-endian-WAV-format-RIFX.patch
Normal file
@ -0,0 +1,196 @@
|
||||
From de61ec66fe303888bc5db49b5989e37bb1ddfca5 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Thu, 13 Dec 2012 10:53:19 +0100
|
||||
Subject: [PATCH 12/15] aplay: Add the support for big-endian WAV format (RIFX)
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
aplay/aplay.c | 95 ++++++++++++++++++++++++++++++++++++++------------------
|
||||
aplay/formats.h | 7 ++++
|
||||
2 files changed, 73 insertions(+), 29 deletions(-)
|
||||
|
||||
--- a/aplay/aplay.c
|
||||
+++ b/aplay/aplay.c
|
||||
@@ -892,11 +892,20 @@ static ssize_t test_wavefile(int fd, u_c
|
||||
WaveFmtBody *f;
|
||||
WaveChunkHeader *c;
|
||||
u_int type, len;
|
||||
+ unsigned short format, channels;
|
||||
+ int big_endian, native_format;
|
||||
|
||||
if (size < sizeof(WaveHeader))
|
||||
return -1;
|
||||
- if (h->magic != WAV_RIFF || h->type != WAV_WAVE)
|
||||
+ if (h->magic == WAV_RIFF)
|
||||
+ big_endian = 0;
|
||||
+ else if (h->magic == WAV_RIFX)
|
||||
+ big_endian = 1;
|
||||
+ else
|
||||
return -1;
|
||||
+ if (h->type != WAV_WAVE)
|
||||
+ return -1;
|
||||
+
|
||||
if (size > sizeof(WaveHeader)) {
|
||||
check_wavefile_space(buffer, size - sizeof(WaveHeader), blimit);
|
||||
memcpy(buffer, _buffer + sizeof(WaveHeader), size - sizeof(WaveHeader));
|
||||
@@ -907,7 +916,7 @@ static ssize_t test_wavefile(int fd, u_c
|
||||
test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__);
|
||||
c = (WaveChunkHeader*)buffer;
|
||||
type = c->type;
|
||||
- len = LE_INT(c->length);
|
||||
+ len = TO_CPU_INT(c->length, big_endian);
|
||||
len += len % 2;
|
||||
if (size > sizeof(WaveChunkHeader))
|
||||
memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader));
|
||||
@@ -929,7 +938,8 @@ static ssize_t test_wavefile(int fd, u_c
|
||||
check_wavefile_space(buffer, len, blimit);
|
||||
test_wavefile_read(fd, buffer, &size, len, __LINE__);
|
||||
f = (WaveFmtBody*) buffer;
|
||||
- if (LE_SHORT(f->format) == WAV_FMT_EXTENSIBLE) {
|
||||
+ format = TO_CPU_SHORT(f->format, big_endian);
|
||||
+ if (format == WAV_FMT_EXTENSIBLE) {
|
||||
WaveFmtExtensibleBody *fe = (WaveFmtExtensibleBody*)buffer;
|
||||
if (len < sizeof(WaveFmtExtensibleBody)) {
|
||||
error(_("unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)"),
|
||||
@@ -940,19 +950,20 @@ static ssize_t test_wavefile(int fd, u_c
|
||||
error(_("wrong format tag in extensible 'fmt ' chunk"));
|
||||
prg_exit(EXIT_FAILURE);
|
||||
}
|
||||
- f->format = fe->guid_format;
|
||||
+ format = TO_CPU_SHORT(fe->guid_format, big_endian);
|
||||
}
|
||||
- if (LE_SHORT(f->format) != WAV_FMT_PCM &&
|
||||
- LE_SHORT(f->format) != WAV_FMT_IEEE_FLOAT) {
|
||||
- error(_("can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"), LE_SHORT(f->format));
|
||||
+ if (format != WAV_FMT_PCM &&
|
||||
+ format != WAV_FMT_IEEE_FLOAT) {
|
||||
+ error(_("can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"), format);
|
||||
prg_exit(EXIT_FAILURE);
|
||||
}
|
||||
- if (LE_SHORT(f->channels) < 1) {
|
||||
- error(_("can't play WAVE-files with %d tracks"), LE_SHORT(f->channels));
|
||||
+ channels = TO_CPU_SHORT(f->channels, big_endian);
|
||||
+ if (channels < 1) {
|
||||
+ error(_("can't play WAVE-files with %d tracks"), channels);
|
||||
prg_exit(EXIT_FAILURE);
|
||||
}
|
||||
- hwparams.channels = LE_SHORT(f->channels);
|
||||
- switch (LE_SHORT(f->bit_p_spl)) {
|
||||
+ hwparams.channels = channels;
|
||||
+ switch (TO_CPU_SHORT(f->bit_p_spl, big_endian)) {
|
||||
case 8:
|
||||
if (hwparams.format != DEFAULT_FORMAT &&
|
||||
hwparams.format != SND_PCM_FORMAT_U8)
|
||||
@@ -960,43 +971,69 @@ static ssize_t test_wavefile(int fd, u_c
|
||||
hwparams.format = SND_PCM_FORMAT_U8;
|
||||
break;
|
||||
case 16:
|
||||
+ if (big_endian)
|
||||
+ native_format = SND_PCM_FORMAT_S16_BE;
|
||||
+ else
|
||||
+ native_format = SND_PCM_FORMAT_S16_LE;
|
||||
if (hwparams.format != DEFAULT_FORMAT &&
|
||||
- hwparams.format != SND_PCM_FORMAT_S16_LE)
|
||||
- fprintf(stderr, _("Warning: format is changed to S16_LE\n"));
|
||||
- hwparams.format = SND_PCM_FORMAT_S16_LE;
|
||||
+ hwparams.format != native_format)
|
||||
+ fprintf(stderr, _("Warning: format is changed to %s\n"),
|
||||
+ snd_pcm_format_name(native_format));
|
||||
+ hwparams.format = native_format;
|
||||
break;
|
||||
case 24:
|
||||
- switch (LE_SHORT(f->byte_p_spl) / hwparams.channels) {
|
||||
+ switch (TO_CPU_SHORT(f->byte_p_spl, big_endian) / hwparams.channels) {
|
||||
case 3:
|
||||
+ if (big_endian)
|
||||
+ native_format = SND_PCM_FORMAT_S24_3BE;
|
||||
+ else
|
||||
+ native_format = SND_PCM_FORMAT_S24_3LE;
|
||||
if (hwparams.format != DEFAULT_FORMAT &&
|
||||
- hwparams.format != SND_PCM_FORMAT_S24_3LE)
|
||||
- fprintf(stderr, _("Warning: format is changed to S24_3LE\n"));
|
||||
- hwparams.format = SND_PCM_FORMAT_S24_3LE;
|
||||
+ hwparams.format != native_format)
|
||||
+ fprintf(stderr, _("Warning: format is changed to %s\n"),
|
||||
+ snd_pcm_format_name(native_format));
|
||||
+ hwparams.format = native_format;
|
||||
break;
|
||||
case 4:
|
||||
+ if (big_endian)
|
||||
+ native_format = SND_PCM_FORMAT_S24_BE;
|
||||
+ else
|
||||
+ native_format = SND_PCM_FORMAT_S24_LE;
|
||||
if (hwparams.format != DEFAULT_FORMAT &&
|
||||
- hwparams.format != SND_PCM_FORMAT_S24_LE)
|
||||
- fprintf(stderr, _("Warning: format is changed to S24_LE\n"));
|
||||
- hwparams.format = SND_PCM_FORMAT_S24_LE;
|
||||
+ hwparams.format != native_format)
|
||||
+ fprintf(stderr, _("Warning: format is changed to %s\n"),
|
||||
+ snd_pcm_format_name(native_format));
|
||||
+ hwparams.format = native_format;
|
||||
break;
|
||||
default:
|
||||
error(_(" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)"),
|
||||
- LE_SHORT(f->bit_p_spl), LE_SHORT(f->byte_p_spl), hwparams.channels);
|
||||
+ TO_CPU_SHORT(f->bit_p_spl, big_endian),
|
||||
+ TO_CPU_SHORT(f->byte_p_spl, big_endian),
|
||||
+ hwparams.channels);
|
||||
prg_exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
- if (LE_SHORT(f->format) == WAV_FMT_PCM)
|
||||
- hwparams.format = SND_PCM_FORMAT_S32_LE;
|
||||
- else if (LE_SHORT(f->format) == WAV_FMT_IEEE_FLOAT)
|
||||
- hwparams.format = SND_PCM_FORMAT_FLOAT_LE;
|
||||
+ if (format == WAV_FMT_PCM) {
|
||||
+ if (big_endian)
|
||||
+ native_format = SND_PCM_FORMAT_S32_BE;
|
||||
+ else
|
||||
+ native_format = SND_PCM_FORMAT_S32_LE;
|
||||
+ hwparams.format = native_format;
|
||||
+ } else if (format == WAV_FMT_IEEE_FLOAT) {
|
||||
+ if (big_endian)
|
||||
+ native_format = SND_PCM_FORMAT_FLOAT_BE;
|
||||
+ else
|
||||
+ native_format = SND_PCM_FORMAT_FLOAT_LE;
|
||||
+ hwparams.format = native_format;
|
||||
+ }
|
||||
break;
|
||||
default:
|
||||
error(_(" can't play WAVE-files with sample %d bits wide"),
|
||||
- LE_SHORT(f->bit_p_spl));
|
||||
+ TO_CPU_SHORT(f->bit_p_spl, big_endian));
|
||||
prg_exit(EXIT_FAILURE);
|
||||
}
|
||||
- hwparams.rate = LE_INT(f->sample_fq);
|
||||
+ hwparams.rate = TO_CPU_INT(f->sample_fq, big_endian);
|
||||
|
||||
if (size > len)
|
||||
memmove(buffer, buffer + len, size - len);
|
||||
@@ -1009,7 +1046,7 @@ static ssize_t test_wavefile(int fd, u_c
|
||||
test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__);
|
||||
c = (WaveChunkHeader*)buffer;
|
||||
type = c->type;
|
||||
- len = LE_INT(c->length);
|
||||
+ len = TO_CPU_INT(c->length, big_endian);
|
||||
if (size > sizeof(WaveChunkHeader))
|
||||
memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader));
|
||||
size -= sizeof(WaveChunkHeader);
|
||||
--- a/aplay/formats.h
|
||||
+++ b/aplay/formats.h
|
||||
@@ -60,7 +60,14 @@ typedef struct voc_ext_block {
|
||||
#error "Wrong endian"
|
||||
#endif
|
||||
|
||||
+/* Note: the following macros evaluate the parameter v twice */
|
||||
+#define TO_CPU_SHORT(v, be) \
|
||||
+ ((be) ? BE_SHORT(v) : LE_SHORT(v))
|
||||
+#define TO_CPU_INT(v, be) \
|
||||
+ ((be) ? BE_INT(v) : LE_INT(v))
|
||||
+
|
||||
#define WAV_RIFF COMPOSE_ID('R','I','F','F')
|
||||
+#define WAV_RIFX COMPOSE_ID('R','I','F','X')
|
||||
#define WAV_WAVE COMPOSE_ID('W','A','V','E')
|
||||
#define WAV_FMT COMPOSE_ID('f','m','t',' ')
|
||||
#define WAV_DATA COMPOSE_ID('d','a','t','a')
|
28
0013-configure-Fix-obsolete-AM_CONFIG_HEADER-macro.patch
Normal file
28
0013-configure-Fix-obsolete-AM_CONFIG_HEADER-macro.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 66d1cf74866867773bf841293cc5a9a96484e4c6 Mon Sep 17 00:00:00 2001
|
||||
From: Marko Lindqvist <cazfi74@gmail.com>
|
||||
Date: Wed, 16 Jan 2013 15:25:38 +0100
|
||||
Subject: [PATCH 13/15] configure: Fix obsolete AM_CONFIG_HEADER macro
|
||||
|
||||
Automake-1.13 removed long obsolete AM_CONFIG_HEADER completely (
|
||||
http://lists.gnu.org/archive/html/automake/2012-12/msg00038.html )
|
||||
and errors out upon seeing it.
|
||||
|
||||
Attached patch replaces it with proper AC_CONFIG_HEADERS.
|
||||
|
||||
Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
configure.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -290,7 +290,7 @@ AC_ARG_WITH(testsound,
|
||||
TESTSOUND="$dir/test.wav")
|
||||
AC_SUBST(TESTSOUND)
|
||||
|
||||
-AM_CONFIG_HEADER(include/aconfig.h)
|
||||
+AC_CONFIG_HEADERS(include/aconfig.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
@ -0,0 +1,26 @@
|
||||
From cd39cfb480cd3ee6b771de33925094892b3be9fe Mon Sep 17 00:00:00 2001
|
||||
From: Antonio Ospite <ao2@amarulasolutions.com>
|
||||
Date: Wed, 16 Jan 2013 17:06:04 +0100
|
||||
Subject: [PATCH 14/15] speaker-test: increase the maximum supported rate to
|
||||
384000
|
||||
|
||||
There are some devices around supporting this sample rate so let's make
|
||||
speaker-test capable to deal with them.
|
||||
|
||||
Signed-off-by: Antonio Ospite <ao2@amarulasolutions.com>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
speaker-test/speaker-test.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/speaker-test/speaker-test.c
|
||||
+++ b/speaker-test/speaker-test.c
|
||||
@@ -999,7 +999,7 @@ int main(int argc, char *argv[]) {
|
||||
case 'r':
|
||||
rate = atoi(optarg);
|
||||
rate = rate < 4000 ? 4000 : rate;
|
||||
- rate = rate > 196000 ? 196000 : rate;
|
||||
+ rate = rate > 384000 ? 384000 : rate;
|
||||
break;
|
||||
case 'c':
|
||||
channels = atoi(optarg);
|
38
0015-amixer-Fix-dB-value-outputs-in-amixer-contents.patch
Normal file
38
0015-amixer-Fix-dB-value-outputs-in-amixer-contents.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From bfcb26f9f7b893e24ebeeb76232c5cd0066d087e Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Thu, 31 Jan 2013 17:47:50 +0100
|
||||
Subject: [PATCH 15/15] amixer: Fix dB value outputs in amixer contents
|
||||
|
||||
Add missing cast to signed int for DB_MINMAX* types.
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
amixer/amixer.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/amixer/amixer.c
|
||||
+++ b/amixer/amixer.c
|
||||
@@ -560,9 +560,9 @@ static void decode_tlv(unsigned int spac
|
||||
}
|
||||
} else {
|
||||
printf("min=");
|
||||
- print_dB(tlv[2]);
|
||||
+ print_dB((int)tlv[2]);
|
||||
printf(",max=");
|
||||
- print_dB(tlv[3]);
|
||||
+ print_dB((int)tlv[3]);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -600,9 +600,9 @@ static void decode_tlv(unsigned int spac
|
||||
}
|
||||
} else {
|
||||
printf("min=");
|
||||
- print_dB(tlv[2]);
|
||||
+ print_dB((int)tlv[2]);
|
||||
printf(",max=");
|
||||
- print_dB(tlv[3]);
|
||||
+ print_dB((int)tlv[3]);
|
||||
}
|
||||
break;
|
||||
#endif
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 1 08:04:39 CET 2013 - tiwai@suse.de
|
||||
|
||||
- Backport a few fix patches from upstream git tree:
|
||||
0012-aplay-Add-the-support-for-big-endian-WAV-format-RIFX.patch
|
||||
0013-configure-Fix-obsolete-AM_CONFIG_HEADER-macro.patch
|
||||
0014-speaker-test-increase-the-maximum-supported-rate-to-.patch
|
||||
0015-amixer-Fix-dB-value-outputs-in-amixer-contents.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 1 11:14:26 CET 2012 - tiwai@suse.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package alsa-utils
|
||||
#
|
||||
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -68,6 +68,10 @@ Patch8: 0008-amixer-fix-rounding-of-relative-changes.patch
|
||||
Patch9: 0009-amixer-Fix-parsing-container-TLV-entries.patch
|
||||
Patch10: 0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch
|
||||
Patch11: 0011-alsaloop-Fix-missing-endif.patch
|
||||
Patch12: 0012-aplay-Add-the-support-for-big-endian-WAV-format-RIFX.patch
|
||||
Patch13: 0013-configure-Fix-obsolete-AM_CONFIG_HEADER-macro.patch
|
||||
Patch14: 0014-speaker-test-increase-the-maximum-supported-rate-to-.patch
|
||||
Patch15: 0015-amixer-Fix-dB-value-outputs-in-amixer-contents.patch
|
||||
#
|
||||
Patch99: alsa-utils-gettext-version-removal.diff
|
||||
Url: http://www.alsa-project.org/
|
||||
@ -94,6 +98,10 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%if %suse_version < 1020
|
||||
%patch99 -p1
|
||||
%endif
|
||||
|
Loading…
Reference in New Issue
Block a user