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

Side by Side Diff: webkit/plugins/ppapi/plugin_delegate.h

Issue 9705056: PepperPlatformAudioInputImpl: support audio input device selection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
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 WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ 5 #ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ 6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Set an optional callback that will be invoked when the context is lost 190 // Set an optional callback that will be invoked when the context is lost
191 // (e.g. gpu process crash). Takes ownership of the callback. 191 // (e.g. gpu process crash). Takes ownership of the callback.
192 virtual void SetContextLostCallback( 192 virtual void SetContextLostCallback(
193 const base::Callback<void()>& callback) = 0; 193 const base::Callback<void()>& callback) = 0;
194 194
195 // Run the callback once the channel has been flushed. 195 // Run the callback once the channel has been flushed.
196 virtual bool Echo(const base::Callback<void()>& callback) = 0; 196 virtual bool Echo(const base::Callback<void()>& callback) = 0;
197 }; 197 };
198 198
199 // The (interface for the) client used by |PlatformAudio| and 199 // The base class of clients used by |PlatformAudioOutput| and
200 // |PlatformAudioInput|. 200 // |PlatformAudioInput|.
201 class PlatformAudioCommonClient { 201 class PlatformAudioClientBase {
202 protected: 202 protected:
203 virtual ~PlatformAudioCommonClient() {} 203 virtual ~PlatformAudioClientBase() {}
204 204
205 public: 205 public:
206 // Called when the stream is created. 206 // Called when the stream is created.
207 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, 207 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
208 size_t shared_memory_size, 208 size_t shared_memory_size,
209 base::SyncSocket::Handle socket) = 0; 209 base::SyncSocket::Handle socket) = 0;
210 }; 210 };
211 211
212 class PlatformAudioOutputClient : public PlatformAudioClientBase {
213 protected:
214 virtual ~PlatformAudioOutputClient() {}
215 };
216
212 class PlatformAudioOutput { 217 class PlatformAudioOutput {
213 public: 218 public:
214 // Starts the playback. Returns false on error or if called before the 219 // Starts the playback. Returns false on error or if called before the
215 // stream is created or after the stream is closed. 220 // stream is created or after the stream is closed.
216 virtual bool StartPlayback() = 0; 221 virtual bool StartPlayback() = 0;
217 222
218 // Stops the playback. Returns false on error or if called before the stream 223 // Stops the playback. Returns false on error or if called before the stream
219 // is created or after the stream is closed. 224 // is created or after the stream is closed.
220 virtual bool StopPlayback() = 0; 225 virtual bool StopPlayback() = 0;
221 226
222 // Closes the stream. Make sure to call this before the object is 227 // Closes the stream. Make sure to call this before the object is
223 // destructed. 228 // destructed.
224 virtual void ShutDown() = 0; 229 virtual void ShutDown() = 0;
225 230
226 protected: 231 protected:
227 virtual ~PlatformAudioOutput() {} 232 virtual ~PlatformAudioOutput() {}
228 }; 233 };
229 234
235 class PlatformAudioInputClient : public PlatformAudioClientBase {
236 public:
237 virtual void StreamCreationFailed() = 0;
238
239 protected:
240 virtual ~PlatformAudioInputClient() {}
241 };
242
230 class PlatformAudioInput { 243 class PlatformAudioInput {
231 public: 244 public:
232 // Starts the capture. Returns false on error or if called before the 245 // Starts the capture.
viettrungluu 2012/03/20 18:20:02 Nit: I think this comment is now officially useles
yzshen1 2012/03/21 17:55:46 Done.
233 // stream is created or after the stream is closed. 246 virtual void StartCapture() = 0;
234 virtual bool StartCapture() = 0;
235 247
236 // Stops the capture. Returns false on error or if called before the stream 248 // Stops the capture.
viettrungluu 2012/03/20 18:20:02 "
yzshen1 2012/03/21 17:55:46 Done.
237 // is created or after the stream is closed. 249 virtual void StopCapture() = 0;
238 virtual bool StopCapture() = 0;
239 250
240 // Closes the stream. Make sure to call this before the object is 251 // Closes the stream. Make sure to call this before the object is
241 // destructed. 252 // destructed.
242 virtual void ShutDown() = 0; 253 virtual void ShutDown() = 0;
243 254
244 protected: 255 protected:
245 virtual ~PlatformAudioInput() {} 256 virtual ~PlatformAudioInput() {}
246 }; 257 };
247 258
248 // Interface for PlatformVideoDecoder is directly inherited from general media 259 // Interface for PlatformVideoDecoder is directly inherited from general media
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 virtual uint32_t GetAudioHardwareOutputSampleRate() = 0; 350 virtual uint32_t GetAudioHardwareOutputSampleRate() = 0;
340 351
341 // Get audio hardware output buffer size. 352 // Get audio hardware output buffer size.
342 virtual uint32_t GetAudioHardwareOutputBufferSize() = 0; 353 virtual uint32_t GetAudioHardwareOutputBufferSize() = 0;
343 354
344 // The caller is responsible for calling Shutdown() on the returned pointer 355 // The caller is responsible for calling Shutdown() on the returned pointer
345 // to clean up the corresponding resources allocated during this call. 356 // to clean up the corresponding resources allocated during this call.
346 virtual PlatformAudioOutput* CreateAudioOutput( 357 virtual PlatformAudioOutput* CreateAudioOutput(
347 uint32_t sample_rate, 358 uint32_t sample_rate,
348 uint32_t sample_count, 359 uint32_t sample_count,
349 PlatformAudioCommonClient* client) = 0; 360 PlatformAudioOutputClient* client) = 0;
350 361
362 // If |device_id| is empty, the default audio input device will be used.
351 // The caller is responsible for calling Shutdown() on the returned pointer 363 // The caller is responsible for calling Shutdown() on the returned pointer
352 // to clean up the corresponding resources allocated during this call. 364 // to clean up the corresponding resources allocated during this call.
353 virtual PlatformAudioInput* CreateAudioInput( 365 virtual PlatformAudioInput* CreateAudioInput(
366 const std::string& device_id,
354 uint32_t sample_rate, 367 uint32_t sample_rate,
355 uint32_t sample_count, 368 uint32_t sample_count,
356 PlatformAudioCommonClient* client) = 0; 369 PlatformAudioInputClient* client) = 0;
357 370
358 // A pointer is returned immediately, but it is not ready to be used until 371 // A pointer is returned immediately, but it is not ready to be used until
359 // BrokerConnected has been called. 372 // BrokerConnected has been called.
360 // The caller is responsible for calling Release() on the returned pointer 373 // The caller is responsible for calling Release() on the returned pointer
361 // to clean up the corresponding resources allocated during this call. 374 // to clean up the corresponding resources allocated during this call.
362 virtual Broker* ConnectToBroker(webkit::ppapi::PPB_Broker_Impl* client) = 0; 375 virtual Broker* ConnectToBroker(webkit::ppapi::PPB_Broker_Impl* client) = 0;
363 376
364 // Notifies that the number of find results has changed. 377 // Notifies that the number of find results has changed.
365 virtual void NumberOfFindResultsChanged(int identifier, 378 virtual void NumberOfFindResultsChanged(int identifier,
366 int total, 379 int total,
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 const EnumerateDevicesCallback& callback) = 0; 615 const EnumerateDevicesCallback& callback) = 0;
603 // Create a ClipboardClient for writing to the clipboard. The caller will own 616 // Create a ClipboardClient for writing to the clipboard. The caller will own
604 // the pointer to this. 617 // the pointer to this.
605 virtual webkit_glue::ClipboardClient* CreateClipboardClient() const = 0; 618 virtual webkit_glue::ClipboardClient* CreateClipboardClient() const = 0;
606 }; 619 };
607 620
608 } // namespace ppapi 621 } // namespace ppapi
609 } // namespace webkit 622 } // namespace webkit
610 623
611 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ 624 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/mock_plugin_delegate.cc ('k') | webkit/plugins/ppapi/ppb_audio_input_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698