Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Side by Side Diff: ppapi/shared_impl/ppb_audio_config_shared.cc

Issue 8790004: Rename the shared impl files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/shared_impl/ppb_audio_config_shared.h ('k') | ppapi/shared_impl/ppb_audio_input_shared.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/shared_impl/audio_config_impl.h" 5 #include "ppapi/shared_impl/ppb_audio_config_shared.h"
6 6
7 namespace ppapi { 7 namespace ppapi {
8 8
9 AudioConfigImpl::AudioConfigImpl(PP_Instance instance) 9 PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(PP_Instance instance)
10 : Resource(instance), 10 : Resource(instance),
11 sample_rate_(PP_AUDIOSAMPLERATE_NONE), 11 sample_rate_(PP_AUDIOSAMPLERATE_NONE),
12 sample_frame_count_(0) { 12 sample_frame_count_(0) {
13 } 13 }
14 14
15 AudioConfigImpl::AudioConfigImpl(const HostResource& host_resource) 15 PPB_AudioConfig_Shared::PPB_AudioConfig_Shared(
16 const HostResource& host_resource)
16 : Resource(host_resource), 17 : Resource(host_resource),
17 sample_rate_(PP_AUDIOSAMPLERATE_NONE), 18 sample_rate_(PP_AUDIOSAMPLERATE_NONE),
18 sample_frame_count_(0) { 19 sample_frame_count_(0) {
19 } 20 }
20 21
21 AudioConfigImpl::~AudioConfigImpl() { 22 PPB_AudioConfig_Shared::~PPB_AudioConfig_Shared() {
22 } 23 }
23 24
24 // static 25 // static
25 PP_Resource AudioConfigImpl::CreateAsImpl(PP_Instance instance, 26 PP_Resource PPB_AudioConfig_Shared::CreateAsImpl(
26 PP_AudioSampleRate sample_rate, 27 PP_Instance instance,
27 uint32_t sample_frame_count) { 28 PP_AudioSampleRate sample_rate,
28 scoped_refptr<AudioConfigImpl> object(new AudioConfigImpl(instance)); 29 uint32_t sample_frame_count) {
30 scoped_refptr<PPB_AudioConfig_Shared> object(
31 new PPB_AudioConfig_Shared(instance));
29 if (!object->Init(sample_rate, sample_frame_count)) 32 if (!object->Init(sample_rate, sample_frame_count))
30 return 0; 33 return 0;
31 return object->GetReference(); 34 return object->GetReference();
32 } 35 }
33 36
34 // static 37 // static
35 PP_Resource AudioConfigImpl::CreateAsProxy(PP_Instance instance, 38 PP_Resource PPB_AudioConfig_Shared::CreateAsProxy(
36 PP_AudioSampleRate sample_rate, 39 PP_Instance instance,
37 uint32_t sample_frame_count) { 40 PP_AudioSampleRate sample_rate,
38 scoped_refptr<AudioConfigImpl> object(new AudioConfigImpl( 41 uint32_t sample_frame_count) {
42 scoped_refptr<PPB_AudioConfig_Shared> object(new PPB_AudioConfig_Shared(
39 HostResource::MakeInstanceOnly(instance))); 43 HostResource::MakeInstanceOnly(instance)));
40 if (!object->Init(sample_rate, sample_frame_count)) 44 if (!object->Init(sample_rate, sample_frame_count))
41 return 0; 45 return 0;
42 return object->GetReference(); 46 return object->GetReference();
43 } 47 }
44 48
45 thunk::PPB_AudioConfig_API* AudioConfigImpl::AsPPB_AudioConfig_API() { 49 thunk::PPB_AudioConfig_API* PPB_AudioConfig_Shared::AsPPB_AudioConfig_API() {
46 return this; 50 return this;
47 } 51 }
48 52
49 PP_AudioSampleRate AudioConfigImpl::GetSampleRate() { 53 PP_AudioSampleRate PPB_AudioConfig_Shared::GetSampleRate() {
50 return sample_rate_; 54 return sample_rate_;
51 } 55 }
52 56
53 uint32_t AudioConfigImpl::GetSampleFrameCount() { 57 uint32_t PPB_AudioConfig_Shared::GetSampleFrameCount() {
54 return sample_frame_count_; 58 return sample_frame_count_;
55 } 59 }
56 60
57 bool AudioConfigImpl::Init(PP_AudioSampleRate sample_rate, 61 bool PPB_AudioConfig_Shared::Init(PP_AudioSampleRate sample_rate,
58 uint32_t sample_frame_count) { 62 uint32_t sample_frame_count) {
59 // TODO(brettw): Currently we don't actually check what the hardware 63 // TODO(brettw): Currently we don't actually check what the hardware
60 // supports, so just allow sample rates of the "guaranteed working" ones. 64 // supports, so just allow sample rates of the "guaranteed working" ones.
61 if (sample_rate != PP_AUDIOSAMPLERATE_44100 && 65 if (sample_rate != PP_AUDIOSAMPLERATE_44100 &&
62 sample_rate != PP_AUDIOSAMPLERATE_48000) 66 sample_rate != PP_AUDIOSAMPLERATE_48000)
63 return false; 67 return false;
64 68
65 // TODO(brettw): Currently we don't actually query to get a value from the 69 // TODO(brettw): Currently we don't actually query to get a value from the
66 // hardware, so just validate the range. 70 // hardware, so just validate the range.
67 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT || 71 if (sample_frame_count > PP_AUDIOMAXSAMPLEFRAMECOUNT ||
68 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT) 72 sample_frame_count < PP_AUDIOMINSAMPLEFRAMECOUNT)
69 return false; 73 return false;
70 74
71 sample_rate_ = sample_rate; 75 sample_rate_ = sample_rate;
72 sample_frame_count_ = sample_frame_count; 76 sample_frame_count_ = sample_frame_count;
73 return true; 77 return true;
74 } 78 }
75 79
76 } // namespace ppapi 80 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_audio_config_shared.h ('k') | ppapi/shared_impl/ppb_audio_input_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698