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

Side by Side Diff: ppapi/proxy/ppb_audio_proxy.h

Issue 4985001: Initial audio implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_PPB_AUDIO_PROXY_H_
6 #define PPAPI_PROXY_PPB_AUDIO_PROXY_H_
7
8 #include "base/basictypes.h"
9 #include "base/shared_memory.h"
10 #include "base/sync_socket.h"
11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_module.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/cpp/completion_callback.h"
15 #include "ppapi/proxy/interface_proxy.h"
16 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h"
17
18 struct PPB_Audio_Dev;
19
20 namespace pp {
21 namespace proxy {
22
23 class PPB_Audio_Proxy : public InterfaceProxy {
24 public:
25 PPB_Audio_Proxy(Dispatcher* dispatcher, const void* target_interface);
26 virtual ~PPB_Audio_Proxy();
27
28 const PPB_Audio_Dev* ppb_audio_target() const {
29 return static_cast<const PPB_Audio_Dev*>(target_interface());
30 }
31
32 // InterfaceProxy implementation.
33 virtual const void* GetSourceInterface() const;
34 virtual InterfaceID GetInterfaceId() const;
35 virtual void OnMessageReceived(const IPC::Message& msg);
36
37 private:
38 // The socket handle type depends on the platform, this saves some ifdefs.
39 #if defined(OS_WIN)
40 typedef base::SyncSocket::Handle SocketHandle;
41 #else
42 typedef base::FileDescriptor SocketHandle;
43 #endif
44 base::SyncSocket::Handle HandleFromSocketHandle(SocketHandle h);
45
46 // Plugin->renderer message handlers.
47 void OnMsgCreate(PP_Instance instance_id,
48 PP_Resource config_id,
49 PP_Resource* result);
50 void OnMsgStartOrStop(PP_Resource audio_id, bool play);
51
52 // Renderer->plugin message handlers.
53 void OnMsgNotifyAudioStreamCreated(
54 PP_Resource audio_id,
55 int32_t result_code,
56 SocketHandle socket_handle,
57 base::SharedMemoryHandle shared_memory_handle,
58 uint32_t shared_memory_length);
59
60 void AudioChannelConnected(int32_t result, PP_Resource resource);
61
62 // In the renderer, this is called in response to a stream created message.
63 // It will retrieve the shared memory and socket handles and place them into
64 // the given out params. The return value is a PPAPI error code.
65 //
66 // The input arguments should be initialized to 0 or -1, depending on the
67 // platform's default invalid handle values. On error, some of these
68 // arguments may be written to, and others may be untouched, depending on
69 // where the error occurred.
70 int32_t GetAudioConnectedHandles(
71 PP_Resource resource,
72 SocketHandle* foreign_socket_handle,
73 base::SharedMemoryHandle* foreign_shared_memory_handle,
74 int32_t* shared_memory_length);
75
76 CompletionCallbackFactory<PPB_Audio_Proxy,
77 ProxyNonThreadSafeRefCount> callback_factory_;
78
79 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Proxy);
80 };
81
82 } // namespace proxy
83 } // namespace pp
84
85 #endif // PPAPI_PROXY_PPB_AUDIO_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698