| 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/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // This is a render thread only object. | 21 // This is a render thread only object. |
| 22 class CONTENT_EXPORT VideoCapturerDelegate | 22 class CONTENT_EXPORT VideoCapturerDelegate |
| 23 : public base::RefCountedThreadSafe<VideoCapturerDelegate> { | 23 : public base::RefCountedThreadSafe<VideoCapturerDelegate> { |
| 24 public: | 24 public: |
| 25 typedef base::Callback<void(bool running)> RunningCallback; | 25 typedef base::Callback<void(bool running)> RunningCallback; |
| 26 | 26 |
| 27 explicit VideoCapturerDelegate( | 27 explicit VideoCapturerDelegate( |
| 28 const StreamDeviceInfo& device_info); | 28 const StreamDeviceInfo& device_info); |
| 29 | 29 |
| 30 // Collects the formats that can currently be used. | 30 // Collects the formats that can currently be used. |
| 31 // |max_requested_height| and |max_requested_width| is used by Tab and Screen | 31 // |max_requested_height|, |max_requested_width|, and |
| 32 // capture to decide what resolution to generate. | 32 // |max_requested_frame_rate| is used by Tab and Screen capture to decide what |
| 33 // |callback| is triggered when the formats have been collected. | 33 // resolution/framerate to generate. |callback| is triggered when the formats |
| 34 // have been collected. |
| 34 virtual void GetCurrentSupportedFormats( | 35 virtual void GetCurrentSupportedFormats( |
| 35 int max_requested_width, | 36 int max_requested_width, |
| 36 int max_requested_height, | 37 int max_requested_height, |
| 38 double max_requested_frame_rate, |
| 37 const VideoCaptureDeviceFormatsCB& callback); | 39 const VideoCaptureDeviceFormatsCB& callback); |
| 38 | 40 |
| 39 // Starts capturing frames using the resolution in |params|. | 41 // Starts capturing frames using the resolution in |params|. |
| 40 // |new_frame_callback| is triggered when a new video frame is available. | 42 // |new_frame_callback| is triggered when a new video frame is available. |
| 41 // If capturing is started successfully then |running_callback| will be | 43 // If capturing is started successfully then |running_callback| will be |
| 42 // called with a parameter of true. | 44 // called with a parameter of true. |
| 43 // If capturing fails to start or stopped due to an external event then | 45 // If capturing fails to start or stopped due to an external event then |
| 44 // |running_callback| will be called with a parameter of false. | 46 // |running_callback| will be called with a parameter of false. |
| 45 virtual void StartCapture( | 47 virtual void StartCapture( |
| 46 const media::VideoCaptureParams& params, | 48 const media::VideoCaptureParams& params, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const SourceStoppedCallback& stop_callback, | 97 const SourceStoppedCallback& stop_callback, |
| 96 const scoped_refptr<VideoCapturerDelegate>& delegate); | 98 const scoped_refptr<VideoCapturerDelegate>& delegate); |
| 97 | 99 |
| 98 virtual ~MediaStreamVideoCapturerSource(); | 100 virtual ~MediaStreamVideoCapturerSource(); |
| 99 | 101 |
| 100 protected: | 102 protected: |
| 101 // Implements MediaStreamVideoSource. | 103 // Implements MediaStreamVideoSource. |
| 102 virtual void GetCurrentSupportedFormats( | 104 virtual void GetCurrentSupportedFormats( |
| 103 int max_requested_width, | 105 int max_requested_width, |
| 104 int max_requested_height, | 106 int max_requested_height, |
| 107 double max_requested_frame_rate, |
| 105 const VideoCaptureDeviceFormatsCB& callback) OVERRIDE; | 108 const VideoCaptureDeviceFormatsCB& callback) OVERRIDE; |
| 106 | 109 |
| 107 virtual void StartSourceImpl( | 110 virtual void StartSourceImpl( |
| 108 const media::VideoCaptureParams& params, | 111 const media::VideoCaptureParams& params, |
| 109 const VideoCaptureDeliverFrameCB& frame_callback) OVERRIDE; | 112 const VideoCaptureDeliverFrameCB& frame_callback) OVERRIDE; |
| 110 | 113 |
| 111 virtual void StopSourceImpl() OVERRIDE; | 114 virtual void StopSourceImpl() OVERRIDE; |
| 112 | 115 |
| 113 private: | 116 private: |
| 114 // The delegate that provides video frames. | 117 // The delegate that provides video frames. |
| 115 scoped_refptr<VideoCapturerDelegate> delegate_; | 118 scoped_refptr<VideoCapturerDelegate> delegate_; |
| 116 | 119 |
| 117 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); | 120 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); |
| 118 }; | 121 }; |
| 119 | 122 |
| 120 } // namespace content | 123 } // namespace content |
| 121 | 124 |
| 122 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 125 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
| OLD | NEW |