| 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 |
| 11 // Avoid including strsafe.h via dshow as it will cause build warnings. | 11 // Avoid including strsafe.h via dshow as it will cause build warnings. |
| 12 #define NO_DSHOW_STRSAFE | 12 #define NO_DSHOW_STRSAFE |
| 13 #include <dshow.h> | 13 #include <dshow.h> |
| 14 #include <stdint.h> | 14 #include <stdint.h> |
| 15 #include <vidcap.h> | |
| 16 | 15 |
| 17 #include <map> | 16 #include <map> |
| 18 #include <string> | 17 #include <string> |
| 19 | 18 |
| 20 #include "base/macros.h" | 19 #include "base/macros.h" |
| 21 #include "base/threading/thread_checker.h" | 20 #include "base/threading/thread_checker.h" |
| 22 #include "base/win/scoped_comptr.h" | 21 #include "base/win/scoped_comptr.h" |
| 23 #include "media/capture/video/video_capture_device.h" | 22 #include "media/capture/video/video_capture_device.h" |
| 24 #include "media/capture/video/win/capability_list_win.h" | 23 #include "media/capture/video/win/capability_list_win.h" |
| 25 #include "media/capture/video/win/sink_filter_win.h" | 24 #include "media/capture/video/win/sink_filter_win.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Opens the device driver for this device. | 70 // Opens the device driver for this device. |
| 72 bool Init(); | 71 bool Init(); |
| 73 | 72 |
| 74 // VideoCaptureDevice implementation. | 73 // VideoCaptureDevice implementation. |
| 75 void AllocateAndStart( | 74 void AllocateAndStart( |
| 76 const VideoCaptureParams& params, | 75 const VideoCaptureParams& params, |
| 77 std::unique_ptr<VideoCaptureDevice::Client> client) override; | 76 std::unique_ptr<VideoCaptureDevice::Client> client) override; |
| 78 void StopAndDeAllocate() override; | 77 void StopAndDeAllocate() override; |
| 79 void TakePhoto(TakePhotoCallback callback) override; | 78 void TakePhoto(TakePhotoCallback callback) override; |
| 80 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override; | 79 void GetPhotoCapabilities(GetPhotoCapabilitiesCallback callback) override; |
| 81 void SetPhotoOptions(mojom::PhotoSettingsPtr settings, | |
| 82 SetPhotoOptionsCallback callback) override; | |
| 83 | 80 |
| 84 private: | 81 private: |
| 85 enum InternalState { | 82 enum InternalState { |
| 86 kIdle, // The device driver is opened but camera is not in use. | 83 kIdle, // The device driver is opened but camera is not in use. |
| 87 kCapturing, // Video is being captured. | 84 kCapturing, // Video is being captured. |
| 88 kError // Error accessing HW functions. | 85 kError // Error accessing HW functions. |
| 89 // User needs to recover by destroying the object. | 86 // User needs to recover by destroying the object. |
| 90 }; | 87 }; |
| 91 | 88 |
| 92 // Implements SinkFilterObserver. | 89 // Implements SinkFilterObserver. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 112 | 109 |
| 113 base::win::ScopedComPtr<IMediaControl> media_control_; | 110 base::win::ScopedComPtr<IMediaControl> media_control_; |
| 114 base::win::ScopedComPtr<IPin> input_sink_pin_; | 111 base::win::ScopedComPtr<IPin> input_sink_pin_; |
| 115 base::win::ScopedComPtr<IPin> output_capture_pin_; | 112 base::win::ScopedComPtr<IPin> output_capture_pin_; |
| 116 | 113 |
| 117 scoped_refptr<SinkFilter> sink_filter_; | 114 scoped_refptr<SinkFilter> sink_filter_; |
| 118 | 115 |
| 119 // Map of all capabilities this device support. | 116 // Map of all capabilities this device support. |
| 120 CapabilityList capabilities_; | 117 CapabilityList capabilities_; |
| 121 | 118 |
| 122 VideoCaptureFormat capture_format_; | |
| 123 | |
| 124 base::win::ScopedComPtr<ICameraControl> camera_control_; | |
| 125 base::win::ScopedComPtr<IVideoProcAmp> video_control_; | |
| 126 // These flags keep the manual/auto mode between cycles of SetPhotoOptions(). | |
| 127 bool white_balance_mode_manual_; | |
| 128 bool exposure_mode_manual_; | |
| 129 | |
| 130 base::TimeTicks first_ref_time_; | 119 base::TimeTicks first_ref_time_; |
| 131 | 120 |
| 132 std::queue<TakePhotoCallback> take_photo_callbacks_; | 121 std::queue<TakePhotoCallback> take_photo_callbacks_; |
| 133 | 122 |
| 134 base::ThreadChecker thread_checker_; | 123 base::ThreadChecker thread_checker_; |
| 135 | 124 |
| 136 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin); | 125 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceWin); |
| 137 }; | 126 }; |
| 138 | 127 |
| 139 } // namespace media | 128 } // namespace media |
| 140 | 129 |
| 141 #endif // MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ | 130 #endif // MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_WIN_H_ |
| OLD | NEW |