From 2d6253609cf967f5c24f61ceac7bf06210dab09c Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 31 Jan 2013 02:12:54 +0400 Subject: [PATCH] Fix truncation of fourcc value in dshow capture property setter (bug #2535) Added test checking that all valid fourcc values are converted properly --- modules/highgui/src/cap_dshow.cpp | 8 +- modules/highgui/test/test_fourcc.cpp | 115 +++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 modules/highgui/test/test_fourcc.cpp diff --git a/modules/highgui/src/cap_dshow.cpp b/modules/highgui/src/cap_dshow.cpp index d197b015a5..b1b142c79b 100644 --- a/modules/highgui/src/cap_dshow.cpp +++ b/modules/highgui/src/cap_dshow.cpp @@ -1203,7 +1203,7 @@ bool videoInput::setupDevice(int deviceNumber, int w, int h){ bool videoInput::setupDeviceFourcc(int deviceNumber, int w, int h,int fourcc){ if(deviceNumber >= VI_MAX_CAMERAS || VDList[deviceNumber]->readyToCapture) return false; - if ( fourcc > 0 ) { + if ( fourcc != -1 ) { GUID *mediaType = getMediaSubtypeFromFourcc(fourcc); if ( mediaType ) { setAttemptCaptureSize(deviceNumber,w,h,*mediaType); @@ -2193,7 +2193,7 @@ int videoInput::getFourccFromMediaSubtype(GUID type) { GUID *videoInput::getMediaSubtypeFromFourcc(int fourcc){ for (int i=0;i