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 // Windows specific implementation of VideoCaptureDevice. DirectShow is used for | 5 // Windows specific implementation of VideoCaptureDevice. DirectShow is used for |
6 // capturing. DirectShow provide its own threads for capturing. | 6 // capturing. DirectShow provide its own threads for capturing. |
7 | 7 |
8 #ifndef MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ | 8 #ifndef MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ |
9 #define MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ | 9 #define MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 enum InternalState { | 81 enum InternalState { |
82 kIdle, // The device driver is opened but camera is not in use. | 82 kIdle, // The device driver is opened but camera is not in use. |
83 kCapturing, // Video is being captured. | 83 kCapturing, // Video is being captured. |
84 kError // Error accessing HW functions. | 84 kError // Error accessing HW functions. |
85 // User needs to recover by destroying the object. | 85 // User needs to recover by destroying the object. |
86 }; | 86 }; |
87 | 87 |
88 // Implements SinkFilterObserver. | 88 // Implements SinkFilterObserver. |
89 void FrameReceived(const uint8_t* buffer, | 89 void FrameReceived(const uint8_t* buffer, |
90 int length, | 90 int length, |
| 91 const VideoCaptureFormat& format, |
91 base::TimeDelta timestamp) override; | 92 base::TimeDelta timestamp) override; |
92 | 93 |
93 bool CreateCapabilityMap(); | 94 bool CreateCapabilityMap(); |
94 void SetAntiFlickerInCaptureFilter(const VideoCaptureParams& params); | 95 void SetAntiFlickerInCaptureFilter(const VideoCaptureParams& params); |
95 void SetErrorState(const tracked_objects::Location& from_here, | 96 void SetErrorState(const tracked_objects::Location& from_here, |
96 const std::string& reason, | 97 const std::string& reason, |
97 HRESULT hr); | 98 HRESULT hr); |
98 | 99 |
99 const VideoCaptureDeviceDescriptor device_descriptor_; | 100 const VideoCaptureDeviceDescriptor device_descriptor_; |
100 InternalState state_; | 101 InternalState state_; |
101 std::unique_ptr<VideoCaptureDevice::Client> client_; | 102 std::unique_ptr<VideoCaptureDevice::Client> client_; |
102 | 103 |
103 base::win::ScopedComPtr<IBaseFilter> capture_filter_; | 104 base::win::ScopedComPtr<IBaseFilter> capture_filter_; |
104 | 105 |
105 base::win::ScopedComPtr<IGraphBuilder> graph_builder_; | 106 base::win::ScopedComPtr<IGraphBuilder> graph_builder_; |
106 base::win::ScopedComPtr<ICaptureGraphBuilder2> capture_graph_builder_; | 107 base::win::ScopedComPtr<ICaptureGraphBuilder2> capture_graph_builder_; |
107 | 108 |
108 base::win::ScopedComPtr<IMediaControl> media_control_; | 109 base::win::ScopedComPtr<IMediaControl> media_control_; |
109 base::win::ScopedComPtr<IPin> input_sink_pin_; | 110 base::win::ScopedComPtr<IPin> input_sink_pin_; |
110 base::win::ScopedComPtr<IPin> output_capture_pin_; | 111 base::win::ScopedComPtr<IPin> output_capture_pin_; |
111 | 112 |
112 scoped_refptr<SinkFilter> sink_filter_; | 113 scoped_refptr<SinkFilter> sink_filter_; |
113 | 114 |
114 // Map of all capabilities this device support. | 115 // Map of all capabilities this device support. |
115 CapabilityList capabilities_; | 116 CapabilityList capabilities_; |
116 VideoCaptureFormat capture_format_; | |
117 | 117 |
118 base::TimeTicks first_ref_time_; | 118 base::TimeTicks first_ref_time_; |
119 | 119 |
120 std::queue<TakePhotoCallback> take_photo_callbacks_; | 120 std::queue<TakePhotoCallback> take_photo_callbacks_; |
121 | 121 |
122 base::ThreadChecker thread_checker_; | 122 base::ThreadChecker thread_checker_; |
123 | 123 |
124 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin); | 124 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace media | 127 } // namespace media |
128 | 128 |
129 #endif // MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ | 129 #endif // MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ |
OLD | NEW |