OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ppapi/shared_impl/resource.h" | 10 #include "ppapi/shared_impl/resource.h" |
11 #include "ppapi/thunk/ppb_audio_config_api.h" | 11 #include "ppapi/thunk/ppb_audio_config_api.h" |
12 | 12 |
13 namespace ppapi { | 13 namespace ppapi { |
14 | 14 |
15 class PPAPI_SHARED_EXPORT PPB_AudioConfig_Shared | 15 class PPAPI_SHARED_EXPORT PPB_AudioConfig_Shared |
16 : public Resource, | 16 : public Resource, |
17 public thunk::PPB_AudioConfig_API { | 17 public thunk::PPB_AudioConfig_API { |
18 public: | 18 public: |
19 virtual ~PPB_AudioConfig_Shared(); | 19 virtual ~PPB_AudioConfig_Shared(); |
20 | 20 |
21 static PP_Resource Create(ResourceObjectType type, | 21 static PP_Resource Create(ResourceObjectType type, |
22 PP_Instance instance, | 22 PP_Instance instance, |
23 PP_AudioSampleRate sample_rate, | 23 PP_AudioSampleRate sample_rate, |
24 uint32_t sample_frame_count); | 24 uint32_t sample_frame_count); |
| 25 static uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate, |
| 26 uint32_t request_sample_frame_count); |
| 27 static uint32_t RecommendSampleFrameCount_1_1(PP_Instance instance, |
| 28 PP_AudioSampleRate sample_rate, |
| 29 uint32_t request_sample_frame_count); |
| 30 static PP_AudioSampleRate RecommendSampleRate(PP_Instance); |
25 | 31 |
26 // Resource overrides. | 32 // Resource overrides. |
27 virtual thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE; | 33 virtual thunk::PPB_AudioConfig_API* AsPPB_AudioConfig_API() OVERRIDE; |
28 | 34 |
29 // PPB_AudioConfig_API implementation. | 35 // PPB_AudioConfig_API implementation. |
30 virtual PP_AudioSampleRate GetSampleRate() OVERRIDE; | 36 virtual PP_AudioSampleRate GetSampleRate() OVERRIDE; |
31 virtual uint32_t GetSampleFrameCount() OVERRIDE; | 37 virtual uint32_t GetSampleFrameCount() OVERRIDE; |
32 | 38 |
33 private: | 39 private: |
34 // You must call Init before using this object. | 40 // You must call Init before using this object. |
35 explicit PPB_AudioConfig_Shared(ResourceObjectType type, | 41 explicit PPB_AudioConfig_Shared(ResourceObjectType type, |
36 PP_Instance instance); | 42 PP_Instance instance); |
37 | 43 |
38 // Returns false if the arguments are invalid, the object should not be | 44 // Returns false if the arguments are invalid, the object should not be |
39 // used in this case. | 45 // used in this case. |
40 bool Init(PP_AudioSampleRate sample_rate, uint32_t sample_frame_count); | 46 bool Init(PP_AudioSampleRate sample_rate, uint32_t sample_frame_count); |
41 | 47 |
42 PP_AudioSampleRate sample_rate_; | 48 PP_AudioSampleRate sample_rate_; |
43 uint32_t sample_frame_count_; | 49 uint32_t sample_frame_count_; |
44 | 50 |
45 DISALLOW_COPY_AND_ASSIGN(PPB_AudioConfig_Shared); | 51 DISALLOW_COPY_AND_ASSIGN(PPB_AudioConfig_Shared); |
46 }; | 52 }; |
47 | 53 |
48 } // namespace ppapi | 54 } // namespace ppapi |
49 | 55 |
50 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_ | 56 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_CONFIG_SHARED_H_ |
OLD | NEW |