aout: pulse: handle AUDIO_CHANNELS_TYPE_AMBISONICS
authorThomas Guillem <thomas@gllm.fr>
Fri, 23 Jun 2017 15:41:55 +0000 (17:41 +0200)
committerThomas Guillem <thomas@gllm.fr>
Wed, 19 Jul 2017 16:46:05 +0000 (18:46 +0200)
modules/audio_output/pulse.c

index 81dd586..fb70933 100644 (file)
@@ -802,6 +802,16 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     if (ss.format != PA_SAMPLE_INVALID)
         pa_format_info_set_sample_format(formatv, ss.format);
 
+    if (fmt->channel_type == AUDIO_CHANNEL_TYPE_AMBISONICS)
+    {
+        fmt->channel_type = AUDIO_CHANNEL_TYPE_BITMAP;
+
+        /* Setup low latency in order to quickly react to ambisonics
+         * filters viewpoint changes. */
+        flags |= PA_STREAM_ADJUST_LATENCY;
+        attr.tlength = pa_usec_to_bytes(2 * AOUT_MIN_PREPARE_TIME, &ss);
+    }
+
     if (encoding != PA_ENCODING_PCM)
     {
         pa_format_info_set_channels(formatv, ss.channels);