1 From ee2e6412d37d012fbf8d25bd37271a5ee92b3ad4 Mon Sep 17 00:00:00 2001
2 From: George Kiagiadakis <george.kiagiadakis@collabora.com>
3 Date: Thu, 3 Feb 2022 15:08:57 +0200
4 Subject: [PATCH] pipewiresink: set a default channel map if the number of
7 This allows remaping streams using pipewiresink to match the channel layout
9 Upstream-Status: Backport [from master/0.3.46]
11 src/gst/gstpipewireformat.c | 42 ++++++++++++++++++++++++++++++++++++-
12 1 file changed, 41 insertions(+), 1 deletion(-)
14 diff --git a/src/gst/gstpipewireformat.c b/src/gst/gstpipewireformat.c
15 index dca90267c..c8ce7ba62 100644
16 --- a/src/gst/gstpipewireformat.c
17 +++ b/src/gst/gstpipewireformat.c
18 @@ -445,6 +445,44 @@ handle_video_fields (ConvertData *d)
23 +set_default_channels (struct spa_pod_builder *b, uint32_t channels)
25 + uint32_t position[SPA_AUDIO_MAX_CHANNELS] = {0};
30 + position[6] = SPA_AUDIO_CHANNEL_SL;
31 + position[7] = SPA_AUDIO_CHANNEL_SR;
34 + position[5] = SPA_AUDIO_CHANNEL_LFE;
37 + position[4] = SPA_AUDIO_CHANNEL_FC;
40 + position[2] = SPA_AUDIO_CHANNEL_RL;
41 + position[3] = SPA_AUDIO_CHANNEL_RR;
44 + position[0] = SPA_AUDIO_CHANNEL_FL;
45 + position[1] = SPA_AUDIO_CHANNEL_FR;
48 + position[0] = SPA_AUDIO_CHANNEL_MONO;
56 + spa_pod_builder_add (b, SPA_FORMAT_AUDIO_position,
57 + SPA_POD_Array(sizeof(uint32_t), SPA_TYPE_Id, channels, position), 0);
61 handle_audio_fields (ConvertData *d)
63 @@ -538,8 +576,10 @@ handle_audio_fields (ConvertData *d)
66 choice = spa_pod_builder_pop(&d->b, &f);
69 choice->body.type = SPA_CHOICE_None;
70 + set_default_channels (&d->b, v);