summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-18 00:14:24 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-18 00:14:24 +0000
commit1f8a089555312f281aa4074141e0945096d2a621 (patch)
tree32ace48d91e7eb290bd2b8df39e7fbc17282fcdf /ppapi/thunk
parentfc2436bac6a8e5f6839f6e62e8680a15e7d592eb (diff)
downloadchromium_src-1f8a089555312f281aa4074141e0945096d2a621.zip
chromium_src-1f8a089555312f281aa4074141e0945096d2a621.tar.gz
chromium_src-1f8a089555312f281aa4074141e0945096d2a621.tar.bz2
Revert 110602 - Revert 110587 - Microphone support for Pepper Flash.
[I think the Windows shared builders just need to be clobbered.] [Committing for pbrophy@adobe.com. Original review: http://codereview.chromium.org/8138008/ .] This change supports audio capture from the microphone and supplies the data through a Pepper interface. Its enumeration is limited to the default audio device that uses mono 44.1kHz. TBR=tony@chromium.org Review URL: http://codereview.chromium.org/8574029 TBR=viettrungluu@chromium.org Review URL: http://codereview.chromium.org/8569003 TBR=ajwong@chromium.org Review URL: http://codereview.chromium.org/8561003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110609 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h3
-rw-r--r--ppapi/thunk/ppb_audio_input_api.h33
-rw-r--r--ppapi/thunk/ppb_audio_input_thunk.cc74
-rw-r--r--ppapi/thunk/ppb_audio_input_trusted_thunk.cc67
-rw-r--r--ppapi/thunk/resource_creation_api.h9
-rw-r--r--ppapi/thunk/thunk.h3
6 files changed, 188 insertions, 1 deletions
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index 574c954..7ef9f30 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -7,6 +7,7 @@
#include "ppapi/thunk/interfaces_preamble.h"
+PROXIED_API(PPB_AudioInput)
PROXIED_API(PPB_Buffer)
PROXIED_API(PPB_Context3D)
PROXIED_API(PPB_CursorControl)
@@ -23,6 +24,8 @@ PROXIED_API(PPB_VideoCapture)
PROXIED_API(PPB_VideoDecoder)
UNPROXIED_API(PPB_Widget)
+PROXIED_IFACE(PPB_AudioInput, PPB_AUDIO_INPUT_DEV_INTERFACE_0_1,
+ PPB_AudioInput_Dev)
PROXIED_IFACE(NoAPIName, PPB_IME_INPUT_EVENT_DEV_INTERFACE_0_1,
PPB_IMEInputEvent_Dev)
PROXIED_IFACE(PPB_Buffer, PPB_BUFFER_DEV_INTERFACE_0_4, PPB_Buffer_Dev)
diff --git a/ppapi/thunk/ppb_audio_input_api.h b/ppapi/thunk/ppb_audio_input_api.h
new file mode 100644
index 0000000..f42f0d5
--- /dev/null
+++ b/ppapi/thunk/ppb_audio_input_api.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 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_THUNK_AUDIO_INPUT_API_H_
+#define PPAPI_THUNK_AUDIO_INPUT_API_H_
+
+#include "ppapi/c/dev/ppb_audio_input_dev.h"
+#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+
+namespace ppapi {
+namespace thunk {
+
+class PPB_AudioInput_API {
+ public:
+ virtual ~PPB_AudioInput_API() {}
+
+ virtual PP_Resource GetCurrentConfig() = 0;
+ virtual PP_Bool StartCapture() = 0;
+ virtual PP_Bool StopCapture() = 0;
+
+ // Trusted API.
+ virtual int32_t OpenTrusted(PP_Resource config_id,
+ PP_CompletionCallback create_callback) = 0;
+ virtual int32_t GetSyncSocket(int* sync_socket) = 0;
+ virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) = 0;
+};
+
+} // namespace thunk
+} // namespace ppapi
+
+#endif // PPAPI_THUNK_AUDIO_INPUT_API_H_
diff --git a/ppapi/thunk/ppb_audio_input_thunk.cc b/ppapi/thunk/ppb_audio_input_thunk.cc
new file mode 100644
index 0000000..7b6f31c
--- /dev/null
+++ b/ppapi/thunk/ppb_audio_input_thunk.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/thunk/common.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_input_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_AudioInput_API> EnterAudioInput;
+
+PP_Resource Create(PP_Instance instance,
+ PP_Resource config_id,
+ PPB_AudioInput_Callback callback,
+ void* user_data) {
+ EnterFunction<ResourceCreationAPI> enter(instance, true);
+ if (enter.failed())
+ return 0;
+
+ return enter.functions()->CreateAudioInput(instance, config_id,
+ callback, user_data);
+}
+
+PP_Bool IsAudioInput(PP_Resource resource) {
+ EnterAudioInput enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_Resource GetCurrentConfiguration(PP_Resource audio_id) {
+ EnterAudioInput enter(audio_id, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetCurrentConfig();
+}
+
+PP_Bool StartCapture(PP_Resource audio_input) {
+ EnterAudioInput enter(audio_input, true);
+ if (enter.failed())
+ return PP_FALSE;
+
+ return enter.object()->StartCapture();
+}
+
+PP_Bool StopCapture(PP_Resource audio_input) {
+ EnterAudioInput enter(audio_input, true);
+ if (enter.failed())
+ return PP_FALSE;
+
+ return enter.object()->StopCapture();
+}
+
+const PPB_AudioInput_Dev g_ppb_audioinput_thunk = {
+ &Create,
+ &IsAudioInput,
+ &GetCurrentConfiguration,
+ &StartCapture,
+ &StopCapture
+};
+
+} // namespace
+
+const PPB_AudioInput_Dev* GetPPB_AudioInput_Dev_Thunk() {
+ return &g_ppb_audioinput_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_audio_input_trusted_thunk.cc b/ppapi/thunk/ppb_audio_input_trusted_thunk.cc
new file mode 100644
index 0000000..1de878c
--- /dev/null
+++ b/ppapi/thunk/ppb_audio_input_trusted_thunk.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2011 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.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h"
+#include "ppapi/thunk/common.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_audio_input_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+typedef EnterResource<PPB_AudioInput_API> EnterAudioInput;
+
+PP_Resource Create(PP_Instance instance_id) {
+ EnterFunction<ResourceCreationAPI> enter(instance_id, true);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateAudioInputTrusted(instance_id);
+}
+
+int32_t Open(PP_Resource audio_id,
+ PP_Resource config_id,
+ PP_CompletionCallback create_callback) {
+ EnterAudioInput enter(audio_id, true);
+ if (enter.failed())
+ return MayForceCallback(create_callback, PP_ERROR_BADRESOURCE);
+ int32_t result = enter.object()->OpenTrusted(config_id, create_callback);
+ return MayForceCallback(create_callback, result);
+}
+
+int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) {
+ EnterAudioInput enter(audio_id, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.object()->GetSyncSocket(sync_socket);
+}
+
+int32_t GetSharedMemory(PP_Resource audio_id,
+ int* shm_handle,
+ uint32_t* shm_size) {
+ EnterAudioInput enter(audio_id, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.object()->GetSharedMemory(shm_handle, shm_size);
+}
+
+const PPB_AudioInputTrusted_Dev g_ppb_audioinput_trusted_thunk = {
+ &Create,
+ &Open,
+ &GetSyncSocket,
+ &GetSharedMemory,
+};
+
+} // namespace
+
+const PPB_AudioInputTrusted_Dev* GetPPB_AudioInputTrusted_Thunk() {
+ return &g_ppb_audioinput_trusted_thunk;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h
index dd37bed..b9e26d5 100644
--- a/ppapi/thunk/resource_creation_api.h
+++ b/ppapi/thunk/resource_creation_api.h
@@ -5,6 +5,7 @@
#ifndef PPAPI_THUNK_RESOURCE_CREATION_API_H_
#define PPAPI_THUNK_RESOURCE_CREATION_API_H_
+#include "ppapi/c/dev/ppb_audio_input_dev.h"
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/dev/ppb_video_layer_dev.h"
#include "ppapi/c/pp_bool.h"
@@ -43,10 +44,16 @@ class ResourceCreationAPI {
PP_Resource config_id,
PPB_Audio_Callback audio_callback,
void* user_data) = 0;
- virtual PP_Resource CreateAudioTrusted(PP_Instance instace) = 0;
+ virtual PP_Resource CreateAudioTrusted(PP_Instance instance) = 0;
virtual PP_Resource CreateAudioConfig(PP_Instance instance,
PP_AudioSampleRate sample_rate,
uint32_t sample_frame_count) = 0;
+ virtual PP_Resource CreateAudioInput(
+ PP_Instance instance,
+ PP_Resource config_id,
+ PPB_AudioInput_Callback audio_input_callback,
+ void* user_data) = 0;
+ virtual PP_Resource CreateAudioInputTrusted(PP_Instance instance) = 0;
virtual PP_Resource CreateBroker(PP_Instance instance) = 0;
virtual PP_Resource CreateBuffer(PP_Instance instance, uint32_t size) = 0;
virtual PP_Resource CreateContext3D(PP_Instance instance,
diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h
index 8990b94..5f6a62c 100644
--- a/ppapi/thunk/thunk.h
+++ b/ppapi/thunk/thunk.h
@@ -27,6 +27,7 @@
#undef PROXIED_IFACE
#undef IFACE
+struct PPB_AudioInputTrusted_Dev;
struct PPB_AudioTrusted;
struct PPB_BrokerTrusted;
struct PPB_BufferTrusted;
@@ -52,6 +53,8 @@ namespace thunk {
// Old-style thunk getters. Only put trusted/private stuff here (it hasn't
// yet been converted to the new system). Otherwise, add the declaration to
// the appropriate interfaces_*.h file.
+PPAPI_THUNK_EXPORT const PPB_AudioInputTrusted_Dev*
+ GetPPB_AudioInputTrusted_Thunk();
PPAPI_THUNK_EXPORT const PPB_AudioTrusted* GetPPB_AudioTrusted_Thunk();
PPAPI_THUNK_EXPORT const PPB_BrokerTrusted* GetPPB_Broker_Thunk();
PPAPI_THUNK_EXPORT const PPB_BufferTrusted* GetPPB_BufferTrusted_Thunk();