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

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

Issue 2885063003: Remove ScopedComPtr::QueryFrom() (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « chrome/utility/importer/ie_importer_win.cc ('k') | media/gpu/dxva_picture_buffer_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_win.h" 5 #include "media/capture/video/win/video_capture_device_win.h"
6 6
7 #include <ks.h> 7 #include <ks.h>
8 #include <ksmedia.h> 8 #include <ksmedia.h>
9 #include <objbase.h> 9 #include <objbase.h>
10 #include <vidcap.h> 10 #include <vidcap.h>
(...skipping 24 matching lines...) Expand all
35 #else 35 #else
36 #define DLOG_IF_FAILED_WITH_HRESULT(message, hr) \ 36 #define DLOG_IF_FAILED_WITH_HRESULT(message, hr) \
37 {} 37 {}
38 #endif 38 #endif
39 39
40 // Check if a Pin matches a category. 40 // Check if a Pin matches a category.
41 bool PinMatchesCategory(IPin* pin, REFGUID category) { 41 bool PinMatchesCategory(IPin* pin, REFGUID category) {
42 DCHECK(pin); 42 DCHECK(pin);
43 bool found = false; 43 bool found = false;
44 ScopedComPtr<IKsPropertySet> ks_property; 44 ScopedComPtr<IKsPropertySet> ks_property;
45 HRESULT hr = ks_property.QueryFrom(pin); 45 HRESULT hr = pin->QueryInterface(IID_PPV_ARGS(&ks_property));
46 if (SUCCEEDED(hr)) { 46 if (SUCCEEDED(hr)) {
47 GUID pin_category; 47 GUID pin_category;
48 DWORD return_value; 48 DWORD return_value;
49 hr = ks_property->Get(AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, 0, 49 hr = ks_property->Get(AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, 0,
50 &pin_category, sizeof(pin_category), &return_value); 50 &pin_category, sizeof(pin_category), &return_value);
51 if (SUCCEEDED(hr) && (return_value == sizeof(pin_category))) { 51 if (SUCCEEDED(hr) && (return_value == sizeof(pin_category))) {
52 found = (pin_category == category); 52 found = (pin_category == category);
53 } 53 }
54 } 54 }
55 return found; 55 return found;
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 void VideoCaptureDeviceWin::SetAntiFlickerInCaptureFilter( 727 void VideoCaptureDeviceWin::SetAntiFlickerInCaptureFilter(
728 const VideoCaptureParams& params) { 728 const VideoCaptureParams& params) {
729 const PowerLineFrequency power_line_frequency = GetPowerLineFrequency(params); 729 const PowerLineFrequency power_line_frequency = GetPowerLineFrequency(params);
730 if (power_line_frequency != media::PowerLineFrequency::FREQUENCY_50HZ && 730 if (power_line_frequency != media::PowerLineFrequency::FREQUENCY_50HZ &&
731 power_line_frequency != media::PowerLineFrequency::FREQUENCY_60HZ) { 731 power_line_frequency != media::PowerLineFrequency::FREQUENCY_60HZ) {
732 return; 732 return;
733 } 733 }
734 ScopedComPtr<IKsPropertySet> ks_propset; 734 ScopedComPtr<IKsPropertySet> ks_propset;
735 DWORD type_support = 0; 735 DWORD type_support = 0;
736 HRESULT hr; 736 HRESULT hr;
737 if (SUCCEEDED(hr = ks_propset.QueryFrom(capture_filter_.Get())) && 737 if (SUCCEEDED(hr = capture_filter_.CopyTo(ks_propset.GetAddressOf())) &&
738 SUCCEEDED(hr = ks_propset->QuerySupported( 738 SUCCEEDED(hr = ks_propset->QuerySupported(
739 PROPSETID_VIDCAP_VIDEOPROCAMP, 739 PROPSETID_VIDCAP_VIDEOPROCAMP,
740 KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY, 740 KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY,
741 &type_support)) && 741 &type_support)) &&
742 (type_support & KSPROPERTY_SUPPORT_SET)) { 742 (type_support & KSPROPERTY_SUPPORT_SET)) {
743 KSPROPERTY_VIDEOPROCAMP_S data = {}; 743 KSPROPERTY_VIDEOPROCAMP_S data = {};
744 data.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP; 744 data.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
745 data.Property.Id = KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY; 745 data.Property.Id = KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY;
746 data.Property.Flags = KSPROPERTY_TYPE_SET; 746 data.Property.Flags = KSPROPERTY_TYPE_SET;
747 data.Value = 747 data.Value =
(...skipping 10 matching lines...) Expand all
758 void VideoCaptureDeviceWin::SetErrorState( 758 void VideoCaptureDeviceWin::SetErrorState(
759 const tracked_objects::Location& from_here, 759 const tracked_objects::Location& from_here,
760 const std::string& reason, 760 const std::string& reason,
761 HRESULT hr) { 761 HRESULT hr) {
762 DCHECK(thread_checker_.CalledOnValidThread()); 762 DCHECK(thread_checker_.CalledOnValidThread());
763 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); 763 DLOG_IF_FAILED_WITH_HRESULT(reason, hr);
764 state_ = kError; 764 state_ = kError;
765 client_->OnError(from_here, reason); 765 client_->OnError(from_here, reason);
766 } 766 }
767 } // namespace media 767 } // namespace media
OLDNEW
« no previous file with comments | « chrome/utility/importer/ie_importer_win.cc ('k') | media/gpu/dxva_picture_buffer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698