OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <tinyalsa/asoundlib.h> | 5 #include <tinyalsa/asoundlib.h> |
6 | 6 |
7 #include "services/media/audio/platform/linux/alsa_output.h" | 7 #include "services/media/audio/platform/linux/alsa_output.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace media { | 10 namespace media { |
(...skipping 28 matching lines...) Expand all Loading... |
39 void AlsaOutput::AlsaClose() { | 39 void AlsaOutput::AlsaClose() { |
40 pcm* alsa_device = static_cast<pcm*>(alsa_device_); | 40 pcm* alsa_device = static_cast<pcm*>(alsa_device_); |
41 | 41 |
42 if (alsa_device) { | 42 if (alsa_device) { |
43 pcm_close(alsa_device); | 43 pcm_close(alsa_device); |
44 alsa_device_ = nullptr; | 44 alsa_device_ = nullptr; |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 MediaResult AlsaOutput::AlsaSelectFormat( | 48 MediaResult AlsaOutput::AlsaSelectFormat( |
49 const LpcmMediaTypeDetailsPtr& config) { | 49 const AudioMediaTypeDetailsPtr& config) { |
50 switch (config->sample_format) { | 50 switch (config->sample_format) { |
51 case LpcmSampleFormat::SIGNED_16: | 51 case AudioSampleFormat::SIGNED_16: |
52 alsa_format_ = PCM_FORMAT_S16_LE; | 52 alsa_format_ = PCM_FORMAT_S16_LE; |
53 break; | 53 break; |
54 | 54 |
55 // tinyalsa does not support unsigned LPCM formats | 55 // tinyalsa does not support unsigned LPCM formats |
56 case LpcmSampleFormat::UNSIGNED_8: | 56 case AudioSampleFormat::UNSIGNED_8: |
57 case LpcmSampleFormat::SIGNED_24_IN_32: | 57 case AudioSampleFormat::SIGNED_24_IN_32: |
58 default: | 58 default: |
59 return MediaResult::UNSUPPORTED_CONFIG; | 59 return MediaResult::UNSUPPORTED_CONFIG; |
60 } | 60 } |
61 | 61 |
62 return MediaResult::OK; | 62 return MediaResult::OK; |
63 } | 63 } |
64 | 64 |
65 int AlsaOutput::AlsaWrite(const void* data, uint32_t frames) { | 65 int AlsaOutput::AlsaWrite(const void* data, uint32_t frames) { |
66 DCHECK(alsa_device_); | 66 DCHECK(alsa_device_); |
67 DCHECK(output_formatter_); | 67 DCHECK(output_formatter_); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 return 0; | 121 return 0; |
122 } | 122 } |
123 | 123 |
124 return err_code; | 124 return err_code; |
125 } | 125 } |
126 | 126 |
127 | 127 |
128 } // namespace audio | 128 } // namespace audio |
129 } // namespace media | 129 } // namespace media |
130 } // namespace mojo | 130 } // namespace mojo |
OLD | NEW |