| 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_PULSE_PULSE_UTIL_H_ | 5 #ifndef MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
| 6 #define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ | 6 #define MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
| 7 | 7 |
| 8 #include <pulse/pulseaudio.h> | 8 #include <pulse/pulseaudio.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout); | 43 pa_channel_map ChannelLayoutToPAChannelMap(ChannelLayout channel_layout); |
| 44 | 44 |
| 45 void WaitForOperationCompletion(pa_threaded_mainloop* mainloop, | 45 void WaitForOperationCompletion(pa_threaded_mainloop* mainloop, |
| 46 pa_operation* operation); | 46 pa_operation* operation); |
| 47 | 47 |
| 48 int GetHardwareLatencyInBytes(pa_stream* stream, | 48 int GetHardwareLatencyInBytes(pa_stream* stream, |
| 49 int sample_rate, | 49 int sample_rate, |
| 50 int bytes_per_frame); | 50 int bytes_per_frame); |
| 51 | 51 |
| 52 // pa_context_get_server_info callback. It's used by GetSystemDefaultInputDevice |
| 53 // to get the system default input device name. |
| 54 void SystemDefaultInputDeviceCallback(pa_context* context, |
| 55 const pa_server_info* info, |
| 56 void* user_data); |
| 57 |
| 58 // Return the system default input device name using pa_context_get_server_info. |
| 59 std::string GetSystemDefaultInputDevice(pa_threaded_mainloop* mainloop, |
| 60 pa_context* context); |
| 61 |
| 52 // Create a recording stream for the threaded mainloop, return true if success, | 62 // Create a recording stream for the threaded mainloop, return true if success, |
| 53 // otherwise false. |mainloop| and |context| have to be from a valid Pulse | 63 // otherwise false. |mainloop| and |context| have to be from a valid Pulse |
| 54 // threaded mainloop and the handle of the created stream will be returned by | 64 // threaded mainloop and the handle of the created stream will be returned by |
| 55 // |stream|. | 65 // |stream|. |
| 56 bool CreateInputStream(pa_threaded_mainloop* mainloop, | 66 bool CreateInputStream(pa_threaded_mainloop* mainloop, |
| 57 pa_context* context, | 67 pa_context* context, |
| 58 pa_stream** stream, | 68 pa_stream** stream, |
| 59 const AudioParameters& params, | 69 const AudioParameters& params, |
| 60 const std::string& device_id, | 70 const std::string& device_id, |
| 61 pa_stream_notify_cb_t stream_callback, | 71 pa_stream_notify_cb_t stream_callback, |
| 62 void* user_data); | 72 void* user_data); |
| 63 | 73 |
| 74 // pa_context_get_server_info callback. It's used by |
| 75 // GetSystemDefaultOutputDevice to get the system default output device name. |
| 76 void SystemDefaultOutputDeviceCallback(pa_context* context, |
| 77 const pa_server_info* info, |
| 78 void* user_data); |
| 79 |
| 80 // Return the system default output device name using |
| 81 // pa_context_get_server_info. |
| 82 std::string GetSystemDefaultOutputDevice(pa_threaded_mainloop* mainloop, |
| 83 pa_context* context); |
| 84 |
| 64 // Create a playback stream for the threaded mainloop, return true if success, | 85 // Create a playback stream for the threaded mainloop, return true if success, |
| 65 // otherwise false. This function will create a new Pulse threaded mainloop, | 86 // otherwise false. This function will create a new Pulse threaded mainloop, |
| 66 // and the handles of the mainloop, context and stream will be returned by | 87 // and the handles of the mainloop, context and stream will be returned by |
| 67 // |mainloop|, |context| and |stream|. | 88 // |mainloop|, |context| and |stream|. |
| 68 bool CreateOutputStream(pa_threaded_mainloop** mainloop, | 89 bool CreateOutputStream(pa_threaded_mainloop** mainloop, |
| 69 pa_context** context, | 90 pa_context** context, |
| 70 pa_stream** stream, | 91 pa_stream** stream, |
| 71 const AudioParameters& params, | 92 const AudioParameters& params, |
| 72 const std::string& device_id, | 93 const std::string& device_id, |
| 73 const std::string& app_name, | 94 const std::string& app_name, |
| 74 pa_stream_notify_cb_t stream_callback, | 95 pa_stream_notify_cb_t stream_callback, |
| 75 pa_stream_request_cb_t write_callback, | 96 pa_stream_request_cb_t write_callback, |
| 76 void* user_data); | 97 void* user_data); |
| 77 | 98 |
| 78 } // namespace pulse | 99 } // namespace pulse |
| 79 | 100 |
| 80 } // namespace media | 101 } // namespace media |
| 81 | 102 |
| 82 #endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ | 103 #endif // MEDIA_AUDIO_PULSE_PULSE_UTIL_H_ |
| OLD | NEW |