OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/cpp/audio_frame.h" | 5 #include "ppapi/cpp/audio_buffer.h" |
6 | 6 |
7 #include "ppapi/cpp/module.h" | 7 #include "ppapi/cpp/module.h" |
8 #include "ppapi/cpp/module_impl.h" | 8 #include "ppapi/cpp/module_impl.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 template <> const char* interface_name<PPB_AudioFrame_0_1>() { | 14 template <> const char* interface_name<PPB_AudioBuffer_0_1>() { |
15 return PPB_AUDIOFRAME_INTERFACE_0_1; | 15 return PPB_AUDIOBUFFER_INTERFACE_0_1; |
16 } | 16 } |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
20 AudioFrame::AudioFrame() { | 20 AudioBuffer::AudioBuffer() { |
21 } | 21 } |
22 | 22 |
23 AudioFrame::AudioFrame(const AudioFrame& other) : Resource(other) { | 23 AudioBuffer::AudioBuffer(const AudioBuffer& other) : Resource(other) { |
24 } | 24 } |
25 | 25 |
26 AudioFrame::AudioFrame(const Resource& resource) : Resource(resource) { | 26 AudioBuffer::AudioBuffer(const Resource& resource) : Resource(resource) { |
27 } | 27 } |
28 | 28 |
29 AudioFrame::AudioFrame(PassRef, PP_Resource resource) | 29 AudioBuffer::AudioBuffer(PassRef, PP_Resource resource) |
30 : Resource(PASS_REF, resource) { | 30 : Resource(PASS_REF, resource) { |
31 } | 31 } |
32 | 32 |
33 AudioFrame::~AudioFrame() { | 33 AudioBuffer::~AudioBuffer() { |
34 } | 34 } |
35 | 35 |
36 PP_TimeDelta AudioFrame::GetTimestamp() const { | 36 PP_TimeDelta AudioBuffer::GetTimestamp() const { |
37 if (has_interface<PPB_AudioFrame_0_1>()) | 37 if (has_interface<PPB_AudioBuffer_0_1>()) |
38 return get_interface<PPB_AudioFrame_0_1>()->GetTimestamp(pp_resource()); | 38 return get_interface<PPB_AudioBuffer_0_1>()->GetTimestamp(pp_resource()); |
39 return 0.0; | 39 return 0.0; |
40 } | 40 } |
41 | 41 |
42 void AudioFrame::SetTimestamp(PP_TimeDelta timestamp) { | 42 void AudioBuffer::SetTimestamp(PP_TimeDelta timestamp) { |
43 if (has_interface<PPB_AudioFrame_0_1>()) | 43 if (has_interface<PPB_AudioBuffer_0_1>()) { |
44 get_interface<PPB_AudioFrame_0_1>()->SetTimestamp(pp_resource(), timestamp); | 44 get_interface<PPB_AudioBuffer_0_1>()->SetTimestamp(pp_resource(), |
| 45 timestamp); |
| 46 } |
45 } | 47 } |
46 | 48 |
47 PP_AudioFrame_SampleRate AudioFrame::GetSampleRate() const { | 49 PP_AudioBuffer_SampleRate AudioBuffer::GetSampleRate() const { |
48 if (has_interface<PPB_AudioFrame_0_1>()) | 50 if (has_interface<PPB_AudioBuffer_0_1>()) |
49 return get_interface<PPB_AudioFrame_0_1>()->GetSampleRate(pp_resource()); | 51 return get_interface<PPB_AudioBuffer_0_1>()->GetSampleRate(pp_resource()); |
50 return PP_AUDIOFRAME_SAMPLERATE_UNKNOWN; | 52 return PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN; |
51 } | 53 } |
52 | 54 |
53 PP_AudioFrame_SampleSize AudioFrame::GetSampleSize() const { | 55 PP_AudioBuffer_SampleSize AudioBuffer::GetSampleSize() const { |
54 if (has_interface<PPB_AudioFrame_0_1>()) | 56 if (has_interface<PPB_AudioBuffer_0_1>()) |
55 return get_interface<PPB_AudioFrame_0_1>()->GetSampleSize(pp_resource()); | 57 return get_interface<PPB_AudioBuffer_0_1>()->GetSampleSize(pp_resource()); |
56 return PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN; | 58 return PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN; |
57 } | 59 } |
58 | 60 |
59 uint32_t AudioFrame::GetNumberOfChannels() const { | 61 uint32_t AudioBuffer::GetNumberOfChannels() const { |
60 if (has_interface<PPB_AudioFrame_0_1>()) { | 62 if (has_interface<PPB_AudioBuffer_0_1>()) { |
61 return get_interface<PPB_AudioFrame_0_1>()->GetNumberOfChannels( | 63 return get_interface<PPB_AudioBuffer_0_1>()->GetNumberOfChannels( |
62 pp_resource()); | 64 pp_resource()); |
63 } | 65 } |
64 return 0; | 66 return 0; |
65 } | 67 } |
66 | 68 |
67 uint32_t AudioFrame::GetNumberOfSamples() const { | 69 uint32_t AudioBuffer::GetNumberOfSamples() const { |
68 if (has_interface<PPB_AudioFrame_0_1>()) { | 70 if (has_interface<PPB_AudioBuffer_0_1>()) { |
69 return get_interface<PPB_AudioFrame_0_1>()->GetNumberOfSamples( | 71 return get_interface<PPB_AudioBuffer_0_1>()->GetNumberOfSamples( |
70 pp_resource()); | 72 pp_resource()); |
71 } | 73 } |
72 return 0; | 74 return 0; |
73 } | 75 } |
74 | 76 |
75 void* AudioFrame::GetDataBuffer() { | 77 void* AudioBuffer::GetDataBuffer() { |
76 if (has_interface<PPB_AudioFrame_0_1>()) | 78 if (has_interface<PPB_AudioBuffer_0_1>()) |
77 return get_interface<PPB_AudioFrame_0_1>()->GetDataBuffer(pp_resource()); | 79 return get_interface<PPB_AudioBuffer_0_1>()->GetDataBuffer(pp_resource()); |
78 return NULL; | 80 return NULL; |
79 } | 81 } |
80 | 82 |
81 uint32_t AudioFrame::GetDataBufferSize() const { | 83 uint32_t AudioBuffer::GetDataBufferSize() const { |
82 if (has_interface<PPB_AudioFrame_0_1>()) { | 84 if (has_interface<PPB_AudioBuffer_0_1>()) { |
83 return get_interface<PPB_AudioFrame_0_1>()->GetDataBufferSize( | 85 return get_interface<PPB_AudioBuffer_0_1>()->GetDataBufferSize( |
84 pp_resource()); | 86 pp_resource()); |
85 } | 87 } |
86 return 0; | 88 return 0; |
87 } | 89 } |
88 | 90 |
89 } // namespace pp | 91 } // namespace pp |
OLD | NEW |