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 #include "ppapi/cpp/audio_frame.h"
7 #include "ppapi/cpp/module.h"
8 #include "ppapi/cpp/module_impl.h"
14 template <> const char* interface_name
<PPB_AudioFrame_0_1
>() {
15 return PPB_AUDIOFRAME_INTERFACE_0_1
;
20 AudioFrame::AudioFrame() {
23 AudioFrame::AudioFrame(const AudioFrame
& other
) : Resource(other
) {
26 AudioFrame::AudioFrame(const Resource
& resource
) : Resource(resource
) {
29 AudioFrame::AudioFrame(PassRef
, PP_Resource resource
)
30 : Resource(PASS_REF
, resource
) {
33 AudioFrame::~AudioFrame() {
36 PP_TimeDelta
AudioFrame::GetTimestamp() const {
37 if (has_interface
<PPB_AudioFrame_0_1
>())
38 return get_interface
<PPB_AudioFrame_0_1
>()->GetTimestamp(pp_resource());
42 void AudioFrame::SetTimestamp(PP_TimeDelta timestamp
) {
43 if (has_interface
<PPB_AudioFrame_0_1
>())
44 get_interface
<PPB_AudioFrame_0_1
>()->SetTimestamp(pp_resource(), timestamp
);
47 uint32_t AudioFrame::GetSampleSize() const {
48 if (has_interface
<PPB_AudioFrame_0_1
>())
49 return get_interface
<PPB_AudioFrame_0_1
>()->GetSampleSize(pp_resource());
53 uint32_t AudioFrame::GetNumberOfChannels() const {
54 if (has_interface
<PPB_AudioFrame_0_1
>()) {
55 return get_interface
<PPB_AudioFrame_0_1
>()->GetNumberOfChannels(
61 uint32_t AudioFrame::GetNumberOfSamples() const {
62 if (has_interface
<PPB_AudioFrame_0_1
>()) {
63 return get_interface
<PPB_AudioFrame_0_1
>()->GetNumberOfSamples(
69 void* AudioFrame::GetDataBuffer() {
70 if (has_interface
<PPB_AudioFrame_0_1
>())
71 return get_interface
<PPB_AudioFrame_0_1
>()->GetDataBuffer(pp_resource());
75 uint32_t AudioFrame::GetDataBufferSize() const {
76 if (has_interface
<PPB_AudioFrame_0_1
>()) {
77 return get_interface
<PPB_AudioFrame_0_1
>()->GetDataBufferSize(