Disable view source for Developer Tools.
[chromium-blink-merge.git] / ppapi / cpp / audio_frame.cc
blob7c3a1bbf894857e2f2d0ad93a0b7a099e6986976
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"
10 namespace pp {
12 namespace {
14 template <> const char* interface_name<PPB_AudioFrame_0_1>() {
15 return PPB_AUDIOFRAME_INTERFACE_0_1;
18 } // namespace
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());
39 return 0.0;
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());
50 return 0;
53 uint32_t AudioFrame::GetNumberOfChannels() const {
54 if (has_interface<PPB_AudioFrame_0_1>()) {
55 return get_interface<PPB_AudioFrame_0_1>()->GetNumberOfChannels(
56 pp_resource());
58 return 0;
61 uint32_t AudioFrame::GetNumberOfSamples() const {
62 if (has_interface<PPB_AudioFrame_0_1>()) {
63 return get_interface<PPB_AudioFrame_0_1>()->GetNumberOfSamples(
64 pp_resource());
66 return 0;
69 void* AudioFrame::GetDataBuffer() {
70 if (has_interface<PPB_AudioFrame_0_1>())
71 return get_interface<PPB_AudioFrame_0_1>()->GetDataBuffer(pp_resource());
72 return NULL;
75 uint32_t AudioFrame::GetDataBufferSize() const {
76 if (has_interface<PPB_AudioFrame_0_1>()) {
77 return get_interface<PPB_AudioFrame_0_1>()->GetDataBufferSize(
78 pp_resource());
80 return 0;
83 } // namespace pp