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

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

Issue 2792383003: Rename ScopedComPtr::Release() to ScopedComPtr::Reset() (Closed)
Patch Set: Fix New Callers Created 3 years, 8 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
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/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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 hr = dev_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, 161 hr = dev_enum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory,
162 enum_moniker.Receive(), 0); 162 enum_moniker.Receive(), 0);
163 // CreateClassEnumerator returns S_FALSE on some Windows OS 163 // CreateClassEnumerator returns S_FALSE on some Windows OS
164 // when no camera exist. Therefore the FAILED macro can't be used. 164 // when no camera exist. Therefore the FAILED macro can't be used.
165 if (hr != S_OK) 165 if (hr != S_OK)
166 return; 166 return;
167 167
168 // Enumerate all video capture devices. 168 // Enumerate all video capture devices.
169 for (ScopedComPtr<IMoniker> moniker; 169 for (ScopedComPtr<IMoniker> moniker;
170 enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK; 170 enum_moniker->Next(1, moniker.Receive(), NULL) == S_OK;
171 moniker.Release()) { 171 moniker.Reset()) {
172 ScopedComPtr<IPropertyBag> prop_bag; 172 ScopedComPtr<IPropertyBag> prop_bag;
173 hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, prop_bag.ReceiveVoid()); 173 hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, prop_bag.ReceiveVoid());
174 if (FAILED(hr)) 174 if (FAILED(hr))
175 continue; 175 continue;
176 176
177 // Find the description or friendly name. 177 // Find the description or friendly name.
178 ScopedVariant name; 178 ScopedVariant name;
179 hr = prop_bag->Read(L"Description", name.Receive(), 0); 179 hr = prop_bag->Read(L"Description", name.Receive(), 0);
180 if (FAILED(hr)) 180 if (FAILED(hr))
181 hr = prop_bag->Read(L"FriendlyName", name.Receive(), 0); 181 hr = prop_bag->Read(L"FriendlyName", name.Receive(), 0);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 denominator ? static_cast<float>(numerator) / denominator : 0.0f; 373 denominator ? static_cast<float>(numerator) / denominator : 0.0f;
374 374
375 GUID type_guid; 375 GUID type_guid;
376 hr = type->GetGUID(MF_MT_SUBTYPE, &type_guid); 376 hr = type->GetGUID(MF_MT_SUBTYPE, &type_guid);
377 if (FAILED(hr)) { 377 if (FAILED(hr)) {
378 DLOG(ERROR) << "GetGUID failed: " << logging::SystemErrorCodeToString(hr); 378 DLOG(ERROR) << "GetGUID failed: " << logging::SystemErrorCodeToString(hr);
379 return; 379 return;
380 } 380 }
381 VideoCaptureDeviceMFWin::FormatFromGuid(type_guid, 381 VideoCaptureDeviceMFWin::FormatFromGuid(type_guid,
382 &capture_format.pixel_format); 382 &capture_format.pixel_format);
383 type.Release(); 383 type.Reset();
384 ++stream_index; 384 ++stream_index;
385 if (capture_format.pixel_format == PIXEL_FORMAT_UNKNOWN) 385 if (capture_format.pixel_format == PIXEL_FORMAT_UNKNOWN)
386 continue; 386 continue;
387 formats->push_back(capture_format); 387 formats->push_back(capture_format);
388 388
389 DVLOG(1) << descriptor.display_name << " " 389 DVLOG(1) << descriptor.display_name << " "
390 << VideoCaptureFormat::ToString(capture_format); 390 << VideoCaptureFormat::ToString(capture_format);
391 } 391 }
392 } 392 }
393 393
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 461
462 // static 462 // static
463 VideoCaptureDeviceFactory* 463 VideoCaptureDeviceFactory*
464 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( 464 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory(
465 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 465 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
466 return new VideoCaptureDeviceFactoryWin(); 466 return new VideoCaptureDeviceFactoryWin();
467 } 467 }
468 468
469 } // namespace media 469 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/win/pin_base_win.cc ('k') | media/capture/video/win/video_capture_device_mf_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698