[pulseaudio-discuss] [PATCH] core-format: fix TrueHD and DTS-HD channel maps

Arun Raghavan arun at arunraghavan.net
Sun May 6 07:06:08 UTC 2018


On Sat, 5 May 2018, at 6:31 PM, Tanu Kaskinen wrote:
> Since these formats use 8 channels, the channel map needs to be
> configured to 8 channels as well.
> ---
>  src/pulsecore/core-format.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/src/pulsecore/core-format.c b/src/pulsecore/core-format.c
> index c3db2678a..862a74b5d 100644
> --- a/src/pulsecore/core-format.c
> +++ b/src/pulsecore/core-format.c
> @@ -227,13 +227,21 @@ int pa_format_info_to_sample_spec_fake(const 
> pa_format_info *f, pa_sample_spec *
>  
>      ss->format = PA_SAMPLE_S16LE;
>      if ((f->encoding == PA_ENCODING_TRUEHD_IEC61937) ||
> -	(f->encoding == PA_ENCODING_DTSHD_IEC61937))
> -	ss->channels = 8;
> -    else
> -	ss->channels = 2;
> -
> -    if (map)
> -        pa_channel_map_init_stereo(map);
> +        (f->encoding == PA_ENCODING_DTSHD_IEC61937)) {
> +        ss->channels = 8;
> +        if (map) {
> +            /* We use the ALSA mapping, because most likely we will be using an
> +             * ALSA sink. This doesn't really matter anyway, though, because
> +             * the channel map doesn't affect anything with passthrough
> +             * streams. The channel map just needs to be consistent with the
> +             * sample spec's channel count. */
> +            pa_channel_map_init_auto(map, 8, PA_CHANNEL_MAP_ALSA);
> +        }
> +    } else {
> +        ss->channels = 2;
> +        if (map)
> +            pa_channel_map_init_stereo(map);
> +    }
>  
>      pa_return_val_if_fail(pa_format_info_get_prop_int(f, 
> PA_PROP_FORMAT_RATE, &rate) == 0, -PA_ERR_INVALID);
>      ss->rate = (uint32_t) rate;
> -- 

Thanks for the fix-up, looks good.

Cheers,
Arun


More information about the pulseaudio-discuss mailing list