| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_STREAM_MEDIA_STREAM_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" |
| 10 #include "webkit/glue/media/media_stream_client.h" | 12 #include "webkit/glue/media/media_stream_client.h" |
| 11 | 13 |
| 14 class MediaStreamDispatcher; |
| 12 class VideoCaptureImplManager; | 15 class VideoCaptureImplManager; |
| 13 | 16 |
| 14 // A implementation of StreamClient to provide supporting functions, such as | 17 // A implementation of StreamClient to provide supporting functions, such as |
| 15 // GetVideoDecoder. | 18 // GetVideoDecoder. |
| 16 class MediaStreamImpl | 19 class MediaStreamImpl |
| 17 : public webkit_glue::MediaStreamClient, | 20 : public webkit_glue::MediaStreamClient, |
| 21 public MediaStreamDispatcherEventHandler, |
| 18 public base::RefCountedThreadSafe<MediaStreamImpl> { | 22 public base::RefCountedThreadSafe<MediaStreamImpl> { |
| 19 public: | 23 public: |
| 20 explicit MediaStreamImpl(VideoCaptureImplManager* vc_manager); | 24 explicit MediaStreamImpl(MediaStreamDispatcher* media_stream_dispatcher_, |
| 25 VideoCaptureImplManager* vc_manager); |
| 21 virtual ~MediaStreamImpl(); | 26 virtual ~MediaStreamImpl(); |
| 22 | 27 |
| 28 virtual void GetVideoDevice(int index); |
| 29 |
| 23 // Implement webkit_glue::StreamClient. | 30 // Implement webkit_glue::StreamClient. |
| 24 virtual scoped_refptr<media::VideoDecoder> GetVideoDecoder( | 31 virtual scoped_refptr<media::VideoDecoder> GetVideoDecoder( |
| 25 const GURL& url, media::MessageLoopFactory* message_loop_factory); | 32 const GURL& url, |
| 33 media::MessageLoopFactory* message_loop_factory) OVERRIDE; |
| 34 |
| 35 // Implement MediaStreamDispatcherEventHandler. |
| 36 virtual void OnStreamGenerated( |
| 37 int request_id, |
| 38 const std::string& label, |
| 39 const media_stream::StreamDeviceInfoArray& audio_array, |
| 40 const media_stream::StreamDeviceInfoArray& video_array) OVERRIDE; |
| 41 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; |
| 42 virtual void OnVideoDeviceFailed( |
| 43 const std::string& label, |
| 44 int index) OVERRIDE; |
| 45 virtual void OnAudioDeviceFailed( |
| 46 const std::string& label, |
| 47 int index) OVERRIDE; |
| 48 virtual void OnVideoDevicesEnumerated( |
| 49 int request_id, |
| 50 const media_stream::StreamDeviceInfoArray& device_array) OVERRIDE; |
| 51 virtual void OnVideoDevicesEnumerationFailed(int request_id) OVERRIDE; |
| 52 virtual void OnVideoDeviceOpened( |
| 53 int request_id, |
| 54 const std::string& label, |
| 55 const media_stream::StreamDeviceInfo& video_device) OVERRIDE; |
| 56 virtual void OnVideoDeviceOpenFailed(int request_id) OVERRIDE; |
| 26 | 57 |
| 27 private: | 58 private: |
| 59 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's |
| 60 // valid for the lifetime of RenderView. |
| 61 MediaStreamDispatcher* media_stream_dispatcher_; |
| 62 |
| 63 std::string local_label_; |
| 28 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 64 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
| 29 | 65 |
| 30 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 66 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
| 31 }; | 67 }; |
| 32 | 68 |
| 33 #endif // CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_ | 69 #endif // CONTENT_RENDERER_MEDIA_STREAM_MEDIA_STREAM_IMPL_H_ |
| OLD | NEW |