| 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_AUDIO_ANDROID_OPENSLES_UTIL_H_ | 5 #ifndef MEDIA_AUDIO_ANDROID_OPENSLES_UTIL_H_ |
| 6 #define MEDIA_AUDIO_ANDROID_OPENSLES_UTIL_H_ | 6 #define MEDIA_AUDIO_ANDROID_OPENSLES_UTIL_H_ |
| 7 | 7 |
| 8 #include <SLES/OpenSLES.h> | 8 #include <SLES/OpenSLES.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "media/base/media_export.h" |
| 11 | 12 |
| 12 namespace media { | 13 namespace media { |
| 13 | 14 |
| 14 template <typename SLType, typename SLDerefType> | 15 template <typename SLType, typename SLDerefType> |
| 15 class ScopedSLObject { | 16 class ScopedSLObject { |
| 16 public: | 17 public: |
| 17 ScopedSLObject() : obj_(NULL) {} | 18 ScopedSLObject() : obj_(NULL) {} |
| 18 | 19 |
| 19 ~ScopedSLObject() { Reset(); } | 20 ~ScopedSLObject() { Reset(); } |
| 20 | 21 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 obj_ = NULL; | 34 obj_ = NULL; |
| 34 } | 35 } |
| 35 } | 36 } |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 SLType obj_; | 39 SLType obj_; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf; | 42 typedef ScopedSLObject<SLObjectItf, const SLObjectItf_*> ScopedSLObjectItf; |
| 42 | 43 |
| 44 // Guesses the channel mask for a given channel count. Android does not offer a |
| 45 // way to configure the layout, so this will be incorrect for less common |
| 46 // channel layouts. |
| 47 MEDIA_EXPORT SLuint32 ChannelCountToSLESChannelMask(int channel_count); |
| 48 |
| 43 } // namespace media | 49 } // namespace media |
| 44 | 50 |
| 45 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_UTIL_H_ | 51 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_UTIL_H_ |
| OLD | NEW |