| 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 // Utility methods for the Core Audio API on Windows. | 5 // Utility methods for the Core Audio API on Windows. |
| 6 // Always ensure that Core Audio is supported before using these methods. | 6 // Always ensure that Core Audio is supported before using these methods. |
| 7 // Use media::CoreAudioIsSupported() for this purpose. | 7 // Use media::CoreAudioIsSupported() for this purpose. |
| 8 // Also, all methods must be called on a valid COM thread. This can be done | 8 // Also, all methods must be called on a valid COM thread. This can be done |
| 9 // by using the base::win::ScopedCOMInitializer helper class. | 9 // by using the base::win::ScopedCOMInitializer helper class. |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // Represents audio channel configuration constants as understood by Windows. | 30 // Represents audio channel configuration constants as understood by Windows. |
| 31 // E.g. KSAUDIO_SPEAKER_MONO. For a list of possible values see: | 31 // E.g. KSAUDIO_SPEAKER_MONO. For a list of possible values see: |
| 32 // http://msdn.microsoft.com/en-us/library/windows/hardware/ff537083(v=vs.85).as
px | 32 // http://msdn.microsoft.com/en-us/library/windows/hardware/ff537083(v=vs.85).as
px |
| 33 typedef uint32 ChannelConfig; | 33 typedef uint32 ChannelConfig; |
| 34 | 34 |
| 35 class MEDIA_EXPORT CoreAudioUtil { | 35 class MEDIA_EXPORT CoreAudioUtil { |
| 36 public: | 36 public: |
| 37 // Returns true if Windows Core Audio is supported. | 37 // Returns true if Windows Core Audio is supported. |
| 38 // Always verify that this method returns true before using any of the | 38 // Always verify that this method returns true before using any of the |
| 39 // methods in this class. | 39 // methods in this class. |
| 40 // WARNING: This function must be called once from the main thread before |
| 41 // it is safe to call from other threads. |
| 40 static bool IsSupported(); | 42 static bool IsSupported(); |
| 41 | 43 |
| 42 // Converts between reference time to base::TimeDelta. | 44 // Converts between reference time to base::TimeDelta. |
| 43 // One reference-time unit is 100 nanoseconds. | 45 // One reference-time unit is 100 nanoseconds. |
| 44 // Example: double s = RefererenceTimeToTimeDelta(t).InMillisecondsF(); | 46 // Example: double s = RefererenceTimeToTimeDelta(t).InMillisecondsF(); |
| 45 static base::TimeDelta RefererenceTimeToTimeDelta(REFERENCE_TIME time); | 47 static base::TimeDelta RefererenceTimeToTimeDelta(REFERENCE_TIME time); |
| 46 | 48 |
| 47 // Returns AUDCLNT_SHAREMODE_EXCLUSIVE if --enable-exclusive-mode is used | 49 // Returns AUDCLNT_SHAREMODE_EXCLUSIVE if --enable-exclusive-mode is used |
| 48 // as command-line flag and AUDCLNT_SHAREMODE_SHARED otherwise (default). | 50 // as command-line flag and AUDCLNT_SHAREMODE_SHARED otherwise (default). |
| 49 static AUDCLNT_SHAREMODE GetShareMode(); | 51 static AUDCLNT_SHAREMODE GetShareMode(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 226 |
| 225 private: | 227 private: |
| 226 CoreAudioUtil() {} | 228 CoreAudioUtil() {} |
| 227 ~CoreAudioUtil() {} | 229 ~CoreAudioUtil() {} |
| 228 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); | 230 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil); |
| 229 }; | 231 }; |
| 230 | 232 |
| 231 } // namespace media | 233 } // namespace media |
| 232 | 234 |
| 233 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ | 235 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_ |
| OLD | NEW |