From c18ae0f26b94d4bdb75b9066742a90643bc0bb9d Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 28 Jun 2014 23:36:15 +0200 Subject: [PATCH] Revert "alsa-utils: update to alsa-utils-1.0.28" This reverts commit 0c2f2be1be05dadd5f3ce4d594fffd2f871df8a0. --- packages/audio/alsa/alsa-utils/package.mk | 2 +- .../patches/alsa-utils-upstream-001.patch | 36 +++ .../patches/alsa-utils-upstream-002.patch | 42 ++++ .../patches/alsa-utils-upstream-003.patch | 232 ++++++++++++++++++ .../patches/alsa-utils-upstream-004.patch | 44 ++++ .../patches/alsa-utils-upstream-005.patch | 41 ++++ 6 files changed, 396 insertions(+), 1 deletion(-) create mode 100644 packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-001.patch create mode 100644 packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-002.patch create mode 100644 packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-003.patch create mode 100644 packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-004.patch create mode 100644 packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-005.patch diff --git a/packages/audio/alsa/alsa-utils/package.mk b/packages/audio/alsa/alsa-utils/package.mk index bb31e6dce3..a3b023102e 100644 --- a/packages/audio/alsa/alsa-utils/package.mk +++ b/packages/audio/alsa/alsa-utils/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="alsa-utils" -PKG_VERSION="1.0.28" +PKG_VERSION="1.0.27.2" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" diff --git a/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-001.patch b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-001.patch new file mode 100644 index 0000000000..3b4e6228e7 --- /dev/null +++ b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-001.patch @@ -0,0 +1,36 @@ +From 180283e2307b07bbd3958d24382aab8271dd4c1d Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Mon, 30 Sep 2013 23:46:50 +0300 +Subject: [PATCH 1/1] amixer: actually print all TLVs in a container TLV + +Due to a wrong indexing of tlv[] decode_tlv() always skips to the end of +the container TLV since the used tlv[1] contains the container TLV size +instead of the intended element size. + +This causes, for example, only the first HDMI channel map TLV to be +shown. + +Fix the indexing to actually use the element size. + +Signed-off-by: Anssi Hannula +Signed-off-by: Takashi Iwai +--- + amixer/amixer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/amixer/amixer.c b/amixer/amixer.c +index 7727943..b83b0c3 100644 +--- a/amixer/amixer.c ++++ b/amixer/amixer.c +@@ -468,7 +468,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_ + return; + } + decode_tlv(spaces + 2, tlv + idx, tlv[idx+1] + 8); +- idx += 2 + (tlv[1] + sizeof(unsigned int) - 1) / sizeof(unsigned int); ++ idx += 2 + (tlv[idx+1] + sizeof(unsigned int) - 1) / sizeof(unsigned int); + } + break; + case SND_CTL_TLVT_DB_SCALE: +-- +1.7.11.7 + diff --git a/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-002.patch b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-002.patch new file mode 100644 index 0000000000..0bdd29b863 --- /dev/null +++ b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-002.patch @@ -0,0 +1,42 @@ +From f1e991e81350e9388ab6cf04a64ac4b4389a588c Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Tue, 1 Oct 2013 23:46:53 +0300 +Subject: [PATCH] amixer: fix indentation when printing container TLV contents + +decode_tlv() adds indentation in the beginning, with the expectation +that the TLV will be printed on the line afterwards in a switch-case. + +However, in the case of a container TLV the switch-case simply adds +another level of indentation and calls decode_tlv() for the inner TLVs. +This causes the first inner TLV to be printed with too much indentation +and double '|'. + +Fix that by printing "container" and a newline for container TLVs, so +that the result is as follows: + : values=0,0,0,0,0,0,0,0 + | container + | chmap-variable=FL,FR + | chmap-variable=FL,FR,LFE + | chmap-variable=FL,FR,FC + +Signed-off-by: Anssi Hannula +Signed-off-by: Takashi Iwai +--- + amixer/amixer.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/amixer/amixer.c b/amixer/amixer.c +index b83b0c3..cf82892 100644 +--- a/amixer/amixer.c ++++ b/amixer/amixer.c +@@ -460,6 +460,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_ + } + switch (type) { + case SND_CTL_TLVT_CONTAINER: ++ printf("container\n"); + size += sizeof(unsigned int) -1; + size /= sizeof(unsigned int); + while (idx < size) { +-- +1.7.11.7 + diff --git a/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-003.patch b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-003.patch new file mode 100644 index 0000000000..d3aaeb625c --- /dev/null +++ b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-003.patch @@ -0,0 +1,232 @@ +From a1992044d5813371ce71f5252187942f943b198d Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Tue, 12 Nov 2013 00:04:02 +0200 +Subject: [PATCH] speaker-test: Fix chmapped channel selection without + specified chmap + +The channel selection currently does not work properly when there is a +driver-provided non-ALSA-traditional channel map but no manual channel +map was explicitely requested with "-m". + +For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note +that it is otherwise the same as the traditional ALSA channel map, +except that the traditional rear speakers are considered +rear-center speakers and the traditional side speakers are considered +rear speakers. + +Speaker-test tries to play back channels in this following order: + 0, /* Front Left */ + 4, /* Center */ + 1, /* Front Right */ + 7, /* Side Right */ + 3, /* Rear Right */ + 2, /* Rear Left */ + 6, /* Side Left */ + 5, /* LFE */ + +When it is the time to play back Side Left/Right, speaker-test tries to +look for SL/SR in the chmap, but doesn't find it, so it just plays back +channels 6/7 (which indeed are the side speakers, or RL/RR in this +channel map - so the correct channels are selected). + +When it becomes the time to playback Rear Left/Right, speaker-test again +tries to find RL/RR in the chmap, and this time it does find them in the +chmap positions 6/7. + +So the channels 6/7 are tested twice and 2/3 are never tested. + +To fix this, define a generic playback order channel_order[] to be used +when the channel map is present (but not user-defined) and generate a +(speaker/playback number => channel number) mapping with the channels +ordered in the following order: +1. regular channels found in channel_order[] in the defined order, +2. channels not found in channel_order[] ordered by channel number. +3. UNKNOWN channels ordered by channel number. +4. NA channels ordered by channel number. +For channels outside the channel map just use their channel numbers (so +they will be last after all of the above). + +For example, if the playback device has a fictional default channel map +of FR,FL,UNKNOWN1,FOO,BAR,RR,RL,UNKNOWN2, the playback order will be +FL,FR,RR,RL,FOO,BAR,UNKNOWN1,UNKNOWN2(,any_extra_channels). + +When the channel mapping is specified manually, the specified order is +used for playback as before. + +Signed-off-by: Anssi Hannula +Signed-off-by: Takashi Iwai +--- + speaker-test/speaker-test.c | 113 +++++++++++++++++++++++++++++++++++--------- + 1 file changed, 91 insertions(+), 22 deletions(-) + +diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c +index d35065f..25b08dc 100644 +--- a/speaker-test/speaker-test.c ++++ b/speaker-test/speaker-test.c +@@ -88,6 +88,8 @@ enum { + #define BE_INT(v) (v) + #endif + ++#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0])) ++ + static char *device = "default"; /* playback device */ + static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ + static unsigned int rate = 48000; /* stream rate */ +@@ -110,6 +112,7 @@ static snd_pcm_t *pcm_handle = NULL; + #ifdef CONFIG_SUPPORT_CHMAP + static snd_pcm_chmap_t *channel_map; + static int channel_map_set; ++static unsigned int *ordered_channels; + #endif + + static const char *const channel_name[MAX_CHANNELS] = { +@@ -156,36 +159,94 @@ static const int channels8[] = { + 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, +- }; ++/* circular clockwise and bottom-to-top order */ ++static const int channel_order[] = { ++ [SND_CHMAP_FLW] = 10, ++ [SND_CHMAP_FL] = 20, ++ [SND_CHMAP_TFL] = 30, ++ [SND_CHMAP_FLC] = 40, ++ [SND_CHMAP_TFLC] = 50, ++ [SND_CHMAP_FC] = 60, ++ [SND_CHMAP_TFC] = 70, ++ [SND_CHMAP_FRC] = 80, ++ [SND_CHMAP_TFRC] = 90, ++ [SND_CHMAP_FR] = 100, ++ [SND_CHMAP_TFR] = 110, ++ [SND_CHMAP_FRW] = 120, ++ [SND_CHMAP_SR] = 130, ++ [SND_CHMAP_TSR] = 140, ++ [SND_CHMAP_RR] = 150, ++ [SND_CHMAP_TRR] = 160, ++ [SND_CHMAP_RRC] = 170, ++ [SND_CHMAP_RC] = 180, ++ [SND_CHMAP_TRC] = 190, ++ [SND_CHMAP_RLC] = 200, ++ [SND_CHMAP_RL] = 210, ++ [SND_CHMAP_TRL] = 220, ++ [SND_CHMAP_SL] = 230, ++ [SND_CHMAP_TSL] = 240, ++ [SND_CHMAP_BC] = 250, ++ [SND_CHMAP_TC] = 260, ++ [SND_CHMAP_LLFE] = 270, ++ [SND_CHMAP_LFE] = 280, ++ [SND_CHMAP_RLFE] = 290, ++ /* not in table = 10000 */ ++ [SND_CHMAP_UNKNOWN] = 20000, ++ [SND_CHMAP_NA] = 30000, ++}; + +- if (channel_map && maps[chn]) { +- int i; +- for (i = 0; i < channel_map->channels; i++) { +- if (channel_map->pos[i] == maps[chn]) +- return i; +- } ++static int chpos_cmp(const void *chnum1p, const void *chnum2p) ++{ ++ int chnum1 = *(int *)chnum1p; ++ int chnum2 = *(int *)chnum2p; ++ int chpos1 = channel_map->pos[chnum1]; ++ int chpos2 = channel_map->pos[chnum2]; ++ int weight1 = 10000; ++ int weight2 = 10000; ++ ++ if (chpos1 < ARRAY_SIZE(channel_order) && channel_order[chpos1]) ++ weight1 = channel_order[chpos1]; ++ if (chpos2 < ARRAY_SIZE(channel_order) && channel_order[chpos2]) ++ weight2 = channel_order[chpos2]; ++ ++ if (weight1 == weight2) { ++ /* order by channel number if both have the same position (e.g. UNKNOWN) ++ * or if neither is in channel_order[] */ ++ return chnum1 - chnum2; + } +-#endif +- return chn; ++ ++ /* order according to channel_order[] */ ++ return weight1 - weight2; ++} ++ ++static int *order_channels(void) ++{ ++ /* create a (playback order => channel number) table with channels ordered ++ * according to channel_order[] values */ ++ int i; ++ int *ordered_chs; ++ ++ ordered_chs = calloc(channel_map->channels, sizeof(*ordered_chs)); ++ if (!ordered_chs) ++ return NULL; ++ ++ for (i = 0; i < channel_map->channels; i++) ++ ordered_chs[i] = i; ++ ++ qsort(ordered_chs, channel_map->channels, sizeof(*ordered_chs), chpos_cmp); ++ ++ return ordered_chs; + } ++#endif + + static int get_speaker_channel(int chn) + { + #ifdef CONFIG_SUPPORT_CHMAP +- if (channel_map_set) ++ if (channel_map_set || (ordered_channels && chn >= channel_map->channels)) + return chn; ++ if (ordered_channels) ++ return ordered_channels[chn]; + #endif + + switch (channels) { +@@ -200,7 +261,7 @@ static int get_speaker_channel(int chn) + break; + } + +- return get_mapped_channel(chn); ++ return chn; + } + + static const char *get_channel_name(int chn) +@@ -611,6 +672,11 @@ static int config_chmap(snd_pcm_t *handle, const char *mapstr) + } + + channel_map = snd_pcm_get_chmap(handle); ++ ++ /* create a channel order table for default layouts */ ++ if (channel_map) ++ ordered_channels = order_channels(); ++ + return 0; + } + #endif +@@ -1230,6 +1296,9 @@ int main(int argc, char *argv[]) { + + + free(frames); ++#ifdef CONFIG_SUPPORT_CHMAP ++ free(ordered_channels); ++#endif + + return prg_exit(EXIT_SUCCESS); + } +-- +1.7.11.7 + diff --git a/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-004.patch b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-004.patch new file mode 100644 index 0000000000..eba4342dbd --- /dev/null +++ b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-004.patch @@ -0,0 +1,44 @@ +From 5b0c6da0d8166cd404379740c5f75fda44ca5806 Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Sun, 10 Nov 2013 20:29:18 +0200 +Subject: [PATCH] speaker-test: Always show chmap channel names if available + +Currently speaker-test only uses channel names retrieved by +snd_pcm_chmap_long_name() when a channel map has been manually set. + +However, the device may provide a default (or fixed) channel map that +differs from the traditional ALSA map, in which case wrong channel names +are shown. + +Fix that by always using the name from the channel map when a channel +map is present. + +Note that the names retrieved by snd_pcm_chmap_long_name() are not +currently localized via gettext. + +Also note that Linux kernel HDMI driver reported wrong default channel +maps before 56cac413dd6d43af8355f5d1f90a199b540f73fc ("ALSA: hda - hdmi: +Fix reported channel map on common default layouts"). + +Signed-off-by: Anssi Hannula +Signed-off-by: Takashi Iwai +--- + speaker-test/speaker-test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c +index 25b08dc..101bb0d 100644 +--- a/speaker-test/speaker-test.c ++++ b/speaker-test/speaker-test.c +@@ -267,7 +267,7 @@ static int get_speaker_channel(int chn) + static const char *get_channel_name(int chn) + { + #ifdef CONFIG_SUPPORT_CHMAP +- if (channel_map_set && chn < channel_map->channels) { ++ if (channel_map && chn < channel_map->channels) { + const char *name = snd_pcm_chmap_long_name(channel_map->pos[chn]); + return name ? name : "Unknown"; + } +-- +1.7.11.7 + diff --git a/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-005.patch b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-005.patch new file mode 100644 index 0000000000..8a0bf7d684 --- /dev/null +++ b/packages/audio/alsa/alsa-utils/patches/alsa-utils-upstream-005.patch @@ -0,0 +1,41 @@ +From 58752c3ae32e03d676fa225c99c9a8dde9de39ed Mon Sep 17 00:00:00 2001 +From: Anssi Hannula +Date: Sun, 10 Nov 2013 20:29:19 +0200 +Subject: [PATCH] speaker-test: Show out-of-chmap channels as Unknown + +Currently speaker-test falls back to ALSA default channel names for +channels out-of-chmap. + +This causes e.g. the 4th channel of +$ speaker-test -c4 -Dhdmi -m "FR,FL,FC" +to be shown as "Rear Right". + +Change the code to show such channels as Unknown instead, similar to +when snd_pcm_chmap_long_name() does not know the name. + +Signed-off-by: Anssi Hannula +Signed-off-by: Takashi Iwai +--- + speaker-test/speaker-test.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c +index 101bb0d..261f399 100644 +--- a/speaker-test/speaker-test.c ++++ b/speaker-test/speaker-test.c +@@ -267,8 +267,10 @@ static int get_speaker_channel(int chn) + static const char *get_channel_name(int chn) + { + #ifdef CONFIG_SUPPORT_CHMAP +- if (channel_map && chn < channel_map->channels) { +- const char *name = snd_pcm_chmap_long_name(channel_map->pos[chn]); ++ if (channel_map) { ++ const char *name = NULL; ++ if (chn < channel_map->channels) ++ name = snd_pcm_chmap_long_name(channel_map->pos[chn]); + return name ? name : "Unknown"; + } + #endif +-- +1.7.11.7 +