OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // VideoCaptureController is the glue between VideoCaptureHost, | 5 // VideoCaptureController is the glue between VideoCaptureHost, |
6 // VideoCaptureManager and VideoCaptureDevice. | 6 // VideoCaptureManager and VideoCaptureDevice. |
7 // It provides functions for VideoCaptureHost to start a VideoCaptureDevice and | 7 // It provides functions for VideoCaptureHost to start a VideoCaptureDevice and |
8 // is responsible for keeping track of TransportDIBs and filling them with I420 | 8 // is responsible for keeping track of TransportDIBs and filling them with I420 |
9 // video frames for IPC communication between VideoCaptureHost and | 9 // video frames for IPC communication between VideoCaptureHost and |
10 // VideoCaptureMessageFilter. | 10 // VideoCaptureMessageFilter. |
11 // It implements media::VideoCaptureDevice::EventHandler to get video frames | 11 // It implements media::VideoCaptureDevice::EventHandler to get video frames |
12 // from a VideoCaptureDevice object and do color conversion straight into the | 12 // from a VideoCaptureDevice object and do color conversion straight into the |
13 // TransportDIBs to avoid a memory copy. | 13 // TransportDIBs to avoid a memory copy. |
14 | 14 |
15 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 15 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
16 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 16 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
17 | 17 |
18 #include <list> | 18 #include <list> |
19 #include <map> | 19 #include <map> |
20 | 20 |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #include "base/process.h" | 22 #include "base/process.h" |
23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
24 #include "base/task.h" | 24 #include "base/task.h" |
25 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" | 25 #include "content/browser/renderer_host/media/video_capture_controller_event_han
dler.h" |
26 #include "media/video/capture/video_capture_device.h" | 26 #include "media/video/capture/video_capture_device.h" |
27 #include "media/video/capture/video_capture_types.h" | 27 #include "media/video/capture/video_capture_types.h" |
28 #include "ui/gfx/surface/transport_dib.h" | 28 #include "ui/gfx/surface/transport_dib.h" |
29 | 29 |
| 30 namespace content { |
| 31 class ResourceContext; |
| 32 } // namespace content |
| 33 |
30 class VideoCaptureController | 34 class VideoCaptureController |
31 : public base::RefCountedThreadSafe<VideoCaptureController>, | 35 : public base::RefCountedThreadSafe<VideoCaptureController>, |
32 public media::VideoCaptureDevice::EventHandler { | 36 public media::VideoCaptureDevice::EventHandler { |
33 public: | 37 public: |
34 VideoCaptureController(const VideoCaptureControllerID& id, | 38 VideoCaptureController(const VideoCaptureControllerID& id, |
35 base::ProcessHandle render_process, | 39 base::ProcessHandle render_process, |
36 VideoCaptureControllerEventHandler* event_handler); | 40 VideoCaptureControllerEventHandler* event_handler, |
| 41 const content::ResourceContext* resource_context); |
37 virtual ~VideoCaptureController(); | 42 virtual ~VideoCaptureController(); |
38 | 43 |
39 // Starts video capturing and tries to use the resolution specified in | 44 // Starts video capturing and tries to use the resolution specified in |
40 // params. | 45 // params. |
41 // When capturing has started VideoCaptureControllerEventHandler::OnFrameInfo | 46 // When capturing has started VideoCaptureControllerEventHandler::OnFrameInfo |
42 // is called with resolution that best matches the requested that the video | 47 // is called with resolution that best matches the requested that the video |
43 // capture device support. | 48 // capture device support. |
44 void StartCapture(const media::VideoCaptureParams& params); | 49 void StartCapture(const media::VideoCaptureParams& params); |
45 | 50 |
46 // Stop video capture. | 51 // Stop video capture. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 DIBMap owned_dibs_; | 85 DIBMap owned_dibs_; |
81 VideoCaptureControllerEventHandler* event_handler_; | 86 VideoCaptureControllerEventHandler* event_handler_; |
82 | 87 |
83 // The parameter that was requested when starting the capture device. | 88 // The parameter that was requested when starting the capture device. |
84 media::VideoCaptureParams params_; | 89 media::VideoCaptureParams params_; |
85 | 90 |
86 // ID used for identifying this object. | 91 // ID used for identifying this object. |
87 VideoCaptureControllerID id_; | 92 VideoCaptureControllerID id_; |
88 media::VideoCaptureDevice::Capability frame_info_; | 93 media::VideoCaptureDevice::Capability frame_info_; |
89 | 94 |
| 95 // Used to get a pointer to VideoCaptureManager. |
| 96 const content::ResourceContext* resource_context_; |
| 97 |
90 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); | 98 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); |
91 }; | 99 }; |
92 | 100 |
93 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 101 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |