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 20 matching lines...) Expand all Loading... |
68 | 68 |
69 private: | 69 private: |
70 friend class base::RefCountedThreadSafe<VideoCapturerDelegate>; | 70 friend class base::RefCountedThreadSafe<VideoCapturerDelegate>; |
71 | 71 |
72 virtual ~VideoCapturerDelegate(); | 72 virtual ~VideoCapturerDelegate(); |
73 | 73 |
74 void OnFrameReadyOnCaptureThread( | 74 void OnFrameReadyOnCaptureThread( |
75 media::VideoCapture* capture, | 75 media::VideoCapture* capture, |
76 const scoped_refptr<media::VideoFrame>& frame); | 76 const scoped_refptr<media::VideoFrame>& frame); |
77 void OnErrorOnCaptureThread(media::VideoCapture* capture); | 77 void OnErrorOnCaptureThread(media::VideoCapture* capture); |
| 78 void OnDeviceFormatsInUseReceived(const media::VideoCaptureFormats& formats); |
| 79 void OnDeviceSupportedFormatsEnumerated( |
| 80 const media::VideoCaptureFormats& formats); |
78 | 81 |
79 // The id identifies which video capture device is used for this video | 82 // The id identifies which video capture device is used for this video |
80 // capture session. | 83 // capture session. |
81 media::VideoCaptureSessionId session_id_; | 84 media::VideoCaptureSessionId session_id_; |
82 scoped_ptr<VideoCaptureHandle> capture_engine_; | 85 scoped_ptr<VideoCaptureHandle> capture_engine_; |
83 | 86 |
84 bool is_screen_cast_; | 87 bool is_screen_cast_; |
85 | 88 |
86 // Accessed on the thread where StartDeliver is called. | 89 // Accessed on the thread where StartDeliver is called. |
87 bool got_first_frame_; | 90 bool got_first_frame_; |
88 | 91 |
89 // |new_frame_callback_| is provided to this class in StartDeliver and must be | 92 // |new_frame_callback_| is provided to this class in StartDeliver and must be |
90 // valid until StopDeliver is called. | 93 // valid until StopDeliver is called. |
91 NewFrameCallback new_frame_callback_; | 94 NewFrameCallback new_frame_callback_; |
92 // |started_callback| is provided to this class in StartDeliver and must be | 95 // |started_callback| is provided to this class in StartDeliver and must be |
93 // valid until StopDeliver is called. | 96 // valid until StopDeliver is called. |
94 StartedCallback started_callback_; | 97 StartedCallback started_callback_; |
95 // Message loop of the caller of StartDeliver. | 98 // Message loop of the caller of StartDeliver. |
96 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 99 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
97 | 100 |
| 101 SupportedFormatsCallback source_formats_callback_; |
| 102 |
98 DISALLOW_COPY_AND_ASSIGN(VideoCapturerDelegate); | 103 DISALLOW_COPY_AND_ASSIGN(VideoCapturerDelegate); |
99 }; | 104 }; |
100 | 105 |
101 class MediaStreamVideoCapturerSource : public MediaStreamVideoSource { | 106 class MediaStreamVideoCapturerSource : public MediaStreamVideoSource { |
102 public: | 107 public: |
103 MediaStreamVideoCapturerSource( | 108 MediaStreamVideoCapturerSource( |
104 const StreamDeviceInfo& device_info, | 109 const StreamDeviceInfo& device_info, |
105 const SourceStoppedCallback& stop_callback, | 110 const SourceStoppedCallback& stop_callback, |
106 const scoped_refptr<VideoCapturerDelegate>& delegate, | 111 const scoped_refptr<VideoCapturerDelegate>& delegate, |
107 MediaStreamDependencyFactory* factory); | 112 MediaStreamDependencyFactory* factory); |
(...skipping 14 matching lines...) Expand all Loading... |
122 private: | 127 private: |
123 // The delegate that provides video frames. | 128 // The delegate that provides video frames. |
124 scoped_refptr<VideoCapturerDelegate> delegate_; | 129 scoped_refptr<VideoCapturerDelegate> delegate_; |
125 | 130 |
126 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); | 131 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); |
127 }; | 132 }; |
128 | 133 |
129 } // namespace content | 134 } // namespace content |
130 | 135 |
131 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 136 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
OLD | NEW |