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( |
48 const media::VideoCaptureParams& params, | 48 const media::VideoCaptureParams& params, |
49 const NewFrameCallback& new_frame_callback, | 49 const NewFrameCallback& new_frame_callback, |
50 const StartedCallback& started_callback); | 50 const StartedCallback& started_callback); |
51 | 51 |
52 // Stops deliver frames and clears all callbacks including the | 52 // Stops deliver frames and clears all callbacks including the |
53 // SupportedFormatsCallback callback. | 53 // SupportedFormatsCallback callback. |
54 virtual void StopDeliver(); | 54 virtual void StopDeliver(); |
55 | 55 |
56 void OnDeviceFormatsInUseReceived(const media::VideoCaptureFormats& formats); | |
perkj_chrome
2014/03/12 19:55:48
make these functions private
mcasas
2014/03/13 08:04:56
Done.
| |
57 void OnDeviceSupportedFormatsEnumerated( | |
58 const media::VideoCaptureFormats& formats); | |
59 | |
56 protected: | 60 protected: |
57 // media::VideoCapture::EventHandler implementation. | 61 // media::VideoCapture::EventHandler implementation. |
58 // These functions are called on the IO thread (same as where | 62 // These functions are called on the IO thread (same as where |
59 // |capture_engine_| runs). | 63 // |capture_engine_| runs). |
60 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; | 64 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; |
61 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; | 65 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; |
62 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; | 66 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; |
63 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; | 67 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; |
64 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; | 68 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; |
65 virtual void OnFrameReady( | 69 virtual void OnFrameReady( |
(...skipping 22 matching lines...) Expand all Loading... | |
88 | 92 |
89 // |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 |
90 // valid until StopDeliver is called. | 94 // valid until StopDeliver is called. |
91 NewFrameCallback new_frame_callback_; | 95 NewFrameCallback new_frame_callback_; |
92 // |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 |
93 // valid until StopDeliver is called. | 97 // valid until StopDeliver is called. |
94 StartedCallback started_callback_; | 98 StartedCallback started_callback_; |
95 // Message loop of the caller of StartDeliver. | 99 // Message loop of the caller of StartDeliver. |
96 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 100 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
97 | 101 |
102 SupportedFormatsCallback source_formats_callback_; | |
103 | |
98 DISALLOW_COPY_AND_ASSIGN(VideoCapturerDelegate); | 104 DISALLOW_COPY_AND_ASSIGN(VideoCapturerDelegate); |
99 }; | 105 }; |
100 | 106 |
101 class MediaStreamVideoCapturerSource : public MediaStreamVideoSource { | 107 class MediaStreamVideoCapturerSource : public MediaStreamVideoSource { |
102 public: | 108 public: |
103 MediaStreamVideoCapturerSource( | 109 MediaStreamVideoCapturerSource( |
104 const StreamDeviceInfo& device_info, | 110 const StreamDeviceInfo& device_info, |
105 const SourceStoppedCallback& stop_callback, | 111 const SourceStoppedCallback& stop_callback, |
106 const scoped_refptr<VideoCapturerDelegate>& delegate, | 112 const scoped_refptr<VideoCapturerDelegate>& delegate, |
107 MediaStreamDependencyFactory* factory); | 113 MediaStreamDependencyFactory* factory); |
(...skipping 14 matching lines...) Expand all Loading... | |
122 private: | 128 private: |
123 // The delegate that provides video frames. | 129 // The delegate that provides video frames. |
124 scoped_refptr<VideoCapturerDelegate> delegate_; | 130 scoped_refptr<VideoCapturerDelegate> delegate_; |
125 | 131 |
126 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); | 132 DISALLOW_COPY_AND_ASSIGN(MediaStreamVideoCapturerSource); |
127 }; | 133 }; |
128 | 134 |
129 } // namespace content | 135 } // namespace content |
130 | 136 |
131 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ | 137 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_ |
OLD | NEW |