Roll leveldb from r73 to r75.
[chromium-blink-merge.git] / ppapi / cpp / audio.cc
blob89702be0072dcbea78dfe038445d6f3c3f4e0265
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
3 // found in the LICENSE file.
5 #include "ppapi/cpp/audio.h"
7 #include "ppapi/cpp/instance_handle.h"
8 #include "ppapi/cpp/module_impl.h"
10 namespace pp {
12 namespace {
14 template <> const char* interface_name<PPB_Audio_1_0>() {
15 return PPB_AUDIO_INTERFACE_1_0;
18 } // namespace
20 Audio::Audio(const InstanceHandle& instance,
21 const AudioConfig& config,
22 PPB_Audio_Callback callback,
23 void* user_data)
24 : config_(config) {
25 if (has_interface<PPB_Audio_1_0>()) {
26 PassRefFromConstructor(get_interface<PPB_Audio_1_0>()->Create(
27 instance.pp_instance(), config.pp_resource(), callback, user_data));
31 bool Audio::StartPlayback() {
32 return has_interface<PPB_Audio_1_0>() &&
33 get_interface<PPB_Audio_1_0>()->StartPlayback(pp_resource());
36 bool Audio::StopPlayback() {
37 return has_interface<PPB_Audio_1_0>() &&
38 get_interface<PPB_Audio_1_0>()->StopPlayback(pp_resource());
41 } // namespace pp