]> git.sesse.net Git - vlc/commitdiff
* modules/audio_output/auhal.c: Make speaker config assumptions if the speaker layout...
authorDerk-Jan Hartman <hartman@videolan.org>
Sun, 5 Jun 2005 11:26:27 +0000 (11:26 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sun, 5 Jun 2005 11:26:27 +0000 (11:26 +0000)
modules/audio_output/auhal.c

index 515ae7200146bd970e0c945212680f3660702e75..077c13ccf5b7acb696f452072ea4d5e99ee77367 100644 (file)
@@ -293,7 +293,37 @@ static int Open( vlc_object_t * p_this )
                 continue;
             default:
                 msg_Warn( p_aout, "Unrecognized channel form provided by driver: %d", (int)layout->mChannelDescriptions[i].mChannelLabel );
-                p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
+                switch( layout->mNumberChannelDescriptions )
+                {
+                    /* We make assumptions based on number of channels here.
+                     * Unfortunatly Apple has provided no 100% method to retrieve the speaker configuration */
+                    case 1:
+                        p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER;
+                        break;
+                    case 4:
+                        p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
+                                                                    AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
+                        break;
+                    case 6:
+                        p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
+                                                                    AOUT_CHAN_CENTER | AOUT_CHAN_LFE |
+                                                                    AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
+                        break;
+                    case 7:
+                        p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
+                                                                    AOUT_CHAN_CENTER | AOUT_CHAN_LFE |
+                                                                    AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT | AOUT_CHAN_REARCENTER;
+                        break;
+                    case 8:
+                        p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT |
+                                                                    AOUT_CHAN_CENTER | AOUT_CHAN_LFE |
+                                                                    AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT |
+                                                                    AOUT_CHAN_REARLEFT | AOUT_CHAN_REARRIGHT;
+                        break;
+                    case 2:
+                    default:
+                        p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
+                }
                 break;
         }
     }