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

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

Issue 1345993002: Change the functions in video_capture_device to pass around PowerLineFrequency enums instead of int… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 (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 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 capabilities_.emplace_back(stream_index, format, h->bmiHeader); 532 capabilities_.emplace_back(stream_index, format, h->bmiHeader);
533 } 533 }
534 } 534 }
535 535
536 return !capabilities_.empty(); 536 return !capabilities_.empty();
537 } 537 }
538 538
539 // Set the power line frequency removal in |capture_filter_| if available. 539 // Set the power line frequency removal in |capture_filter_| if available.
540 void VideoCaptureDeviceWin::SetAntiFlickerInCaptureFilter( 540 void VideoCaptureDeviceWin::SetAntiFlickerInCaptureFilter(
541 const VideoCaptureParams& params) { 541 const VideoCaptureParams& params) {
542 const int power_line_frequency = GetPowerLineFrequency(params); 542 const PowerLineFrequency power_line_frequency = GetPowerLineFrequency(params);
543 if (power_line_frequency != 543 if (power_line_frequency !=
544 static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ) && 544 media::PowerLineFrequency::FREQUENCY_50HZ &&
ajose 2015/09/17 19:33:32 Can these be one line? Do you have access to "git
mcasas 2015/09/21 15:30:06 Yeah, git cl format can be run by anyone all the t
545 power_line_frequency != 545 power_line_frequency !=
546 static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ)) { 546 media::PowerLineFrequency::FREQUENCY_60HZ) {
547 return; 547 return;
548 } 548 }
549 ScopedComPtr<IKsPropertySet> ks_propset; 549 ScopedComPtr<IKsPropertySet> ks_propset;
550 DWORD type_support = 0; 550 DWORD type_support = 0;
551 HRESULT hr; 551 HRESULT hr;
552 if (SUCCEEDED(hr = ks_propset.QueryFrom(capture_filter_.get())) && 552 if (SUCCEEDED(hr = ks_propset.QueryFrom(capture_filter_.get())) &&
553 SUCCEEDED(hr = ks_propset->QuerySupported( 553 SUCCEEDED(hr = ks_propset->QuerySupported(
554 PROPSETID_VIDCAP_VIDEOPROCAMP, 554 PROPSETID_VIDCAP_VIDEOPROCAMP,
555 KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY, 555 KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY,
556 &type_support)) && 556 &type_support)) &&
557 (type_support & KSPROPERTY_SUPPORT_SET)) { 557 (type_support & KSPROPERTY_SUPPORT_SET)) {
558 KSPROPERTY_VIDEOPROCAMP_S data = {}; 558 KSPROPERTY_VIDEOPROCAMP_S data = {};
559 data.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP; 559 data.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
560 data.Property.Id = KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY; 560 data.Property.Id = KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY;
561 data.Property.Flags = KSPROPERTY_TYPE_SET; 561 data.Property.Flags = KSPROPERTY_TYPE_SET;
562 data.Value = (power_line_frequency == 562 data.Value = (power_line_frequency ==
563 static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ)) 563 media::PowerLineFrequency::FREQUENCY_50HZ)
564 ? 1 564 ? 1
565 : 2; 565 : 2;
ajose 2015/09/17 19:33:32 These two can fit on line above?
566 data.Flags = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL; 566 data.Flags = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;
567 hr = ks_propset->Set(PROPSETID_VIDCAP_VIDEOPROCAMP, 567 hr = ks_propset->Set(PROPSETID_VIDCAP_VIDEOPROCAMP,
568 KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY, &data, 568 KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY, &data,
569 sizeof(data), &data, sizeof(data)); 569 sizeof(data), &data, sizeof(data));
570 DLOG_IF(ERROR, FAILED(hr)) << "Anti-flicker setting failed: " 570 DLOG_IF(ERROR, FAILED(hr)) << "Anti-flicker setting failed: "
571 << logging::SystemErrorCodeToString(hr); 571 << logging::SystemErrorCodeToString(hr);
572 DVLOG_IF(2, SUCCEEDED(hr)) << "Anti-flicker set correctly."; 572 DVLOG_IF(2, SUCCEEDED(hr)) << "Anti-flicker set correctly.";
573 } else { 573 } else {
574 DVLOG(2) << "Anti-flicker setting not supported."; 574 DVLOG(2) << "Anti-flicker setting not supported.";
575 } 575 }
576 } 576 }
577 577
578 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { 578 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) {
579 DCHECK(thread_checker_.CalledOnValidThread()); 579 DCHECK(thread_checker_.CalledOnValidThread());
580 state_ = kError; 580 state_ = kError;
581 client_->OnError(reason); 581 client_->OnError(reason);
582 } 582 }
583 } // namespace media 583 } // namespace media
OLDNEW
« media/capture/video/video_capture_device.cc ('K') | « media/capture/video/video_capture_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698