#ifndef CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_
#define CONTENT_RENDERER_PEPPER_PEPPER_AUDIO_CONTROLLER_H_
#include <set>
namespace content {
class PepperAudioOutputHost;
class PepperPluginInstanceImpl;
class PPB_Audio_Impl;
* This class controls all the active audio instances of a Pepper instance.
* This class can only be a non-shareable member of PepperPluginInstanceImpl.
*/
class PepperAudioController {
public:
explicit PepperAudioController(PepperPluginInstanceImpl* instance);
PepperAudioController(const PepperAudioController&) = delete;
PepperAudioController& operator=(const PepperAudioController&) = delete;
virtual ~PepperAudioController();
void AddInstance(PPB_Audio_Impl* audio);
void AddInstance(PepperAudioOutputHost* audio_output);
void RemoveInstance(PPB_Audio_Impl* audio);
void RemoveInstance(PepperAudioOutputHost* audio_output);
void SetVolume(double volume);
void OnPepperInstanceDeleted();
private:
void NotifyPlaybackStopsOnEmpty();
void StartPlaybackIfFirstInstance();
void StopPlaybackIfLastInstance();
std::set<PPB_Audio_Impl*> ppb_audios_;
std::set<PepperAudioOutputHost*> audio_output_hosts_;
PepperPluginInstanceImpl* instance_;
};
}
#endif