OLD | NEW |
1 // Copyright (c) 2012 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 | |
21 static pa_sample_format_t BitsToPASampleFormat(int bits_per_sample) { | 19 static pa_sample_format_t BitsToPASampleFormat(int bits_per_sample) { |
22 switch (bits_per_sample) { | 20 switch (bits_per_sample) { |
23 // Unsupported sample formats shown for reference. I am assuming we want | 21 // Unsupported sample formats shown for reference. I am assuming we want |
24 // signed and little endian because that is what we gave to ALSA. | 22 // signed and little endian because that is what we gave to ALSA. |
25 case 8: | 23 case 8: |
26 return PA_SAMPLE_U8; | 24 return PA_SAMPLE_U8; |
27 // Also 8-bits: PA_SAMPLE_ALAW and PA_SAMPLE_ULAW | 25 // Also 8-bits: PA_SAMPLE_ALAW and PA_SAMPLE_ULAW |
28 case 16: | 26 case 16: |
29 return PA_SAMPLE_S16LE; | 27 return PA_SAMPLE_S16LE; |
30 // Also 16-bits: PA_SAMPLE_S16BE (big endian). | 28 // Also 16-bits: PA_SAMPLE_S16BE (big endian). |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 *volume = volume_; | 419 *volume = volume_; |
422 } | 420 } |
423 | 421 |
424 uint32 PulseAudioOutputStream::RunDataCallback( | 422 uint32 PulseAudioOutputStream::RunDataCallback( |
425 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { | 423 uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { |
426 if (source_callback_) | 424 if (source_callback_) |
427 return source_callback_->OnMoreData(this, dest, max_size, buffers_state); | 425 return source_callback_->OnMoreData(this, dest, max_size, buffers_state); |
428 | 426 |
429 return 0; | 427 return 0; |
430 } | 428 } |
431 | |
432 } // namespace media | |
OLD | NEW |