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

Side by Side Diff: media/audio/cras/cras_input.h

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
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_CRAS_CRAS_INPUT_H_ 5 #ifndef MEDIA_AUDIO_CRAS_CRAS_INPUT_H_
6 #define MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ 6 #define MEDIA_AUDIO_CRAS_CRAS_INPUT_H_
7 7
8 #include <cras_client.h> 8 #include <cras_client.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 double GetMaxVolume() override; 42 double GetMaxVolume() override;
43 void SetVolume(double volume) override; 43 void SetVolume(double volume) override;
44 double GetVolume() override; 44 double GetVolume() override;
45 bool IsMuted() override; 45 bool IsMuted() override;
46 46
47 private: 47 private:
48 // Handles requests to get samples from the provided buffer. This will be 48 // Handles requests to get samples from the provided buffer. This will be
49 // called by the audio server when it has samples ready. 49 // called by the audio server when it has samples ready.
50 static int SamplesReady(cras_client* client, 50 static int SamplesReady(cras_client* client,
51 cras_stream_id_t stream_id, 51 cras_stream_id_t stream_id,
52 uint8* samples, 52 uint8_t* samples,
53 size_t frames, 53 size_t frames,
54 const timespec* sample_ts, 54 const timespec* sample_ts,
55 void* arg); 55 void* arg);
56 56
57 // Handles notification that there was an error with the playback stream. 57 // Handles notification that there was an error with the playback stream.
58 static int StreamError(cras_client* client, 58 static int StreamError(cras_client* client,
59 cras_stream_id_t stream_id, 59 cras_stream_id_t stream_id,
60 int err, 60 int err,
61 void* arg); 61 void* arg);
62 62
63 // Reads one or more buffers of audio from the device, passes on to the 63 // Reads one or more buffers of audio from the device, passes on to the
64 // registered callback. Called from SamplesReady(). 64 // registered callback. Called from SamplesReady().
65 void ReadAudio(size_t frames, uint8* buffer, const timespec* sample_ts); 65 void ReadAudio(size_t frames, uint8_t* buffer, const timespec* sample_ts);
66 66
67 // Deals with an error that occured in the stream. Called from StreamError(). 67 // Deals with an error that occured in the stream. Called from StreamError().
68 void NotifyStreamError(int err); 68 void NotifyStreamError(int err);
69 69
70 // Convert from dB * 100 to a volume ratio. 70 // Convert from dB * 100 to a volume ratio.
71 double GetVolumeRatioFromDecibels(double dB) const; 71 double GetVolumeRatioFromDecibels(double dB) const;
72 72
73 // Convert from a volume ratio to dB. 73 // Convert from a volume ratio to dB.
74 double GetDecibelsFromVolumeRatio(double volume_ratio) const; 74 double GetDecibelsFromVolumeRatio(double volume_ratio) const;
75 75
76 // Non-refcounted pointer back to the audio manager. 76 // Non-refcounted pointer back to the audio manager.
77 // The AudioManager indirectly holds on to stream objects, so we don't 77 // The AudioManager indirectly holds on to stream objects, so we don't
78 // want circular references. Additionally, stream objects live on the audio 78 // want circular references. Additionally, stream objects live on the audio
79 // thread, which is owned by the audio manager and we don't want to addref 79 // thread, which is owned by the audio manager and we don't want to addref
80 // the manager from that thread. 80 // the manager from that thread.
81 AudioManagerCras* const audio_manager_; 81 AudioManagerCras* const audio_manager_;
82 82
83 // Size of frame in bytes. 83 // Size of frame in bytes.
84 uint32 bytes_per_frame_; 84 uint32_t bytes_per_frame_;
85 85
86 // Callback to pass audio samples too, valid while recording. 86 // Callback to pass audio samples too, valid while recording.
87 AudioInputCallback* callback_; 87 AudioInputCallback* callback_;
88 88
89 // The client used to communicate with the audio server. 89 // The client used to communicate with the audio server.
90 cras_client* client_; 90 cras_client* client_;
91 91
92 // PCM parameters for the stream. 92 // PCM parameters for the stream.
93 const AudioParameters params_; 93 const AudioParameters params_;
94 94
(...skipping 13 matching lines...) Expand all
108 bool is_loopback_; 108 bool is_loopback_;
109 109
110 scoped_ptr<AudioBus> audio_bus_; 110 scoped_ptr<AudioBus> audio_bus_;
111 111
112 DISALLOW_COPY_AND_ASSIGN(CrasInputStream); 112 DISALLOW_COPY_AND_ASSIGN(CrasInputStream);
113 }; 113 };
114 114
115 } // namespace media 115 } // namespace media
116 116
117 #endif // MEDIA_AUDIO_CRAS_CRAS_INPUT_H_ 117 #endif // MEDIA_AUDIO_CRAS_CRAS_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698