OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ | |
6 #define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ | |
7 | |
8 #include <pulse/pulseaudio.h> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "media/audio/audio_device_name.h" | |
12 #include "media/base/channel_layout.h" | |
13 | |
14 namespace media { | |
15 | |
DaleCurtis
2013/02/20 00:17:38
WDYT about putting these in a pulse sub-namespace
no longer working on chromium
2013/02/20 14:43:38
Done with adding the media::pulse namespace
| |
16 // A helper class that acquires pa_threaded_mainloop_lock() while in scope. | |
17 class AutoPulseLock { | |
DaleCurtis
2013/02/20 00:17:38
Just inline the implementation like base/lock.h
no longer working on chromium
2013/02/20 14:43:38
Done.
| |
18 public: | |
19 explicit AutoPulseLock(pa_threaded_mainloop* pa_mainloop); | |
20 ~AutoPulseLock(); | |
21 | |
22 private: | |
23 pa_threaded_mainloop* pa_mainloop_; | |
24 DISALLOW_COPY_AND_ASSIGN(AutoPulseLock); | |
25 }; | |
26 | |
27 // Triggers pa_threaded_mainloop_signal() to avoid deadlocks. | |
28 void StreamSuccessCallback(pa_stream* s, int error, void* mainloop); | |
29 void ContextStateCallback(pa_context* context, void* mainloop); | |
30 | |
31 pa_sample_format_t BitsToPASampleFormat(int bits_per_sample); | |
32 | |
33 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout); | |
34 | |
35 void WaitForOperationCompletion(pa_threaded_mainloop* pa_mainloop, | |
36 pa_operation* operation); | |
37 | |
38 int GetHardwareLatencyInBytes(pa_stream* stream, | |
39 int sample_rate, | |
40 int bytes_per_frame); | |
41 | |
42 } // namespace media | |
43 | |
44 #endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ | |
OLD | NEW |