Chromium Code Reviews| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 base::win::ScopedComPtr<IMFSourceReader> reader; | 292 base::win::ScopedComPtr<IMFSourceReader> reader; |
| 293 HRESULT hr = | 293 HRESULT hr = |
| 294 MFCreateSourceReaderFromMediaSource(source, NULL, reader.Receive()); | 294 MFCreateSourceReaderFromMediaSource(source, NULL, reader.Receive()); |
| 295 if (FAILED(hr)) { | 295 if (FAILED(hr)) { |
| 296 DLOG(ERROR) << "MFCreateSourceReaderFromMediaSource: " << std::hex << hr; | 296 DLOG(ERROR) << "MFCreateSourceReaderFromMediaSource: " << std::hex << hr; |
| 297 return; | 297 return; |
| 298 } | 298 } |
| 299 | 299 |
| 300 DWORD stream_index = 0; | 300 DWORD stream_index = 0; |
| 301 ScopedComPtr<IMFMediaType> type; | 301 ScopedComPtr<IMFMediaType> type; |
| 302 for (hr = reader->GetNativeMediaType(kFirstVideoStream, stream_index, | 302 while (SUCCEEDED(hr = reader->GetNativeMediaType( |
|
mcasas
2014/08/28 16:48:27
remove hr = ?
magjed_chromium
2014/08/28 17:00:55
Done.
| |
| 303 type.Receive()); | 303 kFirstVideoStream, stream_index, type.Receive()))) { |
| 304 SUCCEEDED(hr); | |
| 305 hr = reader->GetNativeMediaType(kFirstVideoStream, stream_index, | |
| 306 type.Receive())) { | |
| 307 UINT32 width, height; | 304 UINT32 width, height; |
| 308 hr = MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width, &height); | 305 hr = MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width, &height); |
| 309 if (FAILED(hr)) { | 306 if (FAILED(hr)) { |
| 310 DLOG(ERROR) << "MFGetAttributeSize: " << std::hex << hr; | 307 DLOG(ERROR) << "MFGetAttributeSize: " << std::hex << hr; |
| 311 return; | 308 return; |
| 312 } | 309 } |
| 313 VideoCaptureFormat capture_format; | 310 VideoCaptureFormat capture_format; |
| 314 capture_format.frame_size.SetSize(width, height); | 311 capture_format.frame_size.SetSize(width, height); |
| 315 | 312 |
| 316 UINT32 numerator, denominator; | 313 UINT32 numerator, denominator; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 const VideoCaptureDevice::Name& device, | 407 const VideoCaptureDevice::Name& device, |
| 411 VideoCaptureFormats* formats) { | 408 VideoCaptureFormats* formats) { |
| 412 DCHECK(thread_checker_.CalledOnValidThread()); | 409 DCHECK(thread_checker_.CalledOnValidThread()); |
| 413 if (use_media_foundation_) | 410 if (use_media_foundation_) |
| 414 GetDeviceSupportedFormatsMediaFoundation(device, formats); | 411 GetDeviceSupportedFormatsMediaFoundation(device, formats); |
| 415 else | 412 else |
| 416 GetDeviceSupportedFormatsDirectShow(device, formats); | 413 GetDeviceSupportedFormatsDirectShow(device, formats); |
| 417 } | 414 } |
| 418 | 415 |
| 419 } // namespace media | 416 } // namespace media |
| OLD | NEW |