From a87d12eb9e01e98bb5c0769dca8980838209aece Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Mon, 6 Jun 2011 19:23:43 +0000 Subject: [PATCH] added CV_CAP_PROP_PVAPI_MULTICASTIP property (thanks to Stefano Fabri for the patch) --- .../include/opencv2/highgui/highgui_c.h | 3 ++- modules/highgui/src/cap_pvapi.cpp | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h index 21c8a21fa7..8ef4680ea3 100644 --- a/modules/highgui/include/opencv2/highgui/highgui_c.h +++ b/modules/highgui/include/opencv2/highgui/highgui_c.h @@ -365,7 +365,8 @@ enum CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH = CV_CAP_OPENNI_DEPTH_GENERATOR + CV_CAP_PROP_OPENNI_FOCAL_LENGTH, // Properties of cameras available through GStreamer interface - CV_CAP_GSTREAMER_QUEUE_LENGTH = 200 // default is 1 + CV_CAP_GSTREAMER_QUEUE_LENGTH = 200, // default is 1 + CV_CAP_PROP_PVAPI_MULTICASTIP = 300 // ip for anable multicast master mode. 0 for disable multicast }; enum diff --git a/modules/highgui/src/cap_pvapi.cpp b/modules/highgui/src/cap_pvapi.cpp index f313ac9f54..7e4bf560a8 100644 --- a/modules/highgui/src/cap_pvapi.cpp +++ b/modules/highgui/src/cap_pvapi.cpp @@ -307,11 +307,28 @@ bool CvCaptureCAM_PvAPI::setProperty( int property_id, double value ) else monocrome=false; break; - case CV_CAP_PROP_EXPOSURE: - if (PvAttrUint32Set(Camera.Handle,"ExposureValue",(tPvUint32)value)==ePvErrSuccess) - break; + case CV_CAP_PROP_EXPOSURE: + if ((PvAttrUint32Set(Camera.Handle,"ExposureValue",(tPvUint32)value)==ePvErrSuccess)) + break; + else + return false; + case CV_CAP_PROP_PVAPI_MULTICASTIP: + + if (value==-1) { + if ((PvAttrEnumSet(Camera.Handle,"MulticastEnable", "Off")==ePvErrSuccess)) + break; + else + return false; + } + else { + string ip=cv::format("%d.%d.%d.%d", (value>>24)&255, (value>>16)&255, (value>>8)&255, value&255); + if ((PvAttrEnumSet(Camera.Handle,"MulticastEnable", "On")==ePvErrSuccess) && + (PvAttrStringSet(priv->handle, "MulticastIPAddress", ip.c_str())==ePvErrSuccess)) { + break; else - return false; + return false; + } + } default: return false; }