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_AUDIO_PARAMETERS_H_ | 5 #ifndef MEDIA_BASE_AUDIO_PARAMETERS_H_ |
6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 6 #define MEDIA_BASE_AUDIO_PARAMETERS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "media/audio/point.h" | |
15 #include "media/base/audio_bus.h" | 14 #include "media/base/audio_bus.h" |
| 15 #include "media/base/audio_point.h" |
16 #include "media/base/channel_layout.h" | 16 #include "media/base/channel_layout.h" |
17 #include "media/base/media_export.h" | 17 #include "media/base/media_export.h" |
18 | 18 |
19 namespace media { | 19 namespace media { |
20 | 20 |
21 // Use a struct-in-struct approach to ensure that we can calculate the required | 21 // Use a struct-in-struct approach to ensure that we can calculate the required |
22 // size as sizeof(Audio{Input,Output}BufferParameters) + #(bytes in audio | 22 // size as sizeof(Audio{Input,Output}BufferParameters) + #(bytes in audio |
23 // buffer) without using packing. Also align Audio{Input,Output}BufferParameters | 23 // buffer) without using packing. Also align Audio{Input,Output}BufferParameters |
24 // instead of in Audio{Input,Output}Buffer to be able to calculate size like so. | 24 // instead of in Audio{Input,Output}Buffer to be able to calculate size like so. |
25 // Use a macro for the alignment value that's the same as | 25 // Use a macro for the alignment value that's the same as |
26 // AudioBus::kChannelAlignment, since MSVC doesn't accept the latter to be used. | 26 // AudioBus::kChannelAlignment, since MSVC doesn't accept the latter to be used. |
27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
28 #pragma warning(push) | 28 #pragma warning(push) |
29 #pragma warning(disable: 4324) // Disable warning for added padding. | 29 #pragma warning(disable : 4324) // Disable warning for added padding. |
30 #endif | 30 #endif |
31 #define PARAMETERS_ALIGNMENT 16 | 31 #define PARAMETERS_ALIGNMENT 16 |
32 static_assert(AudioBus::kChannelAlignment == PARAMETERS_ALIGNMENT, | 32 static_assert(AudioBus::kChannelAlignment == PARAMETERS_ALIGNMENT, |
33 "Audio buffer parameters struct alignment not same as AudioBus"); | 33 "Audio buffer parameters struct alignment not same as AudioBus"); |
34 struct MEDIA_EXPORT ALIGNAS(PARAMETERS_ALIGNMENT) AudioInputBufferParameters { | 34 struct MEDIA_EXPORT ALIGNAS(PARAMETERS_ALIGNMENT) AudioInputBufferParameters { |
35 double volume; | 35 double volume; |
36 uint32_t size; | 36 uint32_t size; |
37 uint32_t hardware_delay_bytes; | 37 uint32_t hardware_delay_bytes; |
38 uint32_t id; | 38 uint32_t id; |
39 bool key_pressed; | 39 bool key_pressed; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return a.channels() < b.channels(); | 212 return a.channels() < b.channels(); |
213 if (a.sample_rate() != b.sample_rate()) | 213 if (a.sample_rate() != b.sample_rate()) |
214 return a.sample_rate() < b.sample_rate(); | 214 return a.sample_rate() < b.sample_rate(); |
215 if (a.bits_per_sample() != b.bits_per_sample()) | 215 if (a.bits_per_sample() != b.bits_per_sample()) |
216 return a.bits_per_sample() < b.bits_per_sample(); | 216 return a.bits_per_sample() < b.bits_per_sample(); |
217 return a.frames_per_buffer() < b.frames_per_buffer(); | 217 return a.frames_per_buffer() < b.frames_per_buffer(); |
218 } | 218 } |
219 | 219 |
220 } // namespace media | 220 } // namespace media |
221 | 221 |
222 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 222 #endif // MEDIA_BASE_AUDIO_PARAMETERS_H_ |
OLD | NEW |