| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 9 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "url/gurl.h" |
| 10 | 14 |
| 11 namespace content { | 15 namespace content { |
| 12 | 16 |
| 13 class MediaStreamAudioRenderer | 17 class MediaStreamAudioRenderer |
| 14 : public base::RefCountedThreadSafe<MediaStreamAudioRenderer> { | 18 : public base::RefCountedThreadSafe<MediaStreamAudioRenderer> { |
| 15 public: | 19 public: |
| 16 // Starts rendering audio. | 20 // Starts rendering audio. |
| 17 virtual void Start() = 0; | 21 virtual void Start() = 0; |
| 18 | 22 |
| 19 // Stops rendering audio. | 23 // Stops rendering audio. |
| 20 virtual void Stop() = 0; | 24 virtual void Stop() = 0; |
| 21 | 25 |
| 22 // Resumes rendering audio after being paused. | 26 // Resumes rendering audio after being paused. |
| 23 virtual void Play() = 0; | 27 virtual void Play() = 0; |
| 24 | 28 |
| 25 // Temporarily suspends rendering audio. The audio stream might still be | 29 // Temporarily suspends rendering audio. The audio stream might still be |
| 26 // active but new audio data is not provided to the consumer. | 30 // active but new audio data is not provided to the consumer. |
| 27 virtual void Pause() = 0; | 31 virtual void Pause() = 0; |
| 28 | 32 |
| 29 // Sets the output volume. | 33 // Sets the output volume. |
| 30 virtual void SetVolume(float volume) = 0; | 34 virtual void SetVolume(float volume) = 0; |
| 31 | 35 |
| 36 // Set the audio output device. |
| 37 virtual void SwitchOutputDevice( |
| 38 const std::string &device_id, |
| 39 const GURL &security_origin, |
| 40 const base::Callback<void(int)>& callback) = 0; |
| 41 |
| 32 // Time stamp that reflects the current render time. Should not be updated | 42 // Time stamp that reflects the current render time. Should not be updated |
| 33 // when paused. | 43 // when paused. |
| 34 virtual base::TimeDelta GetCurrentRenderTime() const = 0; | 44 virtual base::TimeDelta GetCurrentRenderTime() const = 0; |
| 35 | 45 |
| 36 // Returns true if the implementation is a local renderer and false | 46 // Returns true if the implementation is a local renderer and false |
| 37 // otherwise. | 47 // otherwise. |
| 38 virtual bool IsLocalRenderer() const = 0; | 48 virtual bool IsLocalRenderer() const = 0; |
| 39 | 49 |
| 40 protected: | 50 protected: |
| 41 friend class base::RefCountedThreadSafe<MediaStreamAudioRenderer>; | 51 friend class base::RefCountedThreadSafe<MediaStreamAudioRenderer>; |
| 42 | 52 |
| 43 MediaStreamAudioRenderer(); | 53 MediaStreamAudioRenderer(); |
| 44 virtual ~MediaStreamAudioRenderer(); | 54 virtual ~MediaStreamAudioRenderer(); |
| 45 | 55 |
| 46 private: | 56 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioRenderer); | 57 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioRenderer); |
| 48 }; | 58 }; |
| 49 | 59 |
| 50 } // namespace content | 60 } // namespace content |
| 51 | 61 |
| 52 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_ | 62 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_RENDERER_H_ |
| OLD | NEW |