| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/channel_layout.h" | 5 #include "media/base/channel_layout.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 { 0 , 1 , 2 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, | 153 { 0 , 1 , 2 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 }, |
| 154 | 154 |
| 155 // CHANNEL_LAYOUT_4_1_QUAD_SIDE | 155 // CHANNEL_LAYOUT_4_1_QUAD_SIDE |
| 156 { 0 , 1 , -1 , 4 , -1 , -1 , -1 , -1 , -1 , 2 , 3 }, | 156 { 0 , 1 , -1 , 4 , -1 , -1 , -1 , -1 , -1 , 2 , 3 }, |
| 157 | 157 |
| 158 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR | 158 // FL | FR | FC | LFE | BL | BR | FLofC | FRofC | BC | SL | SR |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 int ChannelLayoutToChannelCount(ChannelLayout layout) { | 161 int ChannelLayoutToChannelCount(ChannelLayout layout) { |
| 162 DCHECK_LT(static_cast<size_t>(layout), arraysize(kLayoutToChannels)); | 162 DCHECK_LT(static_cast<size_t>(layout), arraysize(kLayoutToChannels)); |
| 163 DCHECK_LE(kLayoutToChannels[layout], kMaxConcurrentChannels); |
| 163 return kLayoutToChannels[layout]; | 164 return kLayoutToChannels[layout]; |
| 164 } | 165 } |
| 165 | 166 |
| 166 // Converts a channel count into a channel layout. | 167 // Converts a channel count into a channel layout. |
| 167 ChannelLayout GuessChannelLayout(int channels) { | 168 ChannelLayout GuessChannelLayout(int channels) { |
| 168 switch (channels) { | 169 switch (channels) { |
| 169 case 1: | 170 case 1: |
| 170 return CHANNEL_LAYOUT_MONO; | 171 return CHANNEL_LAYOUT_MONO; |
| 171 case 2: | 172 case 2: |
| 172 return CHANNEL_LAYOUT_STEREO; | 173 return CHANNEL_LAYOUT_STEREO; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 case CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC: | 260 case CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC: |
| 260 return "STEREO_AND_KEYBOARD_MIC"; | 261 return "STEREO_AND_KEYBOARD_MIC"; |
| 261 case CHANNEL_LAYOUT_4_1_QUAD_SIDE: | 262 case CHANNEL_LAYOUT_4_1_QUAD_SIDE: |
| 262 return "4.1_QUAD_SIDE"; | 263 return "4.1_QUAD_SIDE"; |
| 263 } | 264 } |
| 264 NOTREACHED() << "Invalid channel layout provided: " << layout; | 265 NOTREACHED() << "Invalid channel layout provided: " << layout; |
| 265 return ""; | 266 return ""; |
| 266 } | 267 } |
| 267 | 268 |
| 268 } // namespace media | 269 } // namespace media |
| OLD | NEW |