OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "media/video/capture/win/video_capture_device_factory_win.h" | 5 #include "media/video/capture/win/video_capture_device_factory_win.h" |
6 | 6 |
7 #include <mfapi.h> | 7 #include <mfapi.h> |
8 #include <mferror.h> | 8 #include <mferror.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // CreateClassEnumerator returns S_FALSE on some Windows OS when no camera | 202 // CreateClassEnumerator returns S_FALSE on some Windows OS when no camera |
203 // exists. Therefore the FAILED macro can't be used. | 203 // exists. Therefore the FAILED macro can't be used. |
204 if (hr != S_OK) | 204 if (hr != S_OK) |
205 return; | 205 return; |
206 | 206 |
207 // Walk the capture devices. No need to check for device presence again since | 207 // Walk the capture devices. No need to check for device presence again since |
208 // that is anyway needed in GetDeviceFilter(). "google camera adapter" and old | 208 // that is anyway needed in GetDeviceFilter(). "google camera adapter" and old |
209 // VFW devices are already skipped previously in GetDeviceNames() enumeration. | 209 // VFW devices are already skipped previously in GetDeviceNames() enumeration. |
210 base::win::ScopedComPtr<IBaseFilter> capture_filter; | 210 base::win::ScopedComPtr<IBaseFilter> capture_filter; |
211 hr = VideoCaptureDeviceWin::GetDeviceFilter(device.capabilities_id(), | 211 hr = VideoCaptureDeviceWin::GetDeviceFilter(device.capabilities_id(), |
| 212 CLSID_VideoInputDeviceCategory, |
212 capture_filter.Receive()); | 213 capture_filter.Receive()); |
213 if (!capture_filter) { | 214 if (!capture_filter) { |
214 DLOG(ERROR) << "Failed to create capture filter: " | 215 DLOG(ERROR) << "Failed to create capture filter: " |
215 << logging::SystemErrorCodeToString(hr); | 216 << logging::SystemErrorCodeToString(hr); |
216 return; | 217 return; |
217 } | 218 } |
218 | 219 |
219 base::win::ScopedComPtr<IPin> output_capture_pin( | 220 base::win::ScopedComPtr<IPin> output_capture_pin( |
220 VideoCaptureDeviceWin::GetPin(capture_filter, | 221 VideoCaptureDeviceWin::GetPin(capture_filter, |
221 PINDIR_OUTPUT, | 222 PINDIR_OUTPUT, |
222 PIN_CATEGORY_CAPTURE)); | 223 PIN_CATEGORY_CAPTURE, |
| 224 GUID_NULL)); |
223 if (!output_capture_pin) { | 225 if (!output_capture_pin) { |
224 DLOG(ERROR) << "Failed to get capture output pin"; | 226 DLOG(ERROR) << "Failed to get capture output pin"; |
225 return; | 227 return; |
226 } | 228 } |
227 | 229 |
228 ScopedComPtr<IAMStreamConfig> stream_config; | 230 ScopedComPtr<IAMStreamConfig> stream_config; |
229 hr = output_capture_pin.QueryInterface(stream_config.Receive()); | 231 hr = output_capture_pin.QueryInterface(stream_config.Receive()); |
230 if (FAILED(hr)) { | 232 if (FAILED(hr)) { |
231 DLOG(ERROR) << "Failed to get IAMStreamConfig interface from " | 233 DLOG(ERROR) << "Failed to get IAMStreamConfig interface from " |
232 "capture device: " << logging::SystemErrorCodeToString(hr); | 234 "capture device: " << logging::SystemErrorCodeToString(hr); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 const Name& device, | 427 const Name& device, |
426 VideoCaptureFormats* formats) { | 428 VideoCaptureFormats* formats) { |
427 DCHECK(thread_checker_.CalledOnValidThread()); | 429 DCHECK(thread_checker_.CalledOnValidThread()); |
428 if (use_media_foundation_) | 430 if (use_media_foundation_) |
429 GetDeviceSupportedFormatsMediaFoundation(device, formats); | 431 GetDeviceSupportedFormatsMediaFoundation(device, formats); |
430 else | 432 else |
431 GetDeviceSupportedFormatsDirectShow(device, formats); | 433 GetDeviceSupportedFormatsDirectShow(device, formats); |
432 } | 434 } |
433 | 435 |
434 } // namespace media | 436 } // namespace media |
OLD | NEW |