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_audio_buffer.idl modified Mon Apr 7 08:56:43 2014.
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/ppb_audio_buffer.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h"
12 #include "ppapi/thunk/ppb_audio_buffer_api.h"
19 PP_Bool
IsAudioBuffer(PP_Resource resource
) {
20 VLOG(4) << "PPB_AudioBuffer::IsAudioBuffer()";
21 EnterResource
<PPB_AudioBuffer_API
> enter(resource
, false);
22 return PP_FromBool(enter
.succeeded());
25 PP_TimeDelta
GetTimestamp(PP_Resource buffer
) {
26 VLOG(4) << "PPB_AudioBuffer::GetTimestamp()";
27 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
30 return enter
.object()->GetTimestamp();
33 void SetTimestamp(PP_Resource buffer
, PP_TimeDelta timestamp
) {
34 VLOG(4) << "PPB_AudioBuffer::SetTimestamp()";
35 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
38 enter
.object()->SetTimestamp(timestamp
);
41 PP_AudioBuffer_SampleRate
GetSampleRate(PP_Resource buffer
) {
42 VLOG(4) << "PPB_AudioBuffer::GetSampleRate()";
43 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
45 return PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN
;
46 return enter
.object()->GetSampleRate();
49 PP_AudioBuffer_SampleSize
GetSampleSize(PP_Resource buffer
) {
50 VLOG(4) << "PPB_AudioBuffer::GetSampleSize()";
51 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
53 return PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN
;
54 return enter
.object()->GetSampleSize();
57 uint32_t GetNumberOfChannels(PP_Resource buffer
) {
58 VLOG(4) << "PPB_AudioBuffer::GetNumberOfChannels()";
59 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
62 return enter
.object()->GetNumberOfChannels();
65 uint32_t GetNumberOfSamples(PP_Resource buffer
) {
66 VLOG(4) << "PPB_AudioBuffer::GetNumberOfSamples()";
67 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
70 return enter
.object()->GetNumberOfSamples();
73 void* GetDataBuffer(PP_Resource buffer
) {
74 VLOG(4) << "PPB_AudioBuffer::GetDataBuffer()";
75 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
78 return enter
.object()->GetDataBuffer();
81 uint32_t GetDataBufferSize(PP_Resource buffer
) {
82 VLOG(4) << "PPB_AudioBuffer::GetDataBufferSize()";
83 EnterResource
<PPB_AudioBuffer_API
> enter(buffer
, true);
86 return enter
.object()->GetDataBufferSize();
89 const PPB_AudioBuffer_0_1 g_ppb_audiobuffer_thunk_0_1
= {&IsAudioBuffer
,
101 PPAPI_THUNK_EXPORT
const PPB_AudioBuffer_0_1
* GetPPB_AudioBuffer_0_1_Thunk() {
102 return &g_ppb_audiobuffer_thunk_0_1
;