diff options
author | Ashok Sidipotu <ashok.sidipotu@collabora.com> | 2022-02-04 11:07:55 +0530 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2022-03-02 12:22:30 +0000 |
commit | 6a4f32a193cd5e2e972ea84e5638b913a1d9f249 (patch) | |
tree | 46c02cedc37815b84fe9967724b922aa32071b3d | |
parent | e1a973f86e60615466b05c7a41d4331f0129e43d (diff) |
pipewiresink: set a default channel map if the number of channels is fixed
-This allows remaping streams using pipewiresink to match the channel layout
of the target device
Bug-AGL: SPEC-4241
Change-Id: I4090187dc9977fc3d0ee440b601cb95f6864a9cf
Signed-off-by: Ashok Sidipotu <ashok.sidipotu@collabora.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/27130
Reviewed-by: Scott Murray <scott.murray@konsulko.com>
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tested-by: Jenkins Job builder account
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
(cherry picked from commit 322965878f61d40173695a9677c6d5200eefae58)
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/27185
Reviewed-by: Georgios Kiagiadakis <george.kiagiadakis@collabora.com>
2 files changed, 78 insertions, 0 deletions
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-pipewiresink-set-a-default-channel-map-if-the-number.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-pipewiresink-set-a-default-channel-map-if-the-number.patch new file mode 100644 index 000000000..3b1b2a490 --- /dev/null +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0005-pipewiresink-set-a-default-channel-map-if-the-number.patch @@ -0,0 +1,77 @@ +From ee2e6412d37d012fbf8d25bd37271a5ee92b3ad4 Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis <george.kiagiadakis@collabora.com> +Date: Thu, 3 Feb 2022 15:08:57 +0200 +Subject: [PATCH] pipewiresink: set a default channel map if the number of + channels is fixed + +This allows remaping streams using pipewiresink to match the channel layout +of the target device +Upstream-Status: Backport [from master/0.3.46] +--- + src/gst/gstpipewireformat.c | 42 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 41 insertions(+), 1 deletion(-) + +diff --git a/src/gst/gstpipewireformat.c b/src/gst/gstpipewireformat.c +index dca90267c..c8ce7ba62 100644 +--- a/src/gst/gstpipewireformat.c ++++ b/src/gst/gstpipewireformat.c +@@ -445,6 +445,44 @@ handle_video_fields (ConvertData *d) + return TRUE; + } + ++static void ++set_default_channels (struct spa_pod_builder *b, uint32_t channels) ++{ ++ uint32_t position[SPA_AUDIO_MAX_CHANNELS] = {0}; ++ gboolean ok = TRUE; ++ ++ switch (channels) { ++ case 8: ++ position[6] = SPA_AUDIO_CHANNEL_SL; ++ position[7] = SPA_AUDIO_CHANNEL_SR; ++ SPA_FALLTHROUGH ++ case 6: ++ position[5] = SPA_AUDIO_CHANNEL_LFE; ++ SPA_FALLTHROUGH ++ case 5: ++ position[4] = SPA_AUDIO_CHANNEL_FC; ++ SPA_FALLTHROUGH ++ case 4: ++ position[2] = SPA_AUDIO_CHANNEL_RL; ++ position[3] = SPA_AUDIO_CHANNEL_RR; ++ SPA_FALLTHROUGH ++ case 2: ++ position[0] = SPA_AUDIO_CHANNEL_FL; ++ position[1] = SPA_AUDIO_CHANNEL_FR; ++ break; ++ case 1: ++ position[0] = SPA_AUDIO_CHANNEL_MONO; ++ break; ++ default: ++ ok = FALSE; ++ break; ++ } ++ ++ if (ok) ++ spa_pod_builder_add (b, SPA_FORMAT_AUDIO_position, ++ SPA_POD_Array(sizeof(uint32_t), SPA_TYPE_Id, channels, position), 0); ++} ++ + static gboolean + handle_audio_fields (ConvertData *d) + { +@@ -538,8 +576,10 @@ handle_audio_fields (ConvertData *d) + } + if (i > 0) { + choice = spa_pod_builder_pop(&d->b, &f); +- if (i == 1) ++ if (i == 1) { + choice->body.type = SPA_CHOICE_None; ++ set_default_channels (&d->b, v); ++ } + } + } + return TRUE; +-- +2.34.1 + diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.43.bbappend b/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.43.bbappend index e2bc0d2bb..8d3df64cb 100644 --- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.43.bbappend +++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_0.3.43.bbappend @@ -11,6 +11,7 @@ SRC_URI += "\ file://0002-Revert-treewide-meson.build-use-dependency-variable-.patch \ file://0003-Revert-meson-declare-spa_dep-and-override_dependency.patch \ file://0004-Revert-systemd-correctly-prefix-systemd-system-units.patch \ + file://0005-pipewiresink-set-a-default-channel-map-if-the-number.patch \ " do_install:append() { |