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

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

Issue 11366038: Rewrite PPB_AudioInput_Dev to use the new-style host/resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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 | « ppapi/c/trusted/ppb_audio_input_trusted_dev.h ('k') | ppapi/cpp/dev/audio_input_dev.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 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> 8 #include <vector>
9 9
10 #include "ppapi/c/dev/ppb_audio_input_dev.h" 10 #include "ppapi/c/dev/ppb_audio_input_dev.h"
11 #include "ppapi/cpp/audio_config.h" 11 #include "ppapi/cpp/audio_config.h"
12 #include "ppapi/cpp/completion_callback.h" 12 #include "ppapi/cpp/completion_callback.h"
13 #include "ppapi/cpp/dev/device_ref_dev.h" 13 #include "ppapi/cpp/dev/device_ref_dev.h"
14 #include "ppapi/cpp/resource.h" 14 #include "ppapi/cpp/resource.h"
15 15
16 namespace pp { 16 namespace pp {
17 17
18 class InstanceHandle; 18 class InstanceHandle;
19 19
20 class AudioInput_Dev : public Resource { 20 class AudioInput_Dev : public Resource {
21 public: 21 public:
22 /// An empty constructor for an AudioInput resource. 22 /// An empty constructor for an AudioInput resource.
23 AudioInput_Dev(); 23 AudioInput_Dev();
24 24
25 /// This constructor tries to create an audio input resource using the v0.2 25 /// Constructor to create an audio input resource.
26 /// interface, and falls back on the v0.1 interface if that is not available.
27 /// Please use the 2-parameter Open() if you used this constructor.
28 ///
29 /// Note: This constructor is deprecated. Unless your code has to deal with
30 /// browsers that only support the v0.1 interface, please use the 1-parameter
31 /// constructor instead.
32 AudioInput_Dev(const InstanceHandle& instance,
33 const AudioConfig& config,
34 PPB_AudioInput_Callback callback,
35 void* user_data);
36
37 /// This constructor uses the v0.2 interface to create an audio input
38 /// resource. Please use the 5-parameter Open() if you used this constructor.
39 explicit AudioInput_Dev(const InstanceHandle& instance); 26 explicit AudioInput_Dev(const InstanceHandle& instance);
40 27
41 virtual ~AudioInput_Dev(); 28 virtual ~AudioInput_Dev();
42 29
43 /// Static function for determining whether the browser supports the required 30 /// Static function for determining whether the browser supports the required
44 /// AudioInput interface. 31 /// AudioInput interface.
45 /// 32 ///
46 /// @return true if the interface is available, false otherwise. 33 /// @return true if the interface is available, false otherwise.
47 static bool IsAvailable(); 34 static bool IsAvailable();
48 35
49 /// Getter function for returning the internal <code>PPB_AudioConfig</code>
50 /// struct.
51 ///
52 /// @return A mutable reference to the PPB_AudioConfig struct.
53 AudioConfig& config() { return config_; }
54
55 /// Getter function for returning the internal <code>PPB_AudioConfig</code>
56 /// struct.
57 ///
58 /// @return A const reference to the internal <code>PPB_AudioConfig</code>
59 /// struct.
60 const AudioConfig& config() const { return config_; }
61
62 int32_t EnumerateDevices( 36 int32_t EnumerateDevices(
63 const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >& 37 const CompletionCallbackWithOutput<std::vector<DeviceRef_Dev> >&
64 callback); 38 callback);
65 39
66 /// If |device_ref| is null (i.e., is_null() returns true), the default device 40 /// If |device_ref| is null (i.e., is_null() returns true), the default device
67 /// will be used. 41 /// will be used.
68 /// In order to maintain backward compatibility, this method doesn't have
69 /// input parameters config, audio_input_callback and user_data. Instead, it
70 /// uses those values stored when the 4-parameter constructor was called.
71 ///
72 /// Note: This method is deprecated. Unless your code has to deal with
73 /// browsers that only support the v0.1 interface, please use the other
74 /// Open().
75 int32_t Open(const DeviceRef_Dev& device_ref,
76 const CompletionCallback& callback);
77
78 int32_t Open(const DeviceRef_Dev& device_ref, 42 int32_t Open(const DeviceRef_Dev& device_ref,
79 const AudioConfig& config, 43 const AudioConfig& config,
80 PPB_AudioInput_Callback audio_input_callback, 44 PPB_AudioInput_Callback audio_input_callback,
81 void* user_data, 45 void* user_data,
82 const CompletionCallback& callback); 46 const CompletionCallback& callback);
83 47
84 bool StartCapture(); 48 bool StartCapture();
85 bool StopCapture(); 49 bool StopCapture();
86 void Close(); 50 void Close();
87
88 private:
89 AudioConfig config_;
90
91 // Used to store the arguments of Open() for the v0.2 interface.
92 PPB_AudioInput_Callback audio_input_callback_;
93 void* user_data_;
94 }; 51 };
95 52
96 } // namespace pp 53 } // namespace pp
97 54
98 #endif // PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_ 55 #endif // PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_
OLDNEW
« no previous file with comments | « ppapi/c/trusted/ppb_audio_input_trusted_dev.h ('k') | ppapi/cpp/dev/audio_input_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698