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

Side by Side Diff: ppapi/cpp/dev/audio_input_dev.h

Issue 9557007: PPB_AudioInput_Dev: support multiple audio input devices - Part 1. (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) 2011 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 PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_ 5 #ifndef PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_
6 #define PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_ 6 #define PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_
7 7
8 #include <vector>
9
8 #include "ppapi/c/dev/ppb_audio_input_dev.h" 10 #include "ppapi/c/dev/ppb_audio_input_dev.h"
9 #include "ppapi/cpp/audio_config.h" 11 #include "ppapi/cpp/audio_config.h"
10 #include "ppapi/cpp/resource.h" 12 #include "ppapi/cpp/resource.h"
11 13
12 namespace pp { 14 namespace pp {
13 15
16 class CompletionCallback;
17 class DeviceRef_Dev;
14 class InstanceHandle; 18 class InstanceHandle;
15 19
16 class AudioInput_Dev : public Resource { 20 class AudioInput_Dev : public Resource {
17 public: 21 public:
18 /// An empty constructor for an AudioInput resource. 22 /// An empty constructor for an AudioInput resource.
19 AudioInput_Dev() {} 23 AudioInput_Dev();
20
21 AudioInput_Dev(const InstanceHandle& instance, 24 AudioInput_Dev(const InstanceHandle& instance,
brettw 2012/03/02 19:13:41 Can you mark this deprecated?
yzshen1 2012/03/04 08:04:01 Done.
22 const AudioConfig& config, 25 const AudioConfig& config,
23 PPB_AudioInput_Callback callback, 26 PPB_AudioInput_Callback callback,
24 void* user_data); 27 void* user_data);
28 AudioInput_Dev(const AudioInput_Dev& other);
29
30 virtual ~AudioInput_Dev();
31
32 AudioInput_Dev& operator=(const AudioInput_Dev& other);
25 33
26 /// Static function for determining whether the browser supports the required 34 /// Static function for determining whether the browser supports the required
27 /// AudioInput interface. 35 /// AudioInput interface.
28 /// 36 ///
29 /// @return true if the interface is available, false otherwise. 37 /// @return true if the interface is available, false otherwise.
30 static bool IsAvailable(); 38 static bool IsAvailable();
31 39
32 /// Getter function for returning the internal <code>PPB_AudioConfig</code> 40 /// Getter function for returning the internal <code>PPB_AudioConfig</code>
33 /// struct. 41 /// struct.
34 /// 42 ///
35 /// @return A mutable reference to the PPB_AudioConfig struct. 43 /// @return A mutable reference to the PPB_AudioConfig struct.
36 AudioConfig& config() { return config_; } 44 AudioConfig& config() { return config_; }
37 45
38 /// Getter function for returning the internal <code>PPB_AudioConfig</code> 46 /// Getter function for returning the internal <code>PPB_AudioConfig</code>
39 /// struct. 47 /// struct.
40 /// 48 ///
41 /// @return A const reference to the internal <code>PPB_AudioConfig</code> 49 /// @return A const reference to the internal <code>PPB_AudioConfig</code>
42 /// struct. 50 /// struct.
43 const AudioConfig& config() const { return config_; } 51 const AudioConfig& config() const { return config_; }
44 52
53 /// |devices| must stay alive until either this AudioInput_Dev object goes
54 /// away or |callback| is run, if this method returns PP_OK_COMPLETIONPENDING.
55 int32_t EnumerateDevices(std::vector<DeviceRef_Dev>* devices,
56 const CompletionCallback& callback);
57
58 /// If |device_ref| is null (i.e., is_null() returns true), the default device
59 /// will be used.
60 /// In order to maintain backward compatibility, this method doesn't have
brettw 2012/03/02 19:13:41 Can we have a overloaded version of Open() that ha
yzshen1 2012/03/04 08:04:01 Done.
61 /// input parameters config, audio_input_callback and user_data.
62 /// Instead, it uses those values stored when the resource was created.
63 ///
64 /// TODO(yzshen): Change it to match the C interface once we don't expect
65 /// the users of this wrapper to work with Chrome that only supports the v0.1
66 /// interface.
67 int32_t Open(const DeviceRef_Dev& device_ref,
68 const CompletionCallback& callback);
45 bool StartCapture(); 69 bool StartCapture();
46 bool StopCapture(); 70 bool StopCapture();
71 void Close();
47 72
48 private: 73 private:
74 struct EnumerateDevicesState;
75
76 void AbortEnumerateDevices();
77
78 // |user_data| is an EnumerateDevicesState object. It is this method's
79 // responsibility to delete it.
80 static void OnEnumerateDevicesComplete(void* user_data, int32_t result);
81
49 AudioConfig config_; 82 AudioConfig config_;
83
84 // Not owned by this object.
85 EnumerateDevicesState* enum_state_;
86
87 // Used to store the arguments of Open() for the v0.2 interface.
88 PPB_AudioInput_Callback audio_input_callback_;
89 void* user_data_;
50 }; 90 };
51 91
52 } // namespace pp 92 } // namespace pp
53 93
54 #endif // PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_ 94 #endif // PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698