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