OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "media/audio/pulse/pulse_output.h" | 5 #include "media/audio/pulse/pulse_output.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "media/audio/audio_parameters.h" | 9 #include "media/audio/audio_parameters.h" |
10 #include "media/audio/audio_util.h" | 10 #include "media/audio/audio_util.h" |
11 #if defined(OS_LINUX) | 11 #if defined(OS_LINUX) |
12 #include "media/audio/linux/audio_manager_linux.h" | 12 #include "media/audio/linux/audio_manager_linux.h" |
13 #elif defined(OS_OPENBSD) | 13 #elif defined(OS_OPENBSD) |
14 #include "media/audio/openbsd/audio_manager_openbsd.h" | 14 #include "media/audio/openbsd/audio_manager_openbsd.h" |
15 #endif | 15 #endif |
16 #include "media/base/data_buffer.h" | 16 #include "media/base/data_buffer.h" |
17 #include "media/base/seekable_buffer.h" | 17 #include "media/base/seekable_buffer.h" |
18 | 18 |
| 19 namespace media { |
| 20 |
19 static pa_sample_format_t BitsToPASampleFormat(int bits_per_sample) { | 21 static pa_sample_format_t BitsToPASampleFormat(int bits_per_sample) { |
20 switch (bits_per_sample) { | 22 switch (bits_per_sample) { |
21 // Unsupported sample formats shown for reference. I am assuming we want | 23 // Unsupported sample formats shown for reference. I am assuming we want |
22 // signed and little endian because that is what we gave to ALSA. | 24 // signed and little endian because that is what we gave to ALSA. |
23 case 8: | 25 case 8: |
24 return PA_SAMPLE_U8; | 26 return PA_SAMPLE_U8; |
25 // Also 8-bits: PA_SAMPLE_ALAW and PA_SAMPLE_ULAW | 27 // Also 8-bits: PA_SAMPLE_ALAW and PA_SAMPLE_ULAW |
26 case 16: | 28 case 16: |
27 return PA_SAMPLE_S16LE; | 29 return PA_SAMPLE_S16LE; |
28 // Also 16-bits: PA_SAMPLE_S16BE (big endian). | 30 // Also 16-bits: PA_SAMPLE_S16BE (big endian). |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 *volume = volume_; | 421 *volume = volume_; |
420 } | 422 } |
421 | 423 |
422 uint32 PulseAudioOutputStream::RunDataCallback( | 424 uint32 PulseAudioOutputStream::RunDataCallback( |
423 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { | 425 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { |
424 if (source_callback_) | 426 if (source_callback_) |
425 return source_callback_->OnMoreData(this, dest, max_size, buffers_state); | 427 return source_callback_->OnMoreData(this, dest, max_size, buffers_state); |
426 | 428 |
427 return 0; | 429 return 0; |
428 } | 430 } |
| 431 |
| 432 } // namespace media |
OLD | NEW |