forked from pool/alsa-utils
Accepting request 163762 from home:tiwai:branches:multimedia:libs
- Update to version 1.0.27: including all previous fixes; all 00*-* patches dropped * Add support for alsactl daemon mode * Add snd_pcm_abort() support in aplay OBS-URL: https://build.opensuse.org/request/show/163762 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=71
This commit is contained in:
parent
0a874f0c1f
commit
40fd19911f
@ -1,245 +0,0 @@
|
||||
From 951cb2c2974293db6e12ef067ae7001074887932 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Tue, 11 Sep 2012 11:36:45 +0200
|
||||
Subject: [PATCH 1/5] speaker-test: Add support for channel mapping API
|
||||
|
||||
The surround channel map follows the given channel map from the
|
||||
driver if available.
|
||||
|
||||
Also, the channels can be specified manually via -m option.
|
||||
Pass the channel map like "FL,FR,FC,LFE".
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
speaker-test/speaker-test.c | 139 +++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 124 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/speaker-test/speaker-test.c
|
||||
+++ b/speaker-test/speaker-test.c
|
||||
@@ -60,6 +60,10 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
+#ifdef SND_CHMAP_API_VERSION
|
||||
+#define CONFIG_SUPPORT_CHMAP 1
|
||||
+#endif
|
||||
+
|
||||
enum {
|
||||
TEST_PINK_NOISE = 1,
|
||||
TEST_SINE,
|
||||
@@ -100,6 +104,11 @@ static const char *given_test_wav_file =
|
||||
static char *wav_file_dir = SOUNDSDIR;
|
||||
static int debug = 0;
|
||||
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+static snd_pcm_chmap_t *channel_map;
|
||||
+static int channel_map_set;
|
||||
+#endif
|
||||
+
|
||||
static const char *const channel_name[MAX_CHANNELS] = {
|
||||
/* 0 */ N_("Front Left"),
|
||||
/* 1 */ N_("Front Right"),
|
||||
@@ -143,6 +152,65 @@ static const int channels8[] = {
|
||||
6, /* Side Left */
|
||||
5, /* LFE */
|
||||
};
|
||||
+
|
||||
+static int get_mapped_channel(int chn)
|
||||
+{
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ static const int maps[MAX_CHANNELS] = {
|
||||
+ SND_CHMAP_FL,
|
||||
+ SND_CHMAP_FR,
|
||||
+ SND_CHMAP_RL,
|
||||
+ SND_CHMAP_RR,
|
||||
+ SND_CHMAP_FC,
|
||||
+ SND_CHMAP_LFE,
|
||||
+ SND_CHMAP_SL,
|
||||
+ SND_CHMAP_SR,
|
||||
+ };
|
||||
+
|
||||
+ if (channel_map && maps[chn]) {
|
||||
+ int i;
|
||||
+ for (i = 0; i < channel_map->channels; i++) {
|
||||
+ if (channel_map->pos[i] == maps[chn])
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+ return chn;
|
||||
+}
|
||||
+
|
||||
+static int get_speaker_channel(int chn)
|
||||
+{
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ if (channel_map_set)
|
||||
+ return chn;
|
||||
+#endif
|
||||
+
|
||||
+ switch (channels) {
|
||||
+ case 4:
|
||||
+ chn = channels4[chn];
|
||||
+ break;
|
||||
+ case 6:
|
||||
+ chn = channels6[chn];
|
||||
+ break;
|
||||
+ case 8:
|
||||
+ chn = channels8[chn];
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return get_mapped_channel(chn);
|
||||
+}
|
||||
+
|
||||
+static const char *get_channel_name(int chn)
|
||||
+{
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ if (channel_map_set && chn < channel_map->channels) {
|
||||
+ const char *name = snd_pcm_chmap_long_name(channel_map->pos[chn]);
|
||||
+ return name ? name : "Unknown";
|
||||
+ }
|
||||
+#endif
|
||||
+ return gettext(channel_name[chn]);
|
||||
+}
|
||||
+
|
||||
static const int supported_formats[] = {
|
||||
SND_PCM_FORMAT_S8,
|
||||
SND_PCM_FORMAT_S16_LE,
|
||||
@@ -519,6 +587,31 @@ static int set_swparams(snd_pcm_t *handl
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+static int config_chmap(snd_pcm_t *handle, const char *mapstr)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ if (mapstr) {
|
||||
+ channel_map = snd_pcm_chmap_parse_string(mapstr);
|
||||
+ if (!channel_map) {
|
||||
+ fprintf(stderr, _("Unable to parse channel map string: %s\n"), mapstr);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ err = snd_pcm_set_chmap(handle, channel_map);
|
||||
+ if (err < 0) {
|
||||
+ fprintf(stderr, _("Unable to set channel map: %s\n"), mapstr);
|
||||
+ return err;
|
||||
+ }
|
||||
+ channel_map_set = 1;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ channel_map = snd_pcm_get_chmap(handle);
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Underrun and suspend recovery
|
||||
*/
|
||||
@@ -815,6 +908,7 @@ static void help(void)
|
||||
"-s,--speaker single speaker test. Values 1=Left, 2=right, etc\n"
|
||||
"-w,--wavfile Use the given WAV file as a test sound\n"
|
||||
"-W,--wavdir Specify the directory containing WAV files\n"
|
||||
+ "-m,--chmap Specify the channel map to override\n"
|
||||
"\n"));
|
||||
printf(_("Recognized sample formats are:"));
|
||||
for (fmt = supported_formats; *fmt >= 0; fmt++) {
|
||||
@@ -837,6 +931,9 @@ int main(int argc, char *argv[]) {
|
||||
double time1,time2,time3;
|
||||
unsigned int n, nloops;
|
||||
struct timeval tv1,tv2;
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ const char *chmap = NULL;
|
||||
+#endif
|
||||
|
||||
static const struct option long_option[] = {
|
||||
{"help", 0, NULL, 'h'},
|
||||
@@ -854,6 +951,9 @@ int main(int argc, char *argv[]) {
|
||||
{"wavfile", 1, NULL, 'w'},
|
||||
{"wavdir", 1, NULL, 'W'},
|
||||
{"debug", 0, NULL, 'd'},
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ {"chmap", 1, NULL, 'm'},
|
||||
+#endif
|
||||
{NULL, 0, NULL, 0 },
|
||||
};
|
||||
|
||||
@@ -872,7 +972,11 @@ int main(int argc, char *argv[]) {
|
||||
while (1) {
|
||||
int c;
|
||||
|
||||
- if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d", long_option, NULL)) < 0)
|
||||
+ if ((c = getopt_long(argc, argv, "hD:r:c:f:F:b:p:P:t:l:s:w:W:d"
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ "m:"
|
||||
+#endif
|
||||
+ , long_option, NULL)) < 0)
|
||||
break;
|
||||
|
||||
switch (c) {
|
||||
@@ -963,6 +1067,11 @@ int main(int argc, char *argv[]) {
|
||||
case 'd':
|
||||
debug = 1;
|
||||
break;
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ case 'm':
|
||||
+ chmap = optarg;
|
||||
+ break;
|
||||
+#endif
|
||||
default:
|
||||
fprintf(stderr, _("Unknown option '%c'\n"), c);
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -1008,6 +1117,13 @@ int main(int argc, char *argv[]) {
|
||||
snd_pcm_close(handle);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
+
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ err = config_chmap(handle, chmap);
|
||||
+ if (err < 0)
|
||||
+ exit(EXIT_FAILURE);
|
||||
+#endif
|
||||
+
|
||||
if (debug) {
|
||||
snd_output_t *log;
|
||||
err = snd_output_stdio_attach(&log, stderr, 0);
|
||||
@@ -1038,17 +1154,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
gettimeofday(&tv1, NULL);
|
||||
for(chn = 0; chn < channels; chn++) {
|
||||
- int channel=chn;
|
||||
- if (channels == 4) {
|
||||
- channel=channels4[chn];
|
||||
- }
|
||||
- if (channels == 6) {
|
||||
- channel=channels6[chn];
|
||||
- }
|
||||
- if (channels == 8) {
|
||||
- channel=channels8[chn];
|
||||
- }
|
||||
- printf(" %d - %s\n", channel, gettext(channel_name[channel]));
|
||||
+ int channel = get_speaker_channel(chn);
|
||||
+ printf(" %d - %s\n", channel, get_channel_name(channel));
|
||||
|
||||
err = write_loop(handle, channel, ((rate*3)/period_size), frames);
|
||||
|
||||
@@ -1066,13 +1173,15 @@ int main(int argc, char *argv[]) {
|
||||
printf(_("Time per period = %lf\n"), time3 );
|
||||
}
|
||||
} else {
|
||||
+ chn = get_speaker_channel(speaker - 1);
|
||||
+
|
||||
if (test_type == TEST_WAV) {
|
||||
- if (setup_wav_file(speaker - 1) < 0)
|
||||
+ if (setup_wav_file(chn) < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
- printf(" - %s\n", gettext(channel_name[speaker-1]));
|
||||
- err = write_loop(handle, speaker-1, ((rate*5)/period_size), frames);
|
||||
+ printf(" - %s\n", get_channel_name(chn));
|
||||
+ err = write_loop(handle, chn, ((rate*5)/period_size), frames);
|
||||
|
||||
if (err < 0) {
|
||||
fprintf(stderr, _("Transfer failed: %s\n"), snd_strerror(err));
|
@ -1,106 +0,0 @@
|
||||
From a9add2252f44fae3eb0ce5470cb842f220fb0454 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Tue, 11 Sep 2012 12:20:55 +0200
|
||||
Subject: [PATCH 2/5] aplay: Add support for channel mapping
|
||||
|
||||
With -m option, user can specify the order of channel map.
|
||||
As of this commit, it just tries to override the channel map, thus it
|
||||
works only on devices that support the channel map override like HDMI.
|
||||
Adjusting the channel order in aplay itself will be added later.
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
aplay/aplay.c | 40 ++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 38 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/aplay/aplay.c
|
||||
+++ b/aplay/aplay.c
|
||||
@@ -54,6 +54,10 @@
|
||||
#include "formats.h"
|
||||
#include "version.h"
|
||||
|
||||
+#ifdef SND_CHMAP_API_VERSION
|
||||
+#define CONFIG_SUPPORT_CHMAP 1
|
||||
+#endif
|
||||
+
|
||||
#ifndef LLONG_MAX
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#endif
|
||||
@@ -140,6 +144,10 @@ static char *pidfile_name = NULL;
|
||||
FILE *pidf = NULL;
|
||||
static int pidfile_written = 0;
|
||||
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+static snd_pcm_chmap_t *channel_map = NULL;
|
||||
+#endif
|
||||
+
|
||||
/* needed prototypes */
|
||||
|
||||
static void done_stdin(void);
|
||||
@@ -227,7 +235,9 @@ _("Usage: %s [OPTION]... [FILE]...\n"
|
||||
" --process-id-file write the process ID here\n"
|
||||
" --use-strftime apply the strftime facility to the output file name\n"
|
||||
" --dump-hw-params dump hw_params of the device\n"
|
||||
-" --fatal-errors treat all errors as fatal\n")
|
||||
+" --fatal-errors treat all errors as fatal\n"
|
||||
+"-m, --chmap=ch1,ch2,.. Give the channel map to override\n"
|
||||
+ )
|
||||
, command);
|
||||
printf(_("Recognized sample formats are:"));
|
||||
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
|
||||
@@ -428,7 +438,11 @@ enum {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int option_index;
|
||||
- static const char short_options[] = "hnlLD:qt:c:f:r:d:MNF:A:R:T:B:vV:IPCi";
|
||||
+ static const char short_options[] = "hnlLD:qt:c:f:r:d:MNF:A:R:T:B:vV:IPCi"
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ "m:"
|
||||
+#endif
|
||||
+ ;
|
||||
static const struct option long_options[] = {
|
||||
{"help", 0, 0, 'h'},
|
||||
{"version", 0, 0, OPT_VERSION},
|
||||
@@ -469,6 +483,9 @@ int main(int argc, char *argv[])
|
||||
{"interactive", 0, 0, 'i'},
|
||||
{"dump-hw-params", 0, 0, OPT_DUMP_HWPARAMS},
|
||||
{"fatal-errors", 0, 0, OPT_FATAL_ERRORS},
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ {"chmap", 1, 0, 'm'},
|
||||
+#endif
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
char *pcm_name = "default";
|
||||
@@ -676,6 +693,15 @@ int main(int argc, char *argv[])
|
||||
case OPT_FATAL_ERRORS:
|
||||
fatal_errors = 1;
|
||||
break;
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ case 'm':
|
||||
+ channel_map = snd_pcm_chmap_parse_string(optarg);
|
||||
+ if (!channel_map) {
|
||||
+ fprintf(stderr, _("Unable to parse channel map string: %s\n"), optarg);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ break;
|
||||
+#endif
|
||||
default:
|
||||
fprintf(stderr, _("Try `%s --help' for more information.\n"), command);
|
||||
return 1;
|
||||
@@ -1206,6 +1232,16 @@ static void set_params(void)
|
||||
prg_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+ if (channel_map) {
|
||||
+ err = snd_pcm_set_chmap(handle, channel_map);
|
||||
+ if (err < 0) {
|
||||
+ error(_("Unable to set channel map"));
|
||||
+ prg_exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
if (verbose)
|
||||
snd_pcm_dump(handle, log);
|
||||
|
@ -1,244 +0,0 @@
|
||||
From 000bf230cfb3b0abe88d27701dd77982675126ec Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Thu, 20 Sep 2012 13:53:46 +0200
|
||||
Subject: [PATCH 3/5] aplay: More support for channel map option
|
||||
|
||||
Now aplay tries to follow the given channel map by rearranging the
|
||||
channels even when the channel map override isn't allowed but if the
|
||||
device is still capable to return a channel map.
|
||||
|
||||
Also update the man page appropriately.
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
aplay/aplay.1 | 11 ++++
|
||||
aplay/aplay.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
2 files changed, 149 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/aplay/aplay.1
|
||||
+++ b/aplay/aplay.1
|
||||
@@ -141,6 +141,17 @@ by typing arecord.
|
||||
Allow interactive operation via stdin.
|
||||
Currently only pause/resume via space or enter key is implemented.
|
||||
.TP
|
||||
+\fI-m, \-\-chmap=ch1,ch2,...\fP
|
||||
+Give the channel map to override or follow. Pass channel position
|
||||
+strings like \fIFL\fP, \fIFR\fP, etc.
|
||||
+
|
||||
+If a device supports the override of the channel map, \fBaplay\fP
|
||||
+tries to pass the given channel map.
|
||||
+If it doesn't support the channel map override but still it provides
|
||||
+the channel map information, \fBaplay\fP tries to rearrange the
|
||||
+channel order in the buffer to match with the returned channel map
|
||||
+from the device.
|
||||
+.TP
|
||||
\fI\-\-disable\-resample\fP
|
||||
Disable automatic rate resample.
|
||||
.TP
|
||||
--- a/aplay/aplay.c
|
||||
+++ b/aplay/aplay.c
|
||||
@@ -145,7 +145,8 @@ FILE *pidf = NULL;
|
||||
static int pidfile_written = 0;
|
||||
|
||||
#ifdef CONFIG_SUPPORT_CHMAP
|
||||
-static snd_pcm_chmap_t *channel_map = NULL;
|
||||
+static snd_pcm_chmap_t *channel_map = NULL; /* chmap to override */
|
||||
+static unsigned int *hw_map = NULL; /* chmap to follow */
|
||||
#endif
|
||||
|
||||
/* needed prototypes */
|
||||
@@ -222,6 +223,7 @@ _("Usage: %s [OPTION]... [FILE]...\n"
|
||||
"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n"
|
||||
"-I, --separate-channels one file for each channel\n"
|
||||
"-i, --interactive allow interactive operation from stdin\n"
|
||||
+"-m, --chmap=ch1,ch2,.. Give the channel map to override or follow\n"
|
||||
" --disable-resample disable automatic rate resample\n"
|
||||
" --disable-channels disable automatic channel conversions\n"
|
||||
" --disable-format disable automatic format conversions\n"
|
||||
@@ -236,7 +238,6 @@ _("Usage: %s [OPTION]... [FILE]...\n"
|
||||
" --use-strftime apply the strftime facility to the output file name\n"
|
||||
" --dump-hw-params dump hw_params of the device\n"
|
||||
" --fatal-errors treat all errors as fatal\n"
|
||||
-"-m, --chmap=ch1,ch2,.. Give the channel map to override\n"
|
||||
)
|
||||
, command);
|
||||
printf(_("Recognized sample formats are:"));
|
||||
@@ -1083,6 +1084,74 @@ static void show_available_sample_format
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+static int setup_chmap(void)
|
||||
+{
|
||||
+ snd_pcm_chmap_t *chmap = channel_map;
|
||||
+ char mapped[hwparams.channels];
|
||||
+ snd_pcm_chmap_t *hw_chmap;
|
||||
+ unsigned int ch, i;
|
||||
+ int err;
|
||||
+
|
||||
+ if (!chmap)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (chmap->channels != hwparams.channels) {
|
||||
+ error(_("Channel numbers don't match between hw_params and channel map"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ err = snd_pcm_set_chmap(handle, chmap);
|
||||
+ if (!err)
|
||||
+ return 0;
|
||||
+
|
||||
+ hw_chmap = snd_pcm_get_chmap(handle);
|
||||
+ if (!hw_chmap) {
|
||||
+ fprintf(stderr, _("Warning: unable to get channel map\n"));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (hw_chmap->channels == chmap->channels &&
|
||||
+ !memcmp(hw_chmap, chmap, 4 * (chmap->channels + 1))) {
|
||||
+ /* maps are identical, so no need to convert */
|
||||
+ free(hw_chmap);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ hw_map = calloc(hwparams.channels, sizeof(int));
|
||||
+ if (!hw_map) {
|
||||
+ error(_("not enough memory"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ memset(mapped, 0, sizeof(mapped));
|
||||
+ for (ch = 0; ch < hw_chmap->channels; ch++) {
|
||||
+ if (chmap->pos[ch] == hw_chmap->pos[ch]) {
|
||||
+ mapped[ch] = 1;
|
||||
+ hw_map[ch] = ch;
|
||||
+ continue;
|
||||
+ }
|
||||
+ for (i = 0; i < hw_chmap->channels; i++) {
|
||||
+ if (!mapped[i] && chmap->pos[ch] == hw_chmap->pos[i]) {
|
||||
+ mapped[i] = 1;
|
||||
+ hw_map[ch] = i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (i >= hw_chmap->channels) {
|
||||
+ char buf[256];
|
||||
+ error(_("Channel %d doesn't match with hw_parmas"), ch);
|
||||
+ snd_pcm_chmap_print(hw_chmap, sizeof(buf), buf);
|
||||
+ fprintf(stderr, "hardware chmap = %s\n", buf);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ free(hw_chmap);
|
||||
+ return 0;
|
||||
+}
|
||||
+#else
|
||||
+#define setup_chmap() 0
|
||||
+#endif
|
||||
+
|
||||
static void set_params(void)
|
||||
{
|
||||
snd_pcm_hw_params_t *params;
|
||||
@@ -1232,15 +1301,8 @@ static void set_params(void)
|
||||
prg_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
-#ifdef CONFIG_SUPPORT_CHMAP
|
||||
- if (channel_map) {
|
||||
- err = snd_pcm_set_chmap(handle, channel_map);
|
||||
- if (err < 0) {
|
||||
- error(_("Unable to set channel map"));
|
||||
- prg_exit(EXIT_FAILURE);
|
||||
- }
|
||||
- }
|
||||
-#endif
|
||||
+ if (setup_chmap())
|
||||
+ prg_exit(EXIT_FAILURE);
|
||||
|
||||
if (verbose)
|
||||
snd_pcm_dump(handle, log);
|
||||
@@ -1743,6 +1805,69 @@ static void do_test_position(void)
|
||||
}
|
||||
|
||||
/*
|
||||
+ */
|
||||
+#ifdef CONFIG_SUPPORT_CHMAP
|
||||
+static u_char *remap_data(u_char *data, size_t count)
|
||||
+{
|
||||
+ static u_char *tmp, *src, *dst;
|
||||
+ static size_t tmp_size;
|
||||
+ size_t sample_bytes = bits_per_sample / 8;
|
||||
+ size_t step = bits_per_frame / 8;
|
||||
+ size_t chunk_bytes;
|
||||
+ unsigned int ch, i;
|
||||
+
|
||||
+ if (!hw_map)
|
||||
+ return data;
|
||||
+
|
||||
+ chunk_bytes = count * bits_per_frame / 8;
|
||||
+ if (tmp_size < chunk_bytes) {
|
||||
+ free(tmp);
|
||||
+ tmp = malloc(chunk_bytes);
|
||||
+ if (!tmp) {
|
||||
+ error(_("not enough memory"));
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ tmp_size = count;
|
||||
+ }
|
||||
+
|
||||
+ src = data;
|
||||
+ dst = tmp;
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ for (ch = 0; ch < hwparams.channels; ch++) {
|
||||
+ memcpy(dst, src + sample_bytes * hw_map[ch],
|
||||
+ sample_bytes);
|
||||
+ dst += sample_bytes;
|
||||
+ }
|
||||
+ src += step;
|
||||
+ }
|
||||
+ return tmp;
|
||||
+}
|
||||
+
|
||||
+static u_char **remap_datav(u_char **data, size_t count)
|
||||
+{
|
||||
+ static u_char **tmp;
|
||||
+ unsigned int ch;
|
||||
+
|
||||
+ if (!hw_map)
|
||||
+ return data;
|
||||
+
|
||||
+ if (!tmp) {
|
||||
+ tmp = malloc(sizeof(*tmp) * hwparams.channels);
|
||||
+ if (!tmp) {
|
||||
+ error(_("not enough memory"));
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ for (ch = 0; ch < hwparams.channels; ch++)
|
||||
+ tmp[ch] = data[hw_map[ch]];
|
||||
+ }
|
||||
+ return tmp;
|
||||
+}
|
||||
+#else
|
||||
+#define remap_data(data, count) (data)
|
||||
+#define remapv_data(data, count) (data)
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
* write function
|
||||
*/
|
||||
|
||||
@@ -1755,6 +1880,7 @@ static ssize_t pcm_write(u_char *data, s
|
||||
snd_pcm_format_set_silence(hwparams.format, data + count * bits_per_frame / 8, (chunk_size - count) * hwparams.channels);
|
||||
count = chunk_size;
|
||||
}
|
||||
+ data = remap_data(data, count);
|
||||
while (count > 0) {
|
||||
if (test_position)
|
||||
do_test_position();
|
||||
@@ -1797,6 +1923,7 @@ static ssize_t pcm_writev(u_char **data,
|
||||
snd_pcm_format_set_silence(hwparams.format, data[channel] + offset * bits_per_sample / 8, remaining);
|
||||
count = chunk_size;
|
||||
}
|
||||
+ data = remap_datav(data, count);
|
||||
while (count > 0) {
|
||||
unsigned int channel;
|
||||
void *bufs[channels];
|
@ -1,35 +0,0 @@
|
||||
From 7b14c00b56784f69ecc954a2de36e0a058fc8849 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Thu, 20 Sep 2012 14:00:02 +0200
|
||||
Subject: [PATCH 4/5] speaker-test: Update man page for chmap option
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
speaker-test/speaker-test.1 | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
--- a/speaker-test/speaker-test.1
|
||||
+++ b/speaker-test/speaker-test.1
|
||||
@@ -131,6 +131,11 @@ Use the given WAV file for the playback
|
||||
Specify the directory containing WAV files for playback.
|
||||
The default path is \fI/usr/share/sounds/alsa\fP.
|
||||
|
||||
+.TP
|
||||
+\fB\-m\fP | \fB\-\-chmap\fP
|
||||
+Pass the channel map to override.
|
||||
+If the playback in a specific channel order or channel positions is
|
||||
+required, pass the channel position strings to this option.
|
||||
|
||||
.SH USAGE EXAMPLES
|
||||
|
||||
@@ -159,6 +164,10 @@ To do a 2-speaker test using the spdif (
|
||||
speaker-test -Dplug:spdif -c2
|
||||
.EE
|
||||
|
||||
+Play in the order of front-right and front-left from the front PCM
|
||||
+.EX
|
||||
+ speaker-test -Dplug:front -c2 -mFR,FL
|
||||
+.EE
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR aplay(1)
|
@ -1,44 +0,0 @@
|
||||
From 6017849f1b9d406ac2c882ddbde408ada38c3d61 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Mon, 24 Sep 2012 16:18:54 +0200
|
||||
Subject: [PATCH 5/5] aplay: fix typo & silence warning..
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
aplay/aplay.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/aplay/aplay.c
|
||||
+++ b/aplay/aplay.c
|
||||
@@ -1864,7 +1864,7 @@ static u_char **remap_datav(u_char **dat
|
||||
}
|
||||
#else
|
||||
#define remap_data(data, count) (data)
|
||||
-#define remapv_data(data, count) (data)
|
||||
+#define remap_datav(data, count) (data)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -2122,7 +2122,6 @@ static void voc_play(int fd, int ofs, ch
|
||||
u_char *data, *buf;
|
||||
char was_extended = 0, output = 0;
|
||||
u_short *sp, repeat = 0;
|
||||
- size_t silence;
|
||||
off64_t filepos = 0;
|
||||
|
||||
#define COUNT(x) nextblock -= x; in_buffer -= x; data += x
|
||||
@@ -2226,9 +2225,12 @@ static void voc_play(int fd, int ofs, ch
|
||||
COUNT1(1);
|
||||
hwparams.rate = 1000000 / (256 - hwparams.rate);
|
||||
set_params();
|
||||
- silence = (((size_t) * sp) * 1000) / hwparams.rate;
|
||||
#if 0
|
||||
- d_printf("Silence for %d ms\n", (int) silence);
|
||||
+ {
|
||||
+ size_t silence;
|
||||
+ silence = (((size_t) * sp) * 1000) / hwparams.rate;
|
||||
+ d_printf("Silence for %d ms\n", (int) silence);
|
||||
+ }
|
||||
#endif
|
||||
voc_write_silence(*sp);
|
||||
break;
|
@ -1,106 +0,0 @@
|
||||
From f2826072732951b1d4e1bacd8115f9e6a98932d5 Mon Sep 17 00:00:00 2001
|
||||
From: Clemens Ladisch <clemens@ladisch.de>
|
||||
Date: Fri, 19 Oct 2012 12:16:33 +0200
|
||||
Subject: [PATCH 6/9] alsamixer: fix handling of removed controls
|
||||
|
||||
When we get a notification that an element has been removed, we have to
|
||||
recreate our internal control representation to avoid accessing freed
|
||||
memory. (And the checking for SND_CTL_EVENT_MASK_REMOVE should actually
|
||||
be done correctly while we're at it.)
|
||||
|
||||
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
|
||||
---
|
||||
alsamixer/mainloop.c | 9 ++++++++-
|
||||
alsamixer/mixer_display.c | 1 -
|
||||
alsamixer/mixer_widget.c | 20 ++++++++------------
|
||||
alsamixer/mixer_widget.h | 1 +
|
||||
4 files changed, 17 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/alsamixer/mainloop.c b/alsamixer/mainloop.c
|
||||
index dbfef9b..351f57f 100644
|
||||
--- a/alsamixer/mainloop.c
|
||||
+++ b/alsamixer/mainloop.c
|
||||
@@ -128,8 +128,15 @@ void mainloop(void)
|
||||
}
|
||||
if (!active_widget)
|
||||
break;
|
||||
- if (controls_changed)
|
||||
+ if (controls_changed) {
|
||||
+ controls_changed = FALSE;
|
||||
+ create_controls();
|
||||
+ control_values_changed = FALSE;
|
||||
display_controls();
|
||||
+ } else if (control_values_changed) {
|
||||
+ control_values_changed = FALSE;
|
||||
+ display_controls();
|
||||
+ }
|
||||
}
|
||||
free(pollfds);
|
||||
}
|
||||
diff --git a/alsamixer/mixer_display.c b/alsamixer/mixer_display.c
|
||||
index 8ba396a..b1f79d0 100644
|
||||
--- a/alsamixer/mixer_display.c
|
||||
+++ b/alsamixer/mixer_display.c
|
||||
@@ -657,7 +657,6 @@ void display_controls(void)
|
||||
display_no_controls();
|
||||
}
|
||||
display_scroll_indicators();
|
||||
- controls_changed = FALSE;
|
||||
}
|
||||
|
||||
void compute_controls_layout(void)
|
||||
diff --git a/alsamixer/mixer_widget.c b/alsamixer/mixer_widget.c
|
||||
index caaf777..0c2b9e0 100644
|
||||
--- a/alsamixer/mixer_widget.c
|
||||
+++ b/alsamixer/mixer_widget.c
|
||||
@@ -50,6 +50,7 @@ int focus_control_index;
|
||||
snd_mixer_selem_id_t *current_selem_id;
|
||||
unsigned int current_control_flags;
|
||||
|
||||
+bool control_values_changed;
|
||||
bool controls_changed;
|
||||
|
||||
enum channel_mask {
|
||||
@@ -59,20 +60,15 @@ enum channel_mask {
|
||||
|
||||
static int elem_callback(snd_mixer_elem_t *elem, unsigned int mask)
|
||||
{
|
||||
- unsigned int i;
|
||||
-
|
||||
- if (mask & (SND_CTL_EVENT_MASK_REMOVE |
|
||||
- SND_CTL_EVENT_MASK_INFO |
|
||||
- SND_CTL_EVENT_MASK_VALUE))
|
||||
+ if (mask == SND_CTL_EVENT_MASK_REMOVE) {
|
||||
controls_changed = TRUE;
|
||||
+ } else {
|
||||
+ if (mask & SND_CTL_EVENT_MASK_VALUE)
|
||||
+ control_values_changed = TRUE;
|
||||
|
||||
- if (mask & SND_CTL_EVENT_MASK_INFO)
|
||||
- for (i = 0; i < controls_count; ++i)
|
||||
- if (controls[i].elem == elem) {
|
||||
- controls[i].flags &= ~IS_ACTIVE;
|
||||
- if (snd_mixer_selem_is_active(controls[i].elem))
|
||||
- controls[i].flags |= IS_ACTIVE;
|
||||
- }
|
||||
+ if (mask & SND_CTL_EVENT_MASK_INFO)
|
||||
+ controls_changed = TRUE;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/alsamixer/mixer_widget.h b/alsamixer/mixer_widget.h
|
||||
index da8628e..086611c 100644
|
||||
--- a/alsamixer/mixer_widget.h
|
||||
+++ b/alsamixer/mixer_widget.h
|
||||
@@ -24,6 +24,7 @@ extern int focus_control_index;
|
||||
extern snd_mixer_selem_id_t *current_selem_id;
|
||||
extern unsigned int current_control_flags;
|
||||
|
||||
+extern bool control_values_changed;
|
||||
extern bool controls_changed;
|
||||
|
||||
void create_mixer_object(struct snd_mixer_selem_regopt *selem_regopt);
|
||||
--
|
||||
1.8.0.1
|
||||
|
@ -1,52 +0,0 @@
|
||||
From c6614dbdab1cbe541e7d6cd29f3922510e0b6981 Mon Sep 17 00:00:00 2001
|
||||
From: Fabio Estevam <fabio.estevam@freescale.com>
|
||||
Date: Tue, 13 Nov 2012 10:05:39 -0200
|
||||
Subject: [PATCH 7/9] aplay: Show usage if no parameter is passed
|
||||
|
||||
When aplay/arecord are called without any argument the application hangs forever.
|
||||
|
||||
Instead of hanging, print the usage and exit.
|
||||
|
||||
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
aplay/aplay.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/aplay/aplay.c b/aplay/aplay.c
|
||||
index 741979a..f35f603 100644
|
||||
--- a/aplay/aplay.c
|
||||
+++ b/aplay/aplay.c
|
||||
@@ -493,6 +493,7 @@ int main(int argc, char *argv[])
|
||||
int tmp, err, c;
|
||||
int do_device_list = 0, do_pcm_list = 0;
|
||||
snd_pcm_info_t *info;
|
||||
+ FILE *direction;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -511,14 +512,21 @@ int main(int argc, char *argv[])
|
||||
file_type = FORMAT_WAVE;
|
||||
command = "arecord";
|
||||
start_delay = 1;
|
||||
+ direction = stdout;
|
||||
} else if (strstr(argv[0], "aplay")) {
|
||||
stream = SND_PCM_STREAM_PLAYBACK;
|
||||
command = "aplay";
|
||||
+ direction = stdin;
|
||||
} else {
|
||||
error(_("command should be named either arecord or aplay"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ if (isatty(fileno(direction)) && (argc == 1)) {
|
||||
+ usage(command);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
chunk_size = -1;
|
||||
rhwparams.format = DEFAULT_FORMAT;
|
||||
rhwparams.rate = DEFAULT_SPEED;
|
||||
--
|
||||
1.8.0.1
|
||||
|
@ -1,35 +0,0 @@
|
||||
From da1c24a24c699125aedc8d4f7c97d974b868dacf Mon Sep 17 00:00:00 2001
|
||||
From: Clemens Ladisch <clemens@ladisch.de>
|
||||
Date: Tue, 13 Nov 2012 21:54:20 +0100
|
||||
Subject: [PATCH 8/9] amixer: fix rounding of relative changes
|
||||
|
||||
When doing control changes by a relative amount, amixer used the wrong
|
||||
rounding direction, which would make it possible to stay at the same raw
|
||||
value if the step was not big enough to reach the next value.
|
||||
|
||||
Reported-by: Honza Javorek <jan.javorek@gmail.com>
|
||||
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
|
||||
---
|
||||
amixer/amixer.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/amixer/amixer.c b/amixer/amixer.c
|
||||
index a0a7387..48ed1b2 100644
|
||||
--- a/amixer/amixer.c
|
||||
+++ b/amixer/amixer.c
|
||||
@@ -425,10 +425,10 @@ static int set_volume_simple(snd_mixer_elem_t *elem,
|
||||
invalid = 1;
|
||||
if (*p == '+') {
|
||||
val = orig + val;
|
||||
- correct = -1;
|
||||
+ correct = 1;
|
||||
} else {
|
||||
val = orig - val;
|
||||
- correct = 1;
|
||||
+ correct = -1;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
--
|
||||
1.8.0.1
|
||||
|
@ -1,29 +0,0 @@
|
||||
From d6da86117bddeb5007058bfd599c4839858c7ca9 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Mon, 26 Nov 2012 16:13:57 +0100
|
||||
Subject: [PATCH 9/9] amixer: Fix parsing container TLV entries
|
||||
|
||||
Fix the wrong calculation of the size of a container TLV entry, which
|
||||
resulted in "TLV size error" messages.
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
amixer/amixer.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/amixer/amixer.c b/amixer/amixer.c
|
||||
index 48ed1b2..5d5afce 100644
|
||||
--- a/amixer/amixer.c
|
||||
+++ b/amixer/amixer.c
|
||||
@@ -531,7 +531,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_
|
||||
printf("TLV size error in compound!\n");
|
||||
return;
|
||||
}
|
||||
- decode_tlv(spaces + 2, tlv + idx, tlv[idx+1]);
|
||||
+ decode_tlv(spaces + 2, tlv + idx, tlv[idx+1] + 8);
|
||||
idx += 2 + (tlv[1] + sizeof(unsigned int) - 1) / sizeof(unsigned int);
|
||||
}
|
||||
break;
|
||||
--
|
||||
1.8.0.1
|
||||
|
@ -1,60 +0,0 @@
|
||||
From b7ea343820a4616b5f6e3b200f776ab742893039 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Fri, 30 Nov 2012 14:35:31 +0100
|
||||
Subject: [PATCH] alsaloop: Make alsaloop working without libsamplerate
|
||||
|
||||
When alsaloop is built with libsamplerate, it quits immediately with
|
||||
No libsamplerate suppor
|
||||
message. It's because the check of -A option and it's set as default
|
||||
non-zero value.
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
alsaloop/alsaloop.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c
|
||||
index 8710dd1..6e94564 100644
|
||||
--- a/alsaloop/alsaloop.c
|
||||
+++ b/alsaloop/alsaloop.c
|
||||
@@ -387,7 +387,9 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
|
||||
int arg_nblock = 0;
|
||||
int arg_effect = 0;
|
||||
int arg_resample = 0;
|
||||
+#ifdef USE_SAMPLERATE
|
||||
int arg_samplerate = SRC_SINC_FASTEST + 1;
|
||||
+#else
|
||||
int arg_sync = SYNC_TYPE_AUTO;
|
||||
int arg_slave = SLAVE_TYPE_AUTO;
|
||||
int arg_thread = 0;
|
||||
@@ -474,6 +476,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
|
||||
case 'n':
|
||||
arg_resample = 1;
|
||||
break;
|
||||
+#ifdef USE_SAMPLERATE
|
||||
case 'A':
|
||||
if (strcasecmp(optarg, "sincbest") == 0)
|
||||
arg_samplerate = SRC_SINC_BEST_QUALITY;
|
||||
@@ -491,6 +494,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
|
||||
arg_sync = SRC_SINC_FASTEST;
|
||||
arg_samplerate += 1;
|
||||
break;
|
||||
+#endif
|
||||
case 'S':
|
||||
if (strcasecmp(optarg, "samplerate") == 0)
|
||||
arg_sync = SYNC_TYPE_SAMPLERATE;
|
||||
@@ -610,11 +614,6 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
|
||||
loop->src_enable = arg_samplerate > 0;
|
||||
if (loop->src_enable)
|
||||
loop->src_converter_type = arg_samplerate - 1;
|
||||
-#else
|
||||
- if (arg_samplerate > 0) {
|
||||
- logit(LOG_CRIT, "No libsamplerate support.\n");
|
||||
- exit(EXIT_FAILURE);
|
||||
- }
|
||||
#endif
|
||||
set_loop_time(loop, arg_loop_time);
|
||||
add_loop(loop);
|
||||
--
|
||||
1.8.0.1
|
||||
|
@ -1,28 +0,0 @@
|
||||
From c7b9d3e39431eddd3a205a3f583a07884a90bb1b Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Fri, 30 Nov 2012 14:53:12 +0100
|
||||
Subject: [PATCH] alsaloop: Fix missing #endif
|
||||
|
||||
Sorry, forgotten.
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
alsaloop/alsaloop.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c
|
||||
index 6e94564..e1a36d2 100644
|
||||
--- a/alsaloop/alsaloop.c
|
||||
+++ b/alsaloop/alsaloop.c
|
||||
@@ -389,7 +389,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output,
|
||||
int arg_resample = 0;
|
||||
#ifdef USE_SAMPLERATE
|
||||
int arg_samplerate = SRC_SINC_FASTEST + 1;
|
||||
-#else
|
||||
+#endif
|
||||
int arg_sync = SYNC_TYPE_AUTO;
|
||||
int arg_slave = SLAVE_TYPE_AUTO;
|
||||
int arg_thread = 0;
|
||||
--
|
||||
1.8.0.1
|
||||
|
@ -1,196 +0,0 @@
|
||||
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')
|
@ -1,28 +0,0 @@
|
||||
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
|
@ -1,26 +0,0 @@
|
||||
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);
|
@ -1,38 +0,0 @@
|
||||
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 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f85f2a3aa6e78475bbe35b0cad3a8cabb99f45ebc5f37962f2137b8df8b081e7
|
||||
size 1134474
|
3
alsa-utils-1.0.27.tar.bz2
Normal file
3
alsa-utils-1.0.27.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6f76cd77341ceb22949c4fb9d4df145483f56baa899f0621d617b8df96a45aef
|
||||
size 1142833
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 12 15:28:31 CEST 2013 - tiwai@suse.de
|
||||
|
||||
- Update to version 1.0.27:
|
||||
including all previous fixes; all 00*-* patches dropped
|
||||
* Add support for alsactl daemon mode
|
||||
* Add snd_pcm_abort() support in aplay
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 1 08:04:39 CET 2013 - tiwai@suse.de
|
||||
|
||||
|
@ -44,7 +44,7 @@ BuildRequires: libudev-devel
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: xmlto
|
||||
%define package_version 1.0.26
|
||||
%define package_version 1.0.27
|
||||
Provides: alsa-conf
|
||||
Requires: alsa
|
||||
Requires: dialog
|
||||
@ -52,27 +52,11 @@ Requires: pciutils
|
||||
Summary: Advanced Linux Sound Architecture Utilities
|
||||
License: GPL-2.0+
|
||||
Group: Productivity/Multimedia/Sound/Players
|
||||
Version: 1.0.26
|
||||
Version: 1.0.27
|
||||
Release: 0
|
||||
Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{package_version}.tar.bz2
|
||||
Source1: 01beep.conf
|
||||
# Patch: alsa-utils-git-fixes.diff
|
||||
Patch1: 0001-speaker-test-Add-support-for-channel-mapping-API.patch
|
||||
Patch2: 0002-aplay-Add-support-for-channel-mapping.patch
|
||||
Patch3: 0003-aplay-More-support-for-channel-map-option.patch
|
||||
Patch4: 0004-speaker-test-Update-man-page-for-chmap-option.patch
|
||||
Patch5: 0005-aplay-fix-typo-silence-warning.patch
|
||||
Patch6: 0006-alsamixer-fix-handling-of-removed-controls.patch
|
||||
Patch7: 0007-aplay-Show-usage-if-no-parameter-is-passed.patch
|
||||
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/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -87,21 +71,6 @@ Sound Architecture.
|
||||
sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
|
||||
# rm -f po/Makefile* po/*.gmo po/*.pot po/*.header po/stamp-*
|
||||
# patch -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%if %suse_version < 1020
|
||||
%patch99 -p1
|
||||
%endif
|
||||
@ -155,6 +124,7 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/alsa
|
||||
%{_udevdir}
|
||||
%if %use_systemd
|
||||
%{_unitdir}/*.service
|
||||
%{_unitdir}/basic.target.wants/alsa-state.service
|
||||
%{_unitdir}/basic.target.wants/alsa-restore.service
|
||||
%{_unitdir}/shutdown.target.wants/alsa-store.service
|
||||
%endif
|
||||
|
Loading…
Reference in New Issue
Block a user