OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
bbudge
2017/03/31 00:24:59
nit: regenerate files, date should match IDL
Xing
2017/03/31 18:23:29
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // From dev/ppb_audio_output_dev.idl modified Thu Dec 15 11:00:50 2016. | |
6 | |
7 #include <stdint.h> | |
8 | |
9 #include "ppapi/c/dev/ppb_audio_output_dev.h" | |
10 #include "ppapi/c/pp_completion_callback.h" | |
11 #include "ppapi/c/pp_errors.h" | |
12 #include "ppapi/shared_impl/tracked_callback.h" | |
13 #include "ppapi/thunk/enter.h" | |
14 #include "ppapi/thunk/ppapi_thunk_export.h" | |
15 #include "ppapi/thunk/ppb_audio_output_api.h" | |
16 | |
17 namespace ppapi { | |
18 namespace thunk { | |
19 | |
20 namespace { | |
21 | |
22 PP_Resource Create(PP_Instance instance) { | |
23 VLOG(4) << "PPB_AudioOutput_Dev::Create()"; | |
24 EnterResourceCreation enter(instance); | |
25 if (enter.failed()) | |
26 return 0; | |
27 return enter.functions()->CreateAudioOutput(instance); | |
28 } | |
29 | |
30 PP_Bool IsAudioOutput(PP_Resource resource) { | |
31 VLOG(4) << "PPB_AudioOutput_Dev::IsAudioOutput()"; | |
32 EnterResource<PPB_AudioOutput_API> enter(resource, false); | |
33 return PP_FromBool(enter.succeeded()); | |
34 } | |
35 | |
36 int32_t EnumerateDevices(PP_Resource audio_output, | |
37 struct PP_ArrayOutput output, | |
38 struct PP_CompletionCallback callback) { | |
39 VLOG(4) << "PPB_AudioOutput_Dev::EnumerateDevices()"; | |
40 EnterResource<PPB_AudioOutput_API> enter(audio_output, callback, true); | |
41 if (enter.failed()) | |
42 return enter.retval(); | |
43 return enter.SetResult( | |
44 enter.object()->EnumerateDevices(output, enter.callback())); | |
45 } | |
46 | |
47 int32_t MonitorDeviceChange(PP_Resource audio_output, | |
48 PP_MonitorDeviceChangeCallback callback, | |
49 void* user_data) { | |
50 VLOG(4) << "PPB_AudioOutput_Dev::MonitorDeviceChange()"; | |
51 EnterResource<PPB_AudioOutput_API> enter(audio_output, true); | |
52 if (enter.failed()) | |
53 return enter.retval(); | |
54 return enter.object()->MonitorDeviceChange(callback, user_data); | |
55 } | |
56 | |
57 int32_t Open(PP_Resource audio_output, | |
58 PP_Resource device_ref, | |
59 PP_Resource config, | |
60 PPB_AudioOutput_Callback audio_output_callback, | |
61 void* user_data, | |
62 struct PP_CompletionCallback callback) { | |
63 VLOG(4) << "PPB_AudioOutput_Dev::Open()"; | |
64 EnterResource<PPB_AudioOutput_API> enter(audio_output, callback, true); | |
65 if (enter.failed()) | |
66 return enter.retval(); | |
67 return enter.SetResult(enter.object()->Open( | |
68 device_ref, config, audio_output_callback, user_data, enter.callback())); | |
69 } | |
70 | |
71 PP_Resource GetCurrentConfig(PP_Resource audio_output) { | |
72 VLOG(4) << "PPB_AudioOutput_Dev::GetCurrentConfig()"; | |
73 EnterResource<PPB_AudioOutput_API> enter(audio_output, true); | |
74 if (enter.failed()) | |
75 return 0; | |
76 return enter.object()->GetCurrentConfig(); | |
77 } | |
78 | |
79 PP_Bool StartPlayback(PP_Resource audio_output) { | |
80 VLOG(4) << "PPB_AudioOutput_Dev::StartPlayback()"; | |
81 EnterResource<PPB_AudioOutput_API> enter(audio_output, true); | |
82 if (enter.failed()) | |
83 return PP_FALSE; | |
84 return enter.object()->StartPlayback(); | |
85 } | |
86 | |
87 PP_Bool StopPlayback(PP_Resource audio_output) { | |
88 VLOG(4) << "PPB_AudioOutput_Dev::StopPlayback()"; | |
89 EnterResource<PPB_AudioOutput_API> enter(audio_output, true); | |
90 if (enter.failed()) | |
91 return PP_FALSE; | |
92 return enter.object()->StopPlayback(); | |
93 } | |
94 | |
95 void Close(PP_Resource audio_output) { | |
96 VLOG(4) << "PPB_AudioOutput_Dev::Close()"; | |
97 EnterResource<PPB_AudioOutput_API> enter(audio_output, true); | |
98 if (enter.failed()) | |
99 return; | |
100 enter.object()->Close(); | |
101 } | |
102 | |
103 const PPB_AudioOutput_Dev_0_1 g_ppb_audiooutput_dev_thunk_0_1 = { | |
104 &Create, &IsAudioOutput, &EnumerateDevices, &MonitorDeviceChange, | |
105 &Open, &GetCurrentConfig, &StartPlayback, &StopPlayback, | |
106 &Close}; | |
107 | |
108 } // namespace | |
109 | |
110 PPAPI_THUNK_EXPORT const PPB_AudioOutput_Dev_0_1* | |
111 GetPPB_AudioOutput_Dev_0_1_Thunk() { | |
112 return &g_ppb_audiooutput_dev_thunk_0_1; | |
113 } | |
114 | |
115 } // namespace thunk | |
116 } // namespace ppapi | |
OLD | NEW |