Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: media/video/capture/win/video_capture_device_factory_win.cc

Issue 317073010: Win Video Capture: Add support for HDYC pixel format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tommi@s nits Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 int index = 0; 212 int index = 0;
213 ScopedVariant device_id; 213 ScopedVariant device_id;
214 while (enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK) { 214 while (enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK) {
215 ScopedComPtr<IPropertyBag> prop_bag; 215 ScopedComPtr<IPropertyBag> prop_bag;
216 hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, prop_bag.ReceiveVoid()); 216 hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, prop_bag.ReceiveVoid());
217 if (FAILED(hr)) { 217 if (FAILED(hr)) {
218 moniker.Release(); 218 moniker.Release();
219 continue; 219 continue;
220 } 220 }
221 221
222 std::string id;
222 device_id.Reset(); 223 device_id.Reset();
223 hr = prop_bag->Read(L"DevicePath", device_id.Receive(), 0); 224 hr = prop_bag->Read(L"DevicePath", device_id.Receive(), 0);
224 if (FAILED(hr)) { 225 if (FAILED(hr) || device_id.type() != VT_BSTR) {
225 DVLOG(1) << "Couldn't read a device's DevicePath."; 226 // If there is no clear DevicePath, try with Description and FriendlyName.
226 return; 227 ScopedVariant name;
228 if (SUCCEEDED(prop_bag->Read(L"Description", name.Receive(), 0)) ||
229 SUCCEEDED(prop_bag->Read(L"FriendlyName", name.Receive(), 0))) {
230 id = base::SysWideToUTF8(V_BSTR(&name));
231 }
232 } else {
233 DCHECK_EQ(device_id.type(), VT_BSTR);
234 id = base::SysWideToUTF8(V_BSTR(&device_id));
227 } 235 }
228 if (device.id() == base::SysWideToUTF8(V_BSTR(&device_id))) 236
237 if (device.id() == id)
229 break; 238 break;
230 moniker.Release(); 239 moniker.Release();
231 } 240 }
232 241
233 if (moniker.get()) { 242 if (moniker.get()) {
234 base::win::ScopedComPtr<IBaseFilter> capture_filter; 243 base::win::ScopedComPtr<IBaseFilter> capture_filter;
235 hr = VideoCaptureDeviceWin::GetDeviceFilter(device, 244 hr = VideoCaptureDeviceWin::GetDeviceFilter(device,
236 capture_filter.Receive()); 245 capture_filter.Receive());
237 if (!capture_filter) { 246 if (!capture_filter) {
238 DVLOG(2) << "Failed to create capture filter."; 247 DVLOG(2) << "Failed to create capture filter.";
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 const VideoCaptureDevice::Name& device, 436 const VideoCaptureDevice::Name& device,
428 VideoCaptureFormats* formats) { 437 VideoCaptureFormats* formats) {
429 DCHECK(thread_checker_.CalledOnValidThread()); 438 DCHECK(thread_checker_.CalledOnValidThread());
430 if (use_media_foundation_) 439 if (use_media_foundation_)
431 GetDeviceSupportedFormatsMediaFoundation(device, formats); 440 GetDeviceSupportedFormatsMediaFoundation(device, formats);
432 else 441 else
433 GetDeviceSupportedFormatsDirectShow(device, formats); 442 GetDeviceSupportedFormatsDirectShow(device, formats);
434 } 443 }
435 444
436 } // namespace media 445 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/win/sink_filter_win.cc ('k') | media/video/capture/win/video_capture_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698