OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ppapi/cpp/audio.h" |
| 6 |
| 7 #include "ppapi/cpp/module_impl.h" |
| 8 |
| 9 namespace pp { |
| 10 |
| 11 namespace { |
| 12 |
| 13 template <> const char* interface_name<PPB_Audio>() { |
| 14 return PPB_AUDIO_INTERFACE; |
| 15 } |
| 16 |
| 17 } // namespace |
| 18 |
| 19 Audio::Audio(Instance* instance, |
| 20 const AudioConfig& config, |
| 21 PPB_Audio_Callback callback, |
| 22 void* user_data) |
| 23 : config_(config) { |
| 24 if (has_interface<PPB_Audio>()) { |
| 25 PassRefFromConstructor(get_interface<PPB_Audio>()->Create( |
| 26 instance->pp_instance(), config.pp_resource(), callback, user_data)); |
| 27 } |
| 28 } |
| 29 |
| 30 bool Audio::StartPlayback() { |
| 31 return has_interface<PPB_Audio>() && |
| 32 get_interface<PPB_Audio>()->StartPlayback(pp_resource()); |
| 33 } |
| 34 |
| 35 bool Audio::StopPlayback() { |
| 36 return has_interface<PPB_Audio>() && |
| 37 get_interface<PPB_Audio>()->StopPlayback(pp_resource()); |
| 38 } |
| 39 |
| 40 } // namespace pp |
| 41 |
OLD | NEW |