1 /* rtp_audio_routing.cpp
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #include "rtp_audio_routing.h"
12 AudioRouting::AudioRouting(bool muted
, audio_routing_channel_t channel
):
18 char const *AudioRouting::formatAudioRoutingToString()
25 // Should not happen ever
29 case channel_stereo_left
:
31 case channel_stereo_right
:
33 case channel_stereo_both
:
38 // Should not happen ever
42 AudioRouting
AudioRouting::getNextChannel(bool stereo_available
)
44 if (stereo_available
) {
47 return AudioRouting(AUDIO_UNMUTED
, channel_stereo_left
);
50 case channel_stereo_left
:
51 return AudioRouting(AUDIO_UNMUTED
, channel_stereo_both
);
52 case channel_stereo_both
:
53 return AudioRouting(AUDIO_UNMUTED
, channel_stereo_right
);
54 case channel_stereo_right
:
55 return AudioRouting(AUDIO_MUTED
, channel_stereo_right
);
57 return AudioRouting(AUDIO_UNMUTED
, channel_stereo_left
);
63 return AudioRouting(AUDIO_UNMUTED
, channel_mono
);
65 return AudioRouting(AUDIO_MUTED
, channel_mono
);
70 AudioRouting
AudioRouting::convert(bool stereo_available
)
72 // Muting is not touched by conversion
74 if (stereo_available
) {
78 return AudioRouting(muted_
, channel_stereo_both
);
81 return AudioRouting(muted_
, channel_any
);
84 return AudioRouting(muted_
, channel_
);
90 return AudioRouting(muted_
, channel_mono
);
93 return AudioRouting(muted_
, channel_any
);
96 return AudioRouting(muted_
, channel_mono
);
101 void AudioRouting::mergeAudioRouting(AudioRouting new_audio_routing
)
103 if (new_audio_routing
.getChannel() == channel_any
) {
104 muted_
= new_audio_routing
.isMuted();
106 muted_
= new_audio_routing
.isMuted();
107 channel_
= new_audio_routing
.getChannel();