Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1288)

Side by Side Diff: media/audio/audio_util.h

Issue 9655018: Make AudioParameters a class instead of a struct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright years Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_parameters_unittest.cc ('k') | media/audio/audio_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_UTIL_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_UTIL_H_
6 #define MEDIA_AUDIO_AUDIO_UTIL_H_ 6 #define MEDIA_AUDIO_AUDIO_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "media/base/channel_layout.h"
12 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
13 14
14 struct AudioParameters;
15
16 namespace base { 15 namespace base {
17 class SharedMemory; 16 class SharedMemory;
18 } 17 }
19 18
20 namespace media { 19 namespace media {
21 20
22 // For all audio functions 3 audio formats are supported: 21 // For all audio functions 3 audio formats are supported:
23 // 8 bits unsigned 0 to 255. 22 // 8 bits unsigned 0 to 255.
24 // 16 bit signed (little endian). 23 // 16 bit signed (little endian).
25 // 32 bit signed (little endian) 24 // 32 bit signed (little endian)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // floating-point audio contained in |source| to the int16 |destination|. 84 // floating-point audio contained in |source| to the int16 |destination|.
86 // The floating-point data is in a canonical range of -1.0 -> +1.0. 85 // The floating-point data is in a canonical range of -1.0 -> +1.0.
87 // The size of the |source| vector determines the number of channels. 86 // The size of the |source| vector determines the number of channels.
88 // The |destination| buffer is assumed to be large enough to hold the 87 // The |destination| buffer is assumed to be large enough to hold the
89 // result. Thus it must be at least size: number_of_frames * source.size() 88 // result. Thus it must be at least size: number_of_frames * source.size()
90 MEDIA_EXPORT void InterleaveFloatToInt16(const std::vector<float*>& source, 89 MEDIA_EXPORT void InterleaveFloatToInt16(const std::vector<float*>& source,
91 int16* destination, 90 int16* destination,
92 size_t number_of_frames); 91 size_t number_of_frames);
93 92
94 // Returns the default audio output hardware sample-rate. 93 // Returns the default audio output hardware sample-rate.
95 MEDIA_EXPORT double GetAudioHardwareSampleRate(); 94 MEDIA_EXPORT int GetAudioHardwareSampleRate();
96 95
97 // Returns the audio input hardware sample-rate for the specified device. 96 // Returns the audio input hardware sample-rate for the specified device.
98 MEDIA_EXPORT double GetAudioInputHardwareSampleRate( 97 MEDIA_EXPORT int GetAudioInputHardwareSampleRate(
99 const std::string& device_id); 98 const std::string& device_id);
100 99
101 // Returns the optimal low-latency buffer size for the audio hardware. 100 // Returns the optimal low-latency buffer size for the audio hardware.
102 // This is the smallest buffer size the system can comfortably render 101 // This is the smallest buffer size the system can comfortably render
103 // at without glitches. The buffer size is in sample-frames. 102 // at without glitches. The buffer size is in sample-frames.
104 MEDIA_EXPORT size_t GetAudioHardwareBufferSize(); 103 MEDIA_EXPORT size_t GetAudioHardwareBufferSize();
105 104
106 // Returns the number of channels for the specified audio input device. 105 // Returns the channel layout for the specified audio input device.
107 MEDIA_EXPORT uint32 GetAudioInputHardwareChannelCount( 106 MEDIA_EXPORT ChannelLayout GetAudioInputHardwareChannelLayout(
108 const std::string& device_id); 107 const std::string& device_id);
109 108
110 // Functions that handle data buffer passed between processes in the shared 109 // Functions that handle data buffer passed between processes in the shared
111 // memory. Called on both IPC sides. 110 // memory. Called on both IPC sides.
112 111
113 MEDIA_EXPORT uint32 TotalSharedMemorySizeInBytes(uint32 packet_size); 112 MEDIA_EXPORT uint32 TotalSharedMemorySizeInBytes(uint32 packet_size);
114 MEDIA_EXPORT uint32 PacketSizeSizeInBytes(uint32 shared_memory_created_size); 113 MEDIA_EXPORT uint32 PacketSizeSizeInBytes(uint32 shared_memory_created_size);
115 MEDIA_EXPORT uint32 GetActualDataSizeInBytes(base::SharedMemory* shared_memory, 114 MEDIA_EXPORT uint32 GetActualDataSizeInBytes(base::SharedMemory* shared_memory,
116 uint32 shared_memory_size); 115 uint32 shared_memory_size);
117 MEDIA_EXPORT void SetActualDataSizeInBytes(base::SharedMemory* shared_memory, 116 MEDIA_EXPORT void SetActualDataSizeInBytes(base::SharedMemory* shared_memory,
118 uint32 shared_memory_size, 117 uint32 shared_memory_size,
119 uint32 actual_data_size); 118 uint32 actual_data_size);
120 MEDIA_EXPORT void SetUnknownDataSize(base::SharedMemory* shared_memory, 119 MEDIA_EXPORT void SetUnknownDataSize(base::SharedMemory* shared_memory,
121 uint32 shared_memory_size); 120 uint32 shared_memory_size);
122 MEDIA_EXPORT bool IsUnknownDataSize(base::SharedMemory* shared_memory, 121 MEDIA_EXPORT bool IsUnknownDataSize(base::SharedMemory* shared_memory,
123 uint32 shared_memory_size); 122 uint32 shared_memory_size);
124 123
125 #if defined(OS_WIN) 124 #if defined(OS_WIN)
126 125
127 // Does Windows support WASAPI? We are checking in lot of places, and 126 // Does Windows support WASAPI? We are checking in lot of places, and
128 // sometimes check was written incorrectly, so move into separate function. 127 // sometimes check was written incorrectly, so move into separate function.
129 MEDIA_EXPORT bool IsWASAPISupported(); 128 MEDIA_EXPORT bool IsWASAPISupported();
130 129
131 #endif // defined(OS_WIN) 130 #endif // defined(OS_WIN)
132 131
133 } // namespace media 132 } // namespace media
134 133
135 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ 134 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_
OLDNEW
« no previous file with comments | « media/audio/audio_parameters_unittest.cc ('k') | media/audio/audio_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698