| 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_AUDIO_AUDIO_PARAMETERS_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 6 #define MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/base/channel_layout.h" | 10 #include "media/base/channel_layout.h" |
| 11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace media { |
| 14 | 14 |
| 15 struct MEDIA_EXPORT AudioInputBufferParameters { | 15 struct MEDIA_EXPORT AudioInputBufferParameters { |
| 16 double volume; | 16 double volume; |
| 17 uint32 size; | 17 uint32 size; |
| 18 bool key_pressed; | 18 bool key_pressed; |
| 19 }; | 19 }; |
| 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(AudioInputBufferParameters) + #(bytes in audio buffer) without | 22 // size as sizeof(AudioInputBufferParameters) + #(bytes in audio buffer) without |
| 23 // using packing. | 23 // using packing. |
| 24 struct MEDIA_EXPORT AudioInputBuffer { | 24 struct MEDIA_EXPORT AudioInputBuffer { |
| 25 AudioInputBufferParameters params; | 25 AudioInputBufferParameters params; |
| 26 int8 audio[1]; | 26 int8 audio[1]; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Used for audio buffer exchange in shared memory between processes with |
| 30 // buffer_index counting for synchronization without needing to block. |
| 31 struct MEDIA_EXPORT AudioSharedBuffer { |
| 32 uint32 buffer_index; |
| 33 int8 audio[1]; |
| 34 }; |
| 35 |
| 29 class MEDIA_EXPORT AudioParameters { | 36 class MEDIA_EXPORT AudioParameters { |
| 30 public: | 37 public: |
| 31 // TODO(miu): Rename this enum to something that correctly reflects its | 38 // TODO(miu): Rename this enum to something that correctly reflects its |
| 32 // semantics, such as "TransportScheme." | 39 // semantics, such as "TransportScheme." |
| 33 enum Format { | 40 enum Format { |
| 34 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. | 41 AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. |
| 35 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. | 42 AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. |
| 36 AUDIO_FAKE, // Creates a fake AudioOutputStream object. | 43 AUDIO_FAKE, // Creates a fake AudioOutputStream object. |
| 37 AUDIO_LAST_FORMAT // Only used for validation of format. | 44 AUDIO_LAST_FORMAT // Only used for validation of format. |
| 38 }; | 45 }; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (a.sample_rate() != b.sample_rate()) | 134 if (a.sample_rate() != b.sample_rate()) |
| 128 return a.sample_rate() < b.sample_rate(); | 135 return a.sample_rate() < b.sample_rate(); |
| 129 if (a.bits_per_sample() != b.bits_per_sample()) | 136 if (a.bits_per_sample() != b.bits_per_sample()) |
| 130 return a.bits_per_sample() < b.bits_per_sample(); | 137 return a.bits_per_sample() < b.bits_per_sample(); |
| 131 return a.frames_per_buffer() < b.frames_per_buffer(); | 138 return a.frames_per_buffer() < b.frames_per_buffer(); |
| 132 } | 139 } |
| 133 | 140 |
| 134 } // namespace media | 141 } // namespace media |
| 135 | 142 |
| 136 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ | 143 #endif // MEDIA_AUDIO_AUDIO_PARAMETERS_H_ |
| OLD | NEW |