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

Unified Diff: media/video/capture/win/video_capture_device_win.cc

Issue 220193006: Win DirectShow: connect antibanding/anti-flicker where supported. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/video/capture/win/video_capture_device_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/win/video_capture_device_win.cc
diff --git a/media/video/capture/win/video_capture_device_win.cc b/media/video/capture/win/video_capture_device_win.cc
index 2afb96860177ea648017597a2ce05ee34c0a5316..7aef158577c553cc89551d079f96db35414e6a54 100644
--- a/media/video/capture/win/video_capture_device_win.cc
+++ b/media/video/capture/win/video_capture_device_win.cc
@@ -4,6 +4,9 @@
#include "media/video/capture/win/video_capture_device_win.h"
+#include <ks.h>
+#include <ksmedia.h>
+
#include <algorithm>
#include <list>
@@ -591,6 +594,31 @@ void VideoCaptureDeviceWin::AllocateAndStart(
}
}
+ const int power_line_frequency = GetPowerLineFrequencyForLocation();
tommi (sloooow) - chröme 2014/04/08 10:16:19 This function is getting long. Can you extract thi
mcasas 2014/04/08 10:33:31 Done.
+ if ((power_line_frequency == kPowerLine50Hz) ||
tommi (sloooow) - chröme 2014/04/08 10:16:19 nit: remove superfluous parenthesis
mcasas 2014/04/08 10:33:31 Done.
+ (power_line_frequency == kPowerLine60Hz)) {
+ ScopedComPtr<IKsPropertySet> ks_propset;
+ hr = ks_propset.QueryFrom(capture_filter_);
tommi (sloooow) - chröme 2014/04/08 10:16:19 handle this return value? You could do something
mcasas 2014/04/08 10:33:31 Done.
+ DWORD type_support = 0;
+ hr = ks_propset->QuerySupported(PROPSETID_VIDCAP_VIDEOPROCAMP,
+ KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY,
+ &type_support);
+ DVLOG_IF(1, FAILED(hr)) << "Anti-flicker setting not supported.";
+ if (SUCCEEDED(hr) && (type_support & KSPROPERTY_SUPPORT_SET)) {
+ KSPROPERTY_VIDEOPROCAMP_S data = {};
+ data.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
+ data.Property.Id = KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY;
+ data.Property.Flags = KSPROPERTY_TYPE_SET;
+ data.Value = (power_line_frequency == kPowerLine50Hz) ? 1 : 2;
+ data.Flags = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;
+ hr = ks_propset->Set(PROPSETID_VIDCAP_VIDEOPROCAMP,
+ KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY,
+ &data, sizeof(data), &data, sizeof(data));
+ DVLOG_IF(2, FAILED(hr)) << "Anti-flicker setting failed.";
+ DVLOG_IF(2, SUCCEEDED(hr)) << "Anti-flicker setting correctly done.";
+ }
+ }
+
if (format.pixel_format == PIXEL_FORMAT_MJPEG && mjpg_filter_.get()) {
// Connect the camera to the MJPEG decoder.
hr = graph_builder_->ConnectDirect(output_capture_pin_, input_mjpg_pin_,
« no previous file with comments | « media/video/capture/win/video_capture_device_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698