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/video/capture/win/video_capture_device_mf_win.h" | 5 #include "media/video/capture/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 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ScopedComPtr<IMFAttributes> attributes; | 63 ScopedComPtr<IMFAttributes> attributes; |
64 if (!PrepareVideoCaptureAttributes(attributes.Receive(), 2)) | 64 if (!PrepareVideoCaptureAttributes(attributes.Receive(), 2)) |
65 return false; | 65 return false; |
66 | 66 |
67 attributes->SetString(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, | 67 attributes->SetString(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, |
68 base::SysUTF8ToWide(sym_link).c_str()); | 68 base::SysUTF8ToWide(sym_link).c_str()); |
69 | 69 |
70 return SUCCEEDED(MFCreateDeviceSource(attributes, source)); | 70 return SUCCEEDED(MFCreateDeviceSource(attributes, source)); |
71 } | 71 } |
72 | 72 |
73 bool FormatFromGuid(const GUID& guid, VideoCaptureCapability::Format* format) { | 73 bool FormatFromGuid(const GUID& guid, VideoPixelFormat* format) { |
74 struct { | 74 struct { |
75 const GUID& guid; | 75 const GUID& guid; |
76 const VideoCaptureCapability::Format format; | 76 const VideoPixelFormat format; |
77 } static const kFormatMap[] = { | 77 } static const kFormatMap[] = { |
78 { MFVideoFormat_I420, VideoCaptureCapability::kI420 }, | 78 { MFVideoFormat_I420, PIXEL_FORMAT_I420 }, |
79 { MFVideoFormat_YUY2, VideoCaptureCapability::kYUY2 }, | 79 { MFVideoFormat_YUY2, PIXEL_FORMAT_YUY2 }, |
80 { MFVideoFormat_UYVY, VideoCaptureCapability::kUYVY }, | 80 { MFVideoFormat_UYVY, PIXEL_FORMAT_UYVY }, |
81 { MFVideoFormat_RGB24, VideoCaptureCapability::kRGB24 }, | 81 { MFVideoFormat_RGB24, PIXEL_FORMAT_RGB24 }, |
82 { MFVideoFormat_ARGB32, VideoCaptureCapability::kARGB }, | 82 { MFVideoFormat_ARGB32, PIXEL_FORMAT_ARGB }, |
83 { MFVideoFormat_MJPG, VideoCaptureCapability::kMJPEG }, | 83 { MFVideoFormat_MJPG, PIXEL_FORMAT_MJPEG }, |
84 { MFVideoFormat_YV12, VideoCaptureCapability::kYV12 }, | 84 { MFVideoFormat_YV12, PIXEL_FORMAT_YV12 }, |
85 }; | 85 }; |
86 | 86 |
87 for (int i = 0; i < arraysize(kFormatMap); ++i) { | 87 for (int i = 0; i < arraysize(kFormatMap); ++i) { |
88 if (kFormatMap[i].guid == guid) { | 88 if (kFormatMap[i].guid == guid) { |
89 *format = kFormatMap[i].format; | 89 *format = kFormatMap[i].format; |
90 return true; | 90 return true; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 return false; | 94 return false; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { | 469 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { |
470 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; | 470 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; |
471 if (observer_) | 471 if (observer_) |
472 observer_->OnError(); | 472 observer_->OnError(); |
473 } | 473 } |
474 | 474 |
475 } // namespace media | 475 } // namespace media |
OLD | NEW |