OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // VideoCaptureImpl represents a capture device in renderer process. It provides | 5 // VideoCaptureImpl represents a capture device in renderer process. It provides |
6 // interfaces for clients to Start/Stop capture. It also communicates to clients | 6 // interfaces for clients to Start/Stop capture. It also communicates to clients |
7 // when buffer is ready, state of capture device is changed. | 7 // when buffer is ready, state of capture device is changed. |
8 | 8 |
9 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 9 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
10 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 10 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
11 | 11 |
12 #include <list> | 12 #include <list> |
13 #include <map> | 13 #include <map> |
14 | 14 |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/common/media/video_capture.h" | 16 #include "content/common/media/video_capture.h" |
17 #include "content/renderer/media/video_capture_message_filter.h" | 17 #include "content/renderer/media/video_capture_message_filter.h" |
18 #include "media/video/capture/video_capture.h" | 18 #include "media/video/capture/video_capture.h" |
19 #include "media/video/capture/video_capture_types.h" | 19 #include "media/video/capture/video_capture_types.h" |
20 | 20 |
21 namespace base { | 21 namespace base { |
22 class MessageLoopProxy; | 22 class MessageLoopProxy; |
23 } | 23 } |
24 | 24 |
zunger
2012/07/09 20:08:26
What's the thread-safety of this class?
wjia(left Chromium)
2012/07/10 17:32:28
All data processing happens on capture thread whic
| |
25 class CONTENT_EXPORT VideoCaptureImpl | 25 class CONTENT_EXPORT VideoCaptureImpl |
26 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate { | 26 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate { |
zunger
2012/07/09 20:08:26
I don't know if the Chromium codebase is somehow e
wjia(left Chromium)
2012/07/10 17:32:28
Both base classes are pure interfaces. Please refe
| |
27 public: | 27 public: |
28 // media::VideoCapture interface. | 28 // media::VideoCapture interface. |
29 virtual void StartCapture( | 29 virtual void StartCapture( |
30 media::VideoCapture::EventHandler* handler, | 30 media::VideoCapture::EventHandler* handler, |
31 const media::VideoCaptureCapability& capability) OVERRIDE; | 31 const media::VideoCaptureCapability& capability) OVERRIDE; |
32 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; | 32 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; |
33 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; | 33 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; |
34 virtual bool CaptureStarted() OVERRIDE; | 34 virtual bool CaptureStarted() OVERRIDE; |
35 virtual int CaptureWidth() OVERRIDE; | 35 virtual int CaptureWidth() OVERRIDE; |
36 virtual int CaptureHeight() OVERRIDE; | 36 virtual int CaptureHeight() OVERRIDE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 | 81 |
82 // Helpers. | 82 // Helpers. |
83 bool ClientHasDIB(); | 83 bool ClientHasDIB(); |
84 | 84 |
85 scoped_refptr<VideoCaptureMessageFilter> message_filter_; | 85 scoped_refptr<VideoCaptureMessageFilter> message_filter_; |
86 scoped_refptr<base::MessageLoopProxy> capture_message_loop_proxy_; | 86 scoped_refptr<base::MessageLoopProxy> capture_message_loop_proxy_; |
87 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 87 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
88 int device_id_; | 88 int device_id_; |
89 | 89 |
90 // Pool of DIBs. | 90 // Pool of DIBs. |
91 typedef std::map<int /* buffer_id */, DIBBuffer*> CachedDIB; | 91 typedef std::map<int /* buffer_id */, DIBBuffer*> CachedDIB; |
zunger
2012/07/09 20:08:26
/* */ comments forbidden.
wjia(left Chromium)
2012/07/10 17:32:28
Done.
| |
92 CachedDIB cached_dibs_; | 92 CachedDIB cached_dibs_; |
93 | 93 |
94 typedef std::map<media::VideoCapture::EventHandler*, | 94 typedef std::map<media::VideoCapture::EventHandler*, |
95 media::VideoCaptureCapability> ClientInfo; | 95 media::VideoCaptureCapability> ClientInfo; |
96 ClientInfo clients_; | 96 ClientInfo clients_; |
97 | 97 |
98 ClientInfo clients_pending_on_filter_; | 98 ClientInfo clients_pending_on_filter_; |
99 ClientInfo clients_pending_on_restart_; | 99 ClientInfo clients_pending_on_restart_; |
100 | 100 |
101 media::VideoCaptureCapability::Format video_type_; | 101 media::VideoCaptureCapability::Format video_type_; |
102 | 102 |
103 // The parameter is being used in current capture session. A capture session | 103 // The parameter is being used in current capture session. A capture session |
104 // starts with StartCapture and ends with StopCapture. | 104 // starts with StartCapture and ends with StopCapture. |
105 media::VideoCaptureParams current_params_; | 105 media::VideoCaptureParams current_params_; |
106 | 106 |
107 // The information about the device sent from browser process side. | 107 // The information about the device sent from browser process side. |
108 media::VideoCaptureParams device_info_; | 108 media::VideoCaptureParams device_info_; |
109 bool device_info_available_; | 109 bool device_info_available_; |
110 | 110 |
111 video_capture::State state_; | 111 video_capture::State state_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 113 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
114 }; | 114 }; |
115 | 115 |
116 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 116 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
OLD | NEW |