| 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 #ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_ | 5 #ifndef MEDIA_BASE_CHANNEL_LAYOUT_H_ |
| 6 #define MEDIA_BASE_CHANNEL_LAYOUT_H_ | 6 #define MEDIA_BASE_CHANNEL_LAYOUT_H_ |
| 7 | 7 |
| 8 #include "media/base/media_export.h" | 8 #include "media/base/media_export.h" |
| 9 | 9 |
| 10 namespace media { |
| 11 |
| 10 // Enumerates the various representations of the ordering of audio channels. | 12 // Enumerates the various representations of the ordering of audio channels. |
| 11 // Logged to UMA, so never reuse a value, always add new/greater ones! | 13 // Logged to UMA, so never reuse a value, always add new/greater ones! |
| 12 enum ChannelLayout { | 14 enum ChannelLayout { |
| 13 CHANNEL_LAYOUT_NONE = 0, | 15 CHANNEL_LAYOUT_NONE = 0, |
| 14 CHANNEL_LAYOUT_UNSUPPORTED = 1, | 16 CHANNEL_LAYOUT_UNSUPPORTED = 1, |
| 15 | 17 |
| 16 // Front C | 18 // Front C |
| 17 CHANNEL_LAYOUT_MONO = 2, | 19 CHANNEL_LAYOUT_MONO = 2, |
| 18 | 20 |
| 19 // Front L, Front R | 21 // Front L, Front R |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 LEFT_OF_CENTER, | 74 LEFT_OF_CENTER, |
| 73 RIGHT_OF_CENTER, | 75 RIGHT_OF_CENTER, |
| 74 BACK_CENTER, | 76 BACK_CENTER, |
| 75 SIDE_LEFT, | 77 SIDE_LEFT, |
| 76 SIDE_RIGHT, | 78 SIDE_RIGHT, |
| 77 STEREO_LEFT, | 79 STEREO_LEFT, |
| 78 STEREO_RIGHT, | 80 STEREO_RIGHT, |
| 79 CHANNELS_MAX | 81 CHANNELS_MAX |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 // The channel orderings for each layout as specified by FFmpeg. | 84 // Returns the expected channel position in an interleaved stream. Values of -1 |
| 83 // Values represent the index of each channel in each layout. For example, the | 85 // mean the channel at that index is not used for that layout. Values range |
| 84 // left side surround sound channel in FFmpeg's 5.1 layout is in the 5th | 86 // from 0 to CHANNELS_MAX - 1. |
| 85 // position (because the order is L, R, C, LFE, LS, RS), so | 87 MEDIA_EXPORT int ChannelOrder(ChannelLayout layout, Channels channel); |
| 86 // kChannelOrderings[CHANNEL_LAYOUT_5POINT1][SIDE_LEFT] = 4; | |
| 87 // Values of -1 mean the channel at that index is not used for that layout. | |
| 88 MEDIA_EXPORT extern const int | |
| 89 kChannelOrderings[CHANNEL_LAYOUT_MAX][CHANNELS_MAX]; | |
| 90 | 88 |
| 91 // Returns the number of channels in a given ChannelLayout. | 89 // Returns the number of channels in a given ChannelLayout. |
| 92 MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout); | 90 MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout); |
| 93 | 91 |
| 92 } // namespace media |
| 93 |
| 94 #endif // MEDIA_BASE_CHANNEL_LAYOUT_H_ | 94 #endif // MEDIA_BASE_CHANNEL_LAYOUT_H_ |
| OLD | NEW |