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

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

Issue 558503003: Windows video capture: Remove duplicated code from GetDeviceSupportedFormats* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactor Created 6 years, 2 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/video/capture/win/video_capture_device_win.h" 5 #include "media/video/capture/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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 ? (kSecondsToReferenceTime / static_cast<float>(time_per_frame)) 547 ? (kSecondsToReferenceTime / static_cast<float>(time_per_frame))
548 : 0.0; 548 : 0.0;
549 549
550 capabilities_.emplace_back(stream_index, format); 550 capabilities_.emplace_back(stream_index, format);
551 } 551 }
552 } 552 }
553 553
554 return !capabilities_.empty(); 554 return !capabilities_.empty();
555 } 555 }
556 556
557 void VideoCaptureDeviceWin::GetDeviceSupportedFormats(
558 VideoCaptureFormats* formats) {
559 DCHECK(formats);
560 for (const CapabilityWin& capability : capabilities_)
561 formats->push_back(capability.supported_format);
562 }
563
557 // Set the power line frequency removal in |capture_filter_| if available. 564 // Set the power line frequency removal in |capture_filter_| if available.
558 void VideoCaptureDeviceWin::SetAntiFlickerInCaptureFilter() { 565 void VideoCaptureDeviceWin::SetAntiFlickerInCaptureFilter() {
559 const int power_line_frequency = GetPowerLineFrequencyForLocation(); 566 const int power_line_frequency = GetPowerLineFrequencyForLocation();
560 if (power_line_frequency != kPowerLine50Hz && 567 if (power_line_frequency != kPowerLine50Hz &&
561 power_line_frequency != kPowerLine60Hz) { 568 power_line_frequency != kPowerLine60Hz) {
562 return; 569 return;
563 } 570 }
564 ScopedComPtr<IKsPropertySet> ks_propset; 571 ScopedComPtr<IKsPropertySet> ks_propset;
565 DWORD type_support = 0; 572 DWORD type_support = 0;
566 HRESULT hr; 573 HRESULT hr;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return E_FAIL; 647 return E_FAIL;
641 return S_OK; 648 return S_OK;
642 } 649 }
643 650
644 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) { 651 void VideoCaptureDeviceWin::SetErrorState(const std::string& reason) {
645 DCHECK(CalledOnValidThread()); 652 DCHECK(CalledOnValidThread());
646 state_ = kError; 653 state_ = kError;
647 client_->OnError(reason); 654 client_->OnError(reason);
648 } 655 }
649 } // namespace media 656 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698