| 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 #include "media/capture/video/win/video_capture_device_mf_win.h" | 5 #include "media/capture/video/win/video_capture_device_mf_win.h" |
| 6 | 6 |
| 7 #include <mfapi.h> | 7 #include <mfapi.h> |
| 8 #include <mferror.h> | 8 #include <mferror.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
| 17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/win/scoped_co_mem.h" | 18 #include "base/win/scoped_co_mem.h" |
| 19 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
| 20 #include "media/capture/video/video_capture_utils.h" |
| 20 #include "media/capture/video/win/capability_list_win.h" | 21 #include "media/capture/video/win/capability_list_win.h" |
| 21 | 22 |
| 22 using base::win::ScopedCoMem; | 23 using base::win::ScopedCoMem; |
| 23 using base::win::ScopedComPtr; | 24 using base::win::ScopedComPtr; |
| 24 | 25 |
| 25 namespace media { | 26 namespace media { |
| 26 | 27 |
| 27 static bool GetFrameSize(IMFMediaType* type, gfx::Size* frame_size) { | 28 static bool GetFrameSize(IMFMediaType* type, gfx::Size* frame_size) { |
| 28 UINT32 width32, height32; | 29 UINT32 width32, height32; |
| 29 if (FAILED(MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width32, &height32))) | 30 if (FAILED(MFGetAttributeSize(type, MF_MT_FRAME_SIZE, &width32, &height32))) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 {MFVideoFormat_MJPG, PIXEL_FORMAT_MJPEG}, | 172 {MFVideoFormat_MJPG, PIXEL_FORMAT_MJPEG}, |
| 172 {MFVideoFormat_YV12, PIXEL_FORMAT_YV12}, | 173 {MFVideoFormat_YV12, PIXEL_FORMAT_YV12}, |
| 173 }; | 174 }; |
| 174 | 175 |
| 175 for (const auto& kFormat : kFormatMap) { | 176 for (const auto& kFormat : kFormatMap) { |
| 176 if (kFormat.guid == guid) { | 177 if (kFormat.guid == guid) { |
| 177 *format = kFormat.format; | 178 *format = kFormat.format; |
| 178 return true; | 179 return true; |
| 179 } | 180 } |
| 180 } | 181 } |
| 182 if (IsY16FormatFourCc(guid.Data1)) { |
| 183 *format = PIXEL_FORMAT_Y16; |
| 184 return true; |
| 185 } |
| 181 | 186 |
| 182 return false; | 187 return false; |
| 183 } | 188 } |
| 184 | 189 |
| 185 VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin( | 190 VideoCaptureDeviceMFWin::VideoCaptureDeviceMFWin( |
| 186 const VideoCaptureDeviceDescriptor& device_descriptor) | 191 const VideoCaptureDeviceDescriptor& device_descriptor) |
| 187 : descriptor_(device_descriptor), capture_(0) { | 192 : descriptor_(device_descriptor), capture_(0) { |
| 188 DetachFromThread(); | 193 DetachFromThread(); |
| 189 } | 194 } |
| 190 | 195 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 HRESULT hr) { | 311 HRESULT hr) { |
| 307 if (client_.get()) { | 312 if (client_.get()) { |
| 308 client_->OnError( | 313 client_->OnError( |
| 309 from_here, | 314 from_here, |
| 310 base::StringPrintf("VideoCaptureDeviceMFWin: %s", | 315 base::StringPrintf("VideoCaptureDeviceMFWin: %s", |
| 311 logging::SystemErrorCodeToString(hr).c_str())); | 316 logging::SystemErrorCodeToString(hr).c_str())); |
| 312 } | 317 } |
| 313 } | 318 } |
| 314 | 319 |
| 315 } // namespace media | 320 } // namespace media |
| OLD | NEW |