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 shared DIBs and filling them with I420 | 8 // is responsible for keeping track of shared DIBs 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. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void ReturnBuffer(const VideoCaptureControllerID& id, | 65 void ReturnBuffer(const VideoCaptureControllerID& id, |
66 VideoCaptureControllerEventHandler* event_handler, | 66 VideoCaptureControllerEventHandler* event_handler, |
67 int buffer_id); | 67 int buffer_id); |
68 | 68 |
69 // Implement media::VideoCaptureDevice::EventHandler. | 69 // Implement media::VideoCaptureDevice::EventHandler. |
70 virtual void OnIncomingCapturedFrame(const uint8* data, | 70 virtual void OnIncomingCapturedFrame(const uint8* data, |
71 int length, | 71 int length, |
72 base::Time timestamp) OVERRIDE; | 72 base::Time timestamp) OVERRIDE; |
73 virtual void OnError() OVERRIDE; | 73 virtual void OnError() OVERRIDE; |
74 virtual void OnFrameInfo( | 74 virtual void OnFrameInfo( |
75 const media::VideoCaptureDevice::Capability& info) OVERRIDE; | 75 const media::VideoCaptureCapability& info) OVERRIDE; |
76 | 76 |
77 private: | 77 private: |
78 struct ControllerClient; | 78 struct ControllerClient; |
79 typedef std::list<ControllerClient*> ControllerClients; | 79 typedef std::list<ControllerClient*> ControllerClients; |
80 | 80 |
81 // Callback when manager has stopped device. | 81 // Callback when manager has stopped device. |
82 void OnDeviceStopped(); | 82 void OnDeviceStopped(); |
83 | 83 |
84 // Worker functions on IO thread. | 84 // Worker functions on IO thread. |
85 void DoIncomingCapturedFrameOnIOThread(int buffer_id, base::Time timestamp); | 85 void DoIncomingCapturedFrameOnIOThread(int buffer_id, base::Time timestamp); |
86 void DoFrameInfoOnIOThread(const media::VideoCaptureDevice::Capability info); | 86 void DoFrameInfoOnIOThread(const media::VideoCaptureCapability info); |
87 void DoErrorOnIOThread(); | 87 void DoErrorOnIOThread(); |
88 void DoDeviceStateOnIOThread(bool in_use); | 88 void DoDeviceStateOnIOThread(bool in_use); |
89 void DoDeviceStoppedOnIOThread(); | 89 void DoDeviceStoppedOnIOThread(); |
90 | 90 |
91 // Send frame info and init buffers to |client|. | 91 // Send frame info and init buffers to |client|. |
92 void SendFrameInfoAndBuffers(ControllerClient* client, int buffer_size); | 92 void SendFrameInfoAndBuffers(ControllerClient* client, int buffer_size); |
93 | 93 |
94 // Helpers. | 94 // Helpers. |
95 // Find a client of |id| and |handler| in |clients|. | 95 // Find a client of |id| and |handler| in |clients|. |
96 ControllerClient* FindClient( | 96 ControllerClient* FindClient( |
(...skipping 19 matching lines...) Expand all Loading... |
116 ControllerClients controller_clients_; | 116 ControllerClients controller_clients_; |
117 | 117 |
118 // All clients waiting for service. | 118 // All clients waiting for service. |
119 ControllerClients pending_clients_; | 119 ControllerClients pending_clients_; |
120 | 120 |
121 // The parameter that currently used for the capturing. | 121 // The parameter that currently used for the capturing. |
122 media::VideoCaptureParams current_params_; | 122 media::VideoCaptureParams current_params_; |
123 | 123 |
124 // It's modified on caller thread, assuming there is only one OnFrameInfo() | 124 // It's modified on caller thread, assuming there is only one OnFrameInfo() |
125 // call per StartCapture(). | 125 // call per StartCapture(). |
126 media::VideoCaptureDevice::Capability frame_info_; | 126 media::VideoCaptureCapability frame_info_; |
127 | 127 |
128 // It's accessed only on IO thread. | 128 // It's accessed only on IO thread. |
129 bool frame_info_available_; | 129 bool frame_info_available_; |
130 | 130 |
131 media_stream::VideoCaptureManager* video_capture_manager_; | 131 media_stream::VideoCaptureManager* video_capture_manager_; |
132 | 132 |
133 bool device_in_use_; | 133 bool device_in_use_; |
134 video_capture::State state_; | 134 video_capture::State state_; |
135 | 135 |
136 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); | 136 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); |
137 }; | 137 }; |
138 | 138 |
139 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ | 139 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_H_ |
OLD | NEW |