// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webkit/glue/plugins/pepper_audio.h" #include "base/logging.h" #include "third_party/ppapi/c/ppb_audio.h" #include "third_party/ppapi/c/ppb_audio_trusted.h" namespace pepper { namespace { // PPB_AudioConfig functions PP_Resource CreateStereo16bit(PP_Module module_id, uint32_t sample_rate, uint32_t sample_frame_count) { PluginModule* module = PluginModule::FromPPModule(module_id); if (!module) return 0; scoped_refptr config(new AudioConfig(module, sample_rate, sample_frame_count)); return config->GetReference(); } uint32_t GetSampleRate(PP_Resource config_id) { scoped_refptr config = Resource::GetAs(config_id); return config ? config->sample_rate() : 0; } uint32_t GetSampleFrameCount(PP_Resource config_id) { scoped_refptr config = Resource::GetAs(config_id); return config ? config->sample_frame_count() : 0; } // PPB_Audio functions PP_Resource Create(PP_Instance instance_id, PP_Resource config_id, PPB_Audio_Callback callback, void* user_data) { PluginInstance* instance = PluginInstance::FromPPInstance(instance_id); if (!instance) return 0; // TODO(neb): Require callback to be present for untrusted plugins. scoped_refptr