OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_AUDIO_OUTPUT_DEVICE_H_ | |
6 #define CONTENT_RENDERER_MEDIA_RENDERER_AUDIO_OUTPUT_DEVICE_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "media/audio/audio_output_device.h" | |
10 | |
11 namespace base { | |
12 class MessageLoopProxy; | |
13 } | |
14 | |
15 namespace content { | |
16 | |
17 class AudioDeviceFactory; | |
18 class AudioMessageFilter; | |
19 | |
20 // Subclass of media::AudioOutputDevice to support additional concepts within | |
21 // the content component. Use AudioDeviceFactory to instantiate this class. | |
22 class RendererAudioOutputDevice | |
23 : NON_EXPORTED_BASE(public media::AudioOutputDevice) { | |
24 public: | |
25 // Set the source of the rendered audio data to the RenderView specified by | |
26 // |render_view_id|. Callers should keep in mind that the RenderView which | |
27 // caused the instantiation of RendererAudioOutputDevice might not necessarily | |
28 // be same as the RenderView which actually renders the audio data. | |
29 void SetSourceRenderView(int render_view_id); | |
30 | |
31 virtual void Start() OVERRIDE; | |
32 virtual void Stop() OVERRIDE; | |
33 | |
34 protected: | |
35 friend class AudioDeviceFactory; | |
36 | |
37 // Creates an uninitialized RendererAudioOutputDevice. Clients must call | |
38 // Initialize() before using. | |
39 RendererAudioOutputDevice( | |
40 AudioMessageFilter* message_filter, | |
41 const scoped_refptr<base::MessageLoopProxy>& io_loop); | |
42 | |
43 private: | |
44 virtual ~RendererAudioOutputDevice(); | |
45 | |
46 void OnStart(); | |
47 void OnStop(); | |
48 void OnSourceChange(int render_view_id); | |
49 | |
50 int source_render_view_id_; | |
51 bool is_after_stream_created_; | |
52 | |
53 DISALLOW_IMPLICIT_CONSTRUCTORS(RendererAudioOutputDevice); | |
54 }; | |
55 | |
56 } // namespace content | |
57 | |
58 #endif // CONTENT_RENDERER_MEDIA_RENDERER_AUDIO_OUTPUT_DEVICE_H_ | |
OLD | NEW |