OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ |
7 | 7 |
| 8 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_instance.h" |
8 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
9 | 11 |
10 #define PPB_AUDIO_TRUSTED_DEV_INTERFACE "PPB_AudioTrusted(Dev);0.1" | 12 #define PPB_AUDIO_TRUSTED_DEV_INTERFACE "PPB_AudioTrusted(Dev);0.2" |
11 | 13 |
12 // This interface is used to get access to the audio buffer and a socket on | 14 // This interface is to be used by proxy implementations. All |
13 // which the client can block until the audio is ready to accept more data. | 15 // functions should be called from the main thread only. The |
14 // This interface should be used by NaCl to implement the Audio interface. | 16 // resource returned is an Audio resource; most of the PPB_Audio_Dev |
| 17 // interface is also usable on this resource. |
15 struct PPB_AudioTrusted_Dev { | 18 struct PPB_AudioTrusted_Dev { |
16 // Returns a Buffer object that has the audio buffer. | 19 // Returns an audio resource. |
17 PP_Resource (*GetBuffer)(PP_Resource audio); | 20 PP_Resource (*CreateTrusted)(PP_Instance instance); |
18 | 21 |
19 // Returns a select()-able/Wait()-able OS-specific descriptor. The browser | 22 // Opens a paused audio interface, used by trusted side of proxy. |
20 // will put a byte on the socket each time the buffer is ready to be filled. | 23 // Returns PP_ERROR_WOULD_BLOCK on success, and invokes |
21 // The plugin can then implement its own audio thread using select()/poll() to | 24 // the |create_callback| asynchronously to complete. |
22 // block until the browser is ready to receive data. | 25 // As this function should always be invoked from the main thread, |
23 int (*GetOSDescriptor)(PP_Resource audio); | 26 // do not use the blocking variant of PP_CompletionCallback. |
| 27 int32_t (*Open)(PP_Resource audio, PP_Resource config, |
| 28 struct PP_CompletionCallback create_callback); |
| 29 |
| 30 // Get the sync socket. Use once Open has completed. |
| 31 // Returns PP_OK on success. |
| 32 int32_t (*GetSyncSocket)(PP_Resource audio, int* sync_socket); |
| 33 |
| 34 // Get the shared memory interface. Use once Open has completed. |
| 35 // Returns PP_OK on success. |
| 36 int32_t (*GetSharedMemory)(PP_Resource audio, |
| 37 int* shm_handle, |
| 38 int32_t* shm_size); |
24 }; | 39 }; |
25 | 40 |
26 #endif // PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ | 41 #endif // PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ |
27 | |
OLD | NEW |