Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
4038a2e0 by Steve Lhomme at 2026-11-27T13:29:20+00:00
alsa: replace custom channel_maps with vlc_chan_maps
vlc_chan_maps can be used with the actual channel count.
channel_maps[x] = vlc_chan_maps[x + 1] for all values of the previous
channel_maps. We keep the same limit to 5.1 max for now.
param is the number of channels to map.
snd_pcm_hw_params_set_channels_max() is requested a stereo or mono input
and alsa returns the number of channels actually used.
- - - - -
a75e766d by Steve Lhomme at 2026-11-27T13:29:20+00:00
afile: use vlc_chan_maps instead of custom pi_channels_maps
All values from pi_channels_maps from 0 to 6 match the values in vlc_chan_maps.
We may extend the number of channels to 8 (7.1).
- - - - -
2 changed files:
- modules/access/alsa.c
- modules/audio_output/file.c
Changes:
=====================================
modules/access/alsa.c
=====================================
@@ -333,12 +333,6 @@ static const uint8_t choices[] = {
SND_PCM_FORMAT_U8,
};
-static uint16_t channel_maps[] = {
- AOUT_CHAN_CENTER, AOUT_CHANS_2_0, AOUT_CHANS_3_0 /* ? */,
- AOUT_CHANS_4_0, AOUT_CHANS_5_0 /* ? */, AOUT_CHANS_5_1,
- /* TODO: support 7-8 channels - need channels reodering */
-};
-
static int Open (vlc_object_t *obj)
{
demux_t *demux = (demux_t *)obj;
@@ -436,9 +430,9 @@ static int Open (vlc_object_t *obj)
goto error;
}
assert (param > 0);
- assert (param < ARRAY_SIZE(channel_maps));
+ assert (param < 6); // previous channel_maps limitation
fmt.audio.i_channels = param;
- fmt.audio.i_physical_channels = channel_maps[param - 1];
+ fmt.audio.i_physical_channels = vlc_chan_maps[param];
param = var_InheritInteger (demux, "alsa-samplerate");
val = snd_pcm_hw_params_set_rate_max (pcm, hw, ¶m, NULL);
=====================================
modules/audio_output/file.c
=====================================
@@ -55,19 +55,6 @@ typedef struct
} aout_sys_t;
#define CHANNELS_MAX 6
-static const int pi_channels_maps[CHANNELS_MAX+1] =
-{
- 0,
- AOUT_CHAN_CENTER,
- AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
- AOUT_CHAN_CENTER | AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT,
- AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_REARLEFT
- | AOUT_CHAN_REARRIGHT,
- AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
- | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT,
- AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT | AOUT_CHAN_CENTER
- | AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_LFE
-};
/*****************************************************************************
* Local prototypes.
@@ -119,7 +106,7 @@ vlc_module_begin ()
change_string_list( format_list, format_list )
add_integer( "audiofile-channels", 0,
CHANNELS_TEXT, CHANNELS_LONGTEXT )
- change_integer_range( 0, 6 )
+ change_integer_range( 0, CHANNELS_MAX )
add_bool( "audiofile-wav", true, WAV_TEXT, WAV_LONGTEXT )
set_capability( "audio output", 0 )
@@ -210,7 +197,7 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
i_channels = var_InheritInteger( p_aout, "audiofile-channels" );
if( i_channels > 0 && i_channels <= CHANNELS_MAX )
{
- fmt->i_physical_channels = pi_channels_maps[i_channels];
+ fmt->i_physical_channels = vlc_chan_maps[i_channels];
}
fmt->channel_type = AUDIO_CHANNEL_TYPE_BITMAP;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/88e51950bf0e8b85f7fb69654d3fd30832def905...a75e766d82c461f3f5e8be7e91a8a2aaabc200c1
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/88e51950bf0e8b85f7fb69654d3fd30832def905...a75e766d82c461f3f5e8be7e91a8a2aaabc200c1
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help