Roll Syzygy deps to 0.8.6.4.
[chromium-blink-merge.git] / ppapi / thunk / ppb_media_stream_audio_track_thunk.cc
blobc63cfe94511caf4439a04a73852ab3533c6062fb
1 // Copyright 2014 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 // From ppb_media_stream_audio_track.idl modified Thu Sep 18 11:36:39 2014.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_media_stream_audio_track.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_media_stream_audio_track_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 PP_Bool IsMediaStreamAudioTrack(PP_Resource resource) {
21 VLOG(4) << "PPB_MediaStreamAudioTrack::IsMediaStreamAudioTrack()";
22 EnterResource<PPB_MediaStreamAudioTrack_API> enter(resource, false);
23 return PP_FromBool(enter.succeeded());
26 int32_t Configure(PP_Resource audio_track,
27 const int32_t attrib_list[],
28 struct PP_CompletionCallback callback) {
29 VLOG(4) << "PPB_MediaStreamAudioTrack::Configure()";
30 EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, callback,
31 true);
32 if (enter.failed())
33 return enter.retval();
34 return enter.SetResult(
35 enter.object()->Configure(attrib_list, enter.callback()));
38 int32_t GetAttrib(PP_Resource audio_track,
39 PP_MediaStreamAudioTrack_Attrib attrib,
40 int32_t* value) {
41 VLOG(4) << "PPB_MediaStreamAudioTrack::GetAttrib()";
42 EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, true);
43 if (enter.failed())
44 return enter.retval();
45 return enter.object()->GetAttrib(attrib, value);
48 struct PP_Var GetId(PP_Resource audio_track) {
49 VLOG(4) << "PPB_MediaStreamAudioTrack::GetId()";
50 EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, true);
51 if (enter.failed())
52 return PP_MakeUndefined();
53 return enter.object()->GetId();
56 PP_Bool HasEnded(PP_Resource audio_track) {
57 VLOG(4) << "PPB_MediaStreamAudioTrack::HasEnded()";
58 EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, true);
59 if (enter.failed())
60 return PP_TRUE;
61 return enter.object()->HasEnded();
64 int32_t GetBuffer(PP_Resource audio_track,
65 PP_Resource* buffer,
66 struct PP_CompletionCallback callback) {
67 VLOG(4) << "PPB_MediaStreamAudioTrack::GetBuffer()";
68 EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, callback,
69 true);
70 if (enter.failed())
71 return enter.retval();
72 return enter.SetResult(enter.object()->GetBuffer(buffer, enter.callback()));
75 int32_t RecycleBuffer(PP_Resource audio_track, PP_Resource buffer) {
76 VLOG(4) << "PPB_MediaStreamAudioTrack::RecycleBuffer()";
77 EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, true);
78 if (enter.failed())
79 return enter.retval();
80 return enter.object()->RecycleBuffer(buffer);
83 void Close(PP_Resource audio_track) {
84 VLOG(4) << "PPB_MediaStreamAudioTrack::Close()";
85 EnterResource<PPB_MediaStreamAudioTrack_API> enter(audio_track, true);
86 if (enter.failed())
87 return;
88 enter.object()->Close();
91 const PPB_MediaStreamAudioTrack_0_1 g_ppb_mediastreamaudiotrack_thunk_0_1 = {
92 &IsMediaStreamAudioTrack,
93 &Configure,
94 &GetAttrib,
95 &GetId,
96 &HasEnded,
97 &GetBuffer,
98 &RecycleBuffer,
99 &Close};
101 } // namespace
103 PPAPI_THUNK_EXPORT const PPB_MediaStreamAudioTrack_0_1*
104 GetPPB_MediaStreamAudioTrack_0_1_Thunk() {
105 return &g_ppb_mediastreamaudiotrack_thunk_0_1;
108 } // namespace thunk
109 } // namespace ppapi