| 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 { | 10 namespace media { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 BACK_LEFT, | 122 BACK_LEFT, |
| 123 BACK_RIGHT, | 123 BACK_RIGHT, |
| 124 LEFT_OF_CENTER, | 124 LEFT_OF_CENTER, |
| 125 RIGHT_OF_CENTER, | 125 RIGHT_OF_CENTER, |
| 126 BACK_CENTER, | 126 BACK_CENTER, |
| 127 SIDE_LEFT, | 127 SIDE_LEFT, |
| 128 SIDE_RIGHT, | 128 SIDE_RIGHT, |
| 129 CHANNELS_MAX = SIDE_RIGHT, // Must always equal the largest value ever logged. | 129 CHANNELS_MAX = SIDE_RIGHT, // Must always equal the largest value ever logged. |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 // The maximum number of concurrently active channels for all possible layouts. |
| 133 // ChannelLayoutToChannelCount() will never return a value higher than this. |
| 134 constexpr int kMaxConcurrentChannels = 8; |
| 135 |
| 132 // Returns the expected channel position in an interleaved stream. Values of -1 | 136 // Returns the expected channel position in an interleaved stream. Values of -1 |
| 133 // mean the channel at that index is not used for that layout. Values range | 137 // mean the channel at that index is not used for that layout. Values range |
| 134 // from 0 to ChannelLayoutToChannelCount(layout) - 1. | 138 // from 0 to ChannelLayoutToChannelCount(layout) - 1. |
| 135 MEDIA_EXPORT int ChannelOrder(ChannelLayout layout, Channels channel); | 139 MEDIA_EXPORT int ChannelOrder(ChannelLayout layout, Channels channel); |
| 136 | 140 |
| 137 // Returns the number of channels in a given ChannelLayout. | 141 // Returns the number of channels in a given ChannelLayout. |
| 138 MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout); | 142 MEDIA_EXPORT int ChannelLayoutToChannelCount(ChannelLayout layout); |
| 139 | 143 |
| 140 // Given the number of channels, return the best layout, | 144 // Given the number of channels, return the best layout, |
| 141 // or return CHANNEL_LAYOUT_UNSUPPORTED if there is no good match. | 145 // or return CHANNEL_LAYOUT_UNSUPPORTED if there is no good match. |
| 142 MEDIA_EXPORT ChannelLayout GuessChannelLayout(int channels); | 146 MEDIA_EXPORT ChannelLayout GuessChannelLayout(int channels); |
| 143 | 147 |
| 144 // Returns a string representation of the channel layout. | 148 // Returns a string representation of the channel layout. |
| 145 MEDIA_EXPORT const char* ChannelLayoutToString(ChannelLayout layout); | 149 MEDIA_EXPORT const char* ChannelLayoutToString(ChannelLayout layout); |
| 146 | 150 |
| 147 } // namespace media | 151 } // namespace media |
| 148 | 152 |
| 149 #endif // MEDIA_BASE_CHANNEL_LAYOUT_H_ | 153 #endif // MEDIA_BASE_CHANNEL_LAYOUT_H_ |
| OLD | NEW |