[FFmpeg-devel] [PATCH] avdevice/pulse_audio_dec: identify channel layout

Carl Eugen Hoyos ceffmpeg at gmail.com
Sun Jan 26 21:27:01 EET 2020


Am So., 26. Jan. 2020 um 18:13 Uhr schrieb Federico Simoncelli
<federico.simoncelli at gmail.com>:
>
> This patch adds the attempt to identify the pulseaudio channel map and
> when possible set the relevant channel_layout parameter of the codec.
>
> The result is an improvement over the current behavior of guessing the
> layout based on the number of channels (for more information see
> guess_layout_max).
> ---
>  libavdevice/pulse_audio_dec.c | 40 +++++++++++++++++++++++++++++++----
>  1 file changed, 36 insertions(+), 4 deletions(-)
>
> diff --git a/libavdevice/pulse_audio_dec.c b/libavdevice/pulse_audio_dec.c
> index 50a3c971ae..12f2d15680 100644
> --- a/libavdevice/pulse_audio_dec.c
> +++ b/libavdevice/pulse_audio_dec.c
> @@ -135,6 +135,37 @@ static av_cold int pulse_close(AVFormatContext *s)
>      return 0;
>  }
>
> +static int pulse_map_to_layout(pa_channel_map *cmap)
> +{
> +    const char *map_name = pa_channel_map_to_name(cmap);
> +
> +    if (map_name == NULL)
> +        return 0;
> +
> +    if (strcmp(map_name, "mono") == 0)
> +        return AV_CH_LAYOUT_MONO;
> +
> +    if (strcmp(map_name, "stereo") == 0)
> +        return AV_CH_LAYOUT_STEREO;
> +
> +    if (strcmp(map_name, "surround-40") == 0)
> +        return AV_CH_LAYOUT_4POINT0;
> +
> +    if (strcmp(map_name, "surround-41") == 0)
> +        return AV_CH_LAYOUT_4POINT1;
> +
> +    if (strcmp(map_name, "surround-50") == 0)
> +        return AV_CH_LAYOUT_5POINT0;
> +
> +    if (strcmp(map_name, "surround-51") == 0)
> +        return AV_CH_LAYOUT_5POINT1;
> +
> +    if (strcmp(map_name, "surround-71") == 0)
> +        return AV_CH_LAYOUT_7POINT1;

Let me repeat my question:
Am I correct that without your question, it is possible to set the
channel_layout from the command line?
Is it still possible to overwrite above defaults with your patch?

Carl Eugen


More information about the ffmpeg-devel mailing list