1 // Copyright (c) 2012 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.
5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/c/ppb_audio.h"
7 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_audio_api.h"
10 #include "ppapi/thunk/ppb_instance_api.h"
11 #include "ppapi/thunk/resource_creation_api.h"
12 #include "ppapi/thunk/thunk.h"
19 PP_Resource
Create_1_0(PP_Instance instance
,
21 PPB_Audio_Callback_1_0 audio_callback
,
23 VLOG(4) << "PPB_Audio::Create()";
24 EnterResourceCreation
enter(instance
);
27 return enter
.functions()->CreateAudio1_0(instance
,
33 PP_Resource
Create(PP_Instance instance
,
35 PPB_Audio_Callback audio_callback
,
37 VLOG(4) << "PPB_Audio::Create()";
38 EnterResourceCreation
enter(instance
);
41 return enter
.functions()->CreateAudio(instance
,
47 PP_Bool
IsAudio(PP_Resource resource
) {
48 VLOG(4) << "PPB_Audio::IsAudio()";
49 EnterResource
<PPB_Audio_API
> enter(resource
, false);
50 return PP_FromBool(enter
.succeeded());
53 PP_Resource
GetCurrentConfig(PP_Resource audio
) {
54 VLOG(4) << "PPB_Audio::GetCurrentConfig()";
55 EnterResource
<PPB_Audio_API
> enter(audio
, true);
58 return enter
.object()->GetCurrentConfig();
61 PP_Bool
StartPlayback(PP_Resource audio
) {
62 VLOG(4) << "PPB_Audio::StartPlayback()";
63 EnterResource
<PPB_Audio_API
> enter(audio
, true);
66 return enter
.object()->StartPlayback();
69 PP_Bool
StopPlayback(PP_Resource audio
) {
70 VLOG(4) << "PPB_Audio::StopPlayback()";
71 EnterResource
<PPB_Audio_API
> enter(audio
, true);
74 return enter
.object()->StopPlayback();
77 const PPB_Audio_1_0 g_ppb_audio_thunk_1_0
= {
85 const PPB_Audio_1_1 g_ppb_audio_thunk_1_1
= {
95 const PPB_Audio_1_0
* GetPPB_Audio_1_0_Thunk() {
96 return &g_ppb_audio_thunk_1_0
;
99 const PPB_Audio_1_1
* GetPPB_Audio_1_1_Thunk() {
100 return &g_ppb_audio_thunk_1_1
;