| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIDEO_CAPTURER_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "content/common/media/video_capture.h" | 10 #include "content/common/media/video_capture.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 typedef base::Callback<void(bool running)> StartedCallback; | 27 typedef base::Callback<void(bool running)> StartedCallback; |
| 28 typedef base::Callback<void(const media::VideoCaptureFormats& formats)> | 28 typedef base::Callback<void(const media::VideoCaptureFormats& formats)> |
| 29 SupportedFormatsCallback; | 29 SupportedFormatsCallback; |
| 30 | 30 |
| 31 explicit VideoCapturerDelegate( | 31 explicit VideoCapturerDelegate( |
| 32 const StreamDeviceInfo& device_info); | 32 const StreamDeviceInfo& device_info); |
| 33 | 33 |
| 34 // Collects the formats that can currently be used. | 34 // Collects the formats that can currently be used. |
| 35 // |max_requested_height| and |max_requested_width| is used by Tab and Screen | 35 // |max_requested_height| and |max_requested_width| is used by Tab and Screen |
| 36 // capture to decide what resolution to generate. | 36 // capture to decide what resolution to generate. |
| 37 // |callback| is triggered when the formats has been collected. | 37 // |callback| is triggered when the formats have been collected. |
| 38 virtual void GetCurrentSupportedFormats( | 38 virtual void GetCurrentSupportedFormats( |
| 39 int max_requested_width, | 39 int max_requested_width, |
| 40 int max_requested_height, | 40 int max_requested_height, |
| 41 const SupportedFormatsCallback& callback); | 41 const SupportedFormatsCallback& callback); |
| 42 | 42 |
| 43 // Starts deliver frames using the resolution in |params|. | 43 // Starts deliver frames using the resolution in |params|. |
| 44 // |new_frame_callback| is triggered when a new video frame is available. | 44 // |new_frame_callback| is triggered when a new video frame is available. |
| 45 // |started_callback| is triggered before the first video frame is received | 45 // |started_callback| is triggered before the first video frame is received |
| 46 // or if the underlying video capturer fails to start. | 46 // or if the underlying video capturer fails to start. |
| 47 virtual void StartDeliver( | 47 virtual void StartDeliver( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 69 private: | 69 private: |
| 70 friend class base::RefCountedThreadSafe<VideoCapturerDelegate>; | 70 friend class base::RefCountedThreadSafe<VideoCapturerDelegate>; |
| 71 friend class MockVideoCapturerDelegate; | 71 friend class MockVideoCapturerDelegate; |
| 72 | 72 |
| 73 virtual ~VideoCapturerDelegate(); | 73 virtual ~VideoCapturerDelegate(); |
| 74 | 74 |
| 75 void OnFrameReadyOnRenderThread( | 75 void OnFrameReadyOnRenderThread( |
| 76 media::VideoCapture* capture, | 76 media::VideoCapture* capture, |
| 77 const scoped_refptr<media::VideoFrame>& frame); | 77 const scoped_refptr<media::VideoFrame>& frame); |
| 78 void OnErrorOnRenderThread(media::VideoCapture* capture); | 78 void OnErrorOnRenderThread(media::VideoCapture* capture); |
| 79 void OnDeviceFormatsInUseReceived(const media::VideoCaptureFormats& formats); |
| 80 void OnDeviceSupportedFormatsEnumerated( |
| 81 const media::VideoCaptureFormats& formats); |
| 79 | 82 |
| 80 // The id identifies which video capture device is used for this video | 83 // The id identifies which video capture device is used for this video |
| 81 // capture session. | 84 // capture session. |
| 82 media::VideoCaptureSessionId session_id_; | 85 media::VideoCaptureSessionId session_id_; |
| 83 scoped_ptr<VideoCaptureHandle> capture_engine_; | 86 scoped_ptr<VideoCaptureHandle> capture_engine_; |
| 84 | 87 |
| 85 bool is_screen_cast_; | 88 bool is_screen_cast_; |
| 86 | 89 |
| 87 // Accessed on the thread where StartDeliver is called. | 90 // Accessed on the thread where StartDeliver is called. |
| 88 bool got_first_frame_; | 91 bool got_first_frame_; |
| 89 | 92 |
| 90 // |new_frame_callback_| is provided to this class in StartDeliver and must be | 93 // |new_frame_callback_| is provided to this class in StartDeliver and must be |
| 91 // valid until StopDeliver is called. | 94 // valid until StopDeliver is called. |
| 92 NewFrameCallback new_frame_callback_; | 95 NewFrameCallback new_frame_callback_; |
| 93 // |started_callback| is provided to this class in StartDeliver and must be | 96 // |started_callback| is provided to this class in StartDeliver and must be |
| 94 // valid until StopDeliver is called. | 97 // valid until StopDeliver is called. |
| 95 StartedCallback started_callback_; | 98 StartedCallback started_callback_; |
| 96 // Message loop of the caller of StartDeliver. | 99 // Message loop of the caller of StartDeliver. |
| 97 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 100 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 98 | 101 |
| 102 SupportedFormatsCallback source_formats_callback_; |
| 103 |
| 99 DISALLOW_COPY_AND_ASSIGN(VideoCapturerDelegate); | 104 DISALLOW_COPY_AND_ASSIGN(VideoCapturerDelegate); |
| 100 }; | 105 }; |
| 101 | 106 |
| 102 class CONTENT_EXPORT MediaStreamVideoCapturerSource | 107 class CONTENT_EXPORT MediaStreamVideoCapturerSource |
| 103 : public MediaStreamVideoSource { | 108 : public MediaStreamVideoSource { |
| 104 public: | 109 public: |
| 105 MediaStreamVideoCapturerSource( | 110 MediaStreamVideoCapturerSource( |
| 106 const StreamDeviceInfo& device_info, | 111 const StreamDeviceInfo& device_info, |
| 107 const SourceStoppedCallback& stop_callback, | 112 const SourceStoppedCallback& stop_callback, |
| 108 const scoped_refptr<VideoCapturerDelegate>& delegate, | 113 const scoped_refptr<VideoCapturerDelegate>& delegate, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 124 private: | 129 private: |
| 125 // The delegate that provides video frames. | 130 // The delegate that provides video frames. |
| 126 scoped_refptr<VideoCapturerDelegate> delegate_; | 131 scoped_refptr<VideoCapturerDelegate> delegate_; |
| 127 | 132 |
| 128 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); | 133 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); |
| 129 }; | 134 }; |
| 130 | 135 |
| 131 } // namespace content | 136 } // namespace content |
| 132 | 137 |
| 133 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 138 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
| OLD | NEW |