Chromium Code Reviews| Index: ppapi/cpp/dev/audio_input_dev.h |
| diff --git a/ppapi/cpp/dev/audio_input_dev.h b/ppapi/cpp/dev/audio_input_dev.h |
| index 276143714783836583088fffbcc4ad64ddbc968d..a01938e6a9aa43b1c522e8ed7617de9d64cce0d7 100644 |
| --- a/ppapi/cpp/dev/audio_input_dev.h |
| +++ b/ppapi/cpp/dev/audio_input_dev.h |
| @@ -1,27 +1,35 @@ |
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_ |
| #define PPAPI_CPP_DEV_AUDIO_INPUT_DEV_H_ |
| +#include <vector> |
| + |
| #include "ppapi/c/dev/ppb_audio_input_dev.h" |
| #include "ppapi/cpp/audio_config.h" |
| #include "ppapi/cpp/resource.h" |
| namespace pp { |
| +class CompletionCallback; |
| +class DeviceRef_Dev; |
| class InstanceHandle; |
| class AudioInput_Dev : public Resource { |
| public: |
| /// An empty constructor for an AudioInput resource. |
| - AudioInput_Dev() {} |
| - |
| + AudioInput_Dev(); |
| 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.
|
| const AudioConfig& config, |
| PPB_AudioInput_Callback callback, |
| void* user_data); |
| + AudioInput_Dev(const AudioInput_Dev& other); |
| + |
| + virtual ~AudioInput_Dev(); |
| + |
| + AudioInput_Dev& operator=(const AudioInput_Dev& other); |
| /// Static function for determining whether the browser supports the required |
| /// AudioInput interface. |
| @@ -42,11 +50,43 @@ class AudioInput_Dev : public Resource { |
| /// struct. |
| const AudioConfig& config() const { return config_; } |
| + /// |devices| must stay alive until either this AudioInput_Dev object goes |
| + /// away or |callback| is run, if this method returns PP_OK_COMPLETIONPENDING. |
| + int32_t EnumerateDevices(std::vector<DeviceRef_Dev>* devices, |
| + const CompletionCallback& callback); |
| + |
| + /// If |device_ref| is null (i.e., is_null() returns true), the default device |
| + /// will be used. |
| + /// 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.
|
| + /// input parameters config, audio_input_callback and user_data. |
| + /// Instead, it uses those values stored when the resource was created. |
| + /// |
| + /// TODO(yzshen): Change it to match the C interface once we don't expect |
| + /// the users of this wrapper to work with Chrome that only supports the v0.1 |
| + /// interface. |
| + int32_t Open(const DeviceRef_Dev& device_ref, |
| + const CompletionCallback& callback); |
| bool StartCapture(); |
| bool StopCapture(); |
| + void Close(); |
| private: |
| + struct EnumerateDevicesState; |
| + |
| + void AbortEnumerateDevices(); |
| + |
| + // |user_data| is an EnumerateDevicesState object. It is this method's |
| + // responsibility to delete it. |
| + static void OnEnumerateDevicesComplete(void* user_data, int32_t result); |
| + |
| AudioConfig config_; |
| + |
| + // Not owned by this object. |
| + EnumerateDevicesState* enum_state_; |
| + |
| + // Used to store the arguments of Open() for the v0.2 interface. |
| + PPB_AudioInput_Callback audio_input_callback_; |
| + void* user_data_; |
| }; |
| } // namespace pp |