OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "ppapi/cpp/audio_frame.h" | |
6 | |
7 #include "ppapi/cpp/module.h" | |
8 #include "ppapi/cpp/module_impl.h" | |
9 | |
10 namespace pp { | |
11 | |
12 namespace { | |
13 | |
14 template <> const char* interface_name<PPB_AudioFrame_0_1>() { | |
15 return PPB_AUDIOFRAME_INTERFACE_0_1; | |
16 } | |
17 | |
18 } // namespace | |
19 | |
20 AudioFrame::AudioFrame() { | |
21 } | |
22 | |
23 AudioFrame::AudioFrame(const AudioFrame& other) : Resource(other) { | |
24 } | |
25 | |
26 AudioFrame::AudioFrame(const Resource& resource) : Resource(resource) { | |
27 } | |
28 | |
29 AudioFrame::AudioFrame(PassRef, PP_Resource resource) | |
30 : Resource(PASS_REF, resource) { | |
31 } | |
32 | |
33 AudioFrame::~AudioFrame() { | |
34 } | |
35 | |
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; | |
40 } | |
41 | |
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); | |
45 } | |
46 | |
47 PP_AudioFrame_SampleRate AudioFrame::GetSampleRate() const { | |
48 if (has_interface<PPB_AudioFrame_0_1>()) | |
49 return get_interface<PPB_AudioFrame_0_1>()->GetSampleRate(pp_resource()); | |
50 return PP_AUDIOFRAME_SAMPLERATE_UNKNOWN; | |
51 } | |
52 | |
53 PP_AudioFrame_SampleSize AudioFrame::GetSampleSize() const { | |
54 if (has_interface<PPB_AudioFrame_0_1>()) | |
55 return get_interface<PPB_AudioFrame_0_1>()->GetSampleSize(pp_resource()); | |
56 return PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN; | |
57 } | |
58 | |
59 uint32_t AudioFrame::GetNumberOfChannels() const { | |
60 if (has_interface<PPB_AudioFrame_0_1>()) { | |
61 return get_interface<PPB_AudioFrame_0_1>()->GetNumberOfChannels( | |
62 pp_resource()); | |
63 } | |
64 return 0; | |
65 } | |
66 | |
67 uint32_t AudioFrame::GetNumberOfSamples() const { | |
68 if (has_interface<PPB_AudioFrame_0_1>()) { | |
69 return get_interface<PPB_AudioFrame_0_1>()->GetNumberOfSamples( | |
70 pp_resource()); | |
71 } | |
72 return 0; | |
73 } | |
74 | |
75 void* AudioFrame::GetDataBuffer() { | |
76 if (has_interface<PPB_AudioFrame_0_1>()) | |
77 return get_interface<PPB_AudioFrame_0_1>()->GetDataBuffer(pp_resource()); | |
78 return NULL; | |
79 } | |
80 | |
81 uint32_t AudioFrame::GetDataBufferSize() const { | |
82 if (has_interface<PPB_AudioFrame_0_1>()) { | |
83 return get_interface<PPB_AudioFrame_0_1>()->GetDataBufferSize( | |
84 pp_resource()); | |
85 } | |
86 return 0; | |
87 } | |
88 | |
89 } // namespace pp | |
OLD | NEW |