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/capture/video/win/video_capture_device_factory_win.h" | 5 #include "media/capture/video/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 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 ExpandEnvironmentStringsW(kMfDLL, path, arraysize(path)); | 72 ExpandEnvironmentStringsW(kMfDLL, path, arraysize(path)); |
73 if (!LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) | 73 if (!LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) |
74 return false; | 74 return false; |
75 } | 75 } |
76 return true; | 76 return true; |
77 } | 77 } |
78 | 78 |
79 static bool PrepareVideoCaptureAttributesMediaFoundation( | 79 static bool PrepareVideoCaptureAttributesMediaFoundation( |
80 IMFAttributes** attributes, | 80 IMFAttributes** attributes, |
81 int count) { | 81 int count) { |
82 InitializeMediaFoundation(); | 82 if (!InitializeMediaFoundation()) |
| 83 return false; |
83 | 84 |
84 if (FAILED(MFCreateAttributes(attributes, count))) | 85 if (FAILED(MFCreateAttributes(attributes, count))) |
85 return false; | 86 return false; |
86 | 87 |
87 return SUCCEEDED( | 88 return SUCCEEDED( |
88 (*attributes) | 89 (*attributes) |
89 ->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, | 90 ->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, |
90 MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID)); | 91 MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID)); |
91 } | 92 } |
92 | 93 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 460 } |
460 | 461 |
461 // static | 462 // static |
462 VideoCaptureDeviceFactory* | 463 VideoCaptureDeviceFactory* |
463 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 464 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
464 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 465 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
465 return new VideoCaptureDeviceFactoryWin(); | 466 return new VideoCaptureDeviceFactoryWin(); |
466 } | 467 } |
467 | 468 |
468 } // namespace media | 469 } // namespace media |
OLD | NEW |