Increase MessageAttachmentSet::kMaxDescriptorsPerMessage to 128
[chromium-blink-merge.git] / ppapi / cpp / audio_buffer.cc
blobe1952c2260667e22f97b27c26e875220028f990b
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_buffer.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_AudioBuffer_0_1>() {
15 return PPB_AUDIOBUFFER_INTERFACE_0_1;
18 } // namespace
20 AudioBuffer::AudioBuffer() {
23 AudioBuffer::AudioBuffer(const AudioBuffer& other) : Resource(other) {
26 AudioBuffer::AudioBuffer(const Resource& resource) : Resource(resource) {
29 AudioBuffer::AudioBuffer(PassRef, PP_Resource resource)
30 : Resource(PASS_REF, resource) {
33 AudioBuffer::~AudioBuffer() {
36 PP_TimeDelta AudioBuffer::GetTimestamp() const {
37 if (has_interface<PPB_AudioBuffer_0_1>())
38 return get_interface<PPB_AudioBuffer_0_1>()->GetTimestamp(pp_resource());
39 return 0.0;
42 void AudioBuffer::SetTimestamp(PP_TimeDelta timestamp) {
43 if (has_interface<PPB_AudioBuffer_0_1>()) {
44 get_interface<PPB_AudioBuffer_0_1>()->SetTimestamp(pp_resource(),
45 timestamp);
49 PP_AudioBuffer_SampleRate AudioBuffer::GetSampleRate() const {
50 if (has_interface<PPB_AudioBuffer_0_1>())
51 return get_interface<PPB_AudioBuffer_0_1>()->GetSampleRate(pp_resource());
52 return PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN;
55 PP_AudioBuffer_SampleSize AudioBuffer::GetSampleSize() const {
56 if (has_interface<PPB_AudioBuffer_0_1>())
57 return get_interface<PPB_AudioBuffer_0_1>()->GetSampleSize(pp_resource());
58 return PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN;
61 uint32_t AudioBuffer::GetNumberOfChannels() const {
62 if (has_interface<PPB_AudioBuffer_0_1>()) {
63 return get_interface<PPB_AudioBuffer_0_1>()->GetNumberOfChannels(
64 pp_resource());
66 return 0;
69 uint32_t AudioBuffer::GetNumberOfSamples() const {
70 if (has_interface<PPB_AudioBuffer_0_1>()) {
71 return get_interface<PPB_AudioBuffer_0_1>()->GetNumberOfSamples(
72 pp_resource());
74 return 0;
77 void* AudioBuffer::GetDataBuffer() {
78 if (has_interface<PPB_AudioBuffer_0_1>())
79 return get_interface<PPB_AudioBuffer_0_1>()->GetDataBuffer(pp_resource());
80 return NULL;
83 uint32_t AudioBuffer::GetDataBufferSize() const {
84 if (has_interface<PPB_AudioBuffer_0_1>()) {
85 return get_interface<PPB_AudioBuffer_0_1>()->GetDataBufferSize(
86 pp_resource());
88 return 0;
91 } // namespace pp