From 11feada56715a387603687c29cb1345ecf42f488 Mon Sep 17 00:00:00 2001 From: Stefano Fabri Date: Thu, 9 Jun 2011 07:54:10 +0000 Subject: [PATCH] Some warning fix. Initial multicast get property support --- modules/highgui/src/cap_pvapi.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/modules/highgui/src/cap_pvapi.cpp b/modules/highgui/src/cap_pvapi.cpp index 2663cd8..31518f8 100644 --- a/modules/highgui/src/cap_pvapi.cpp +++ b/modules/highgui/src/cap_pvapi.cpp @@ -191,7 +191,7 @@ bool CvCaptureCAM_PvAPI::open( int index ) //PvAttrUint32Get(Camera.Handle,"PacketSize",&maxSize); if (PvCaptureAdjustPacketSize(Camera.Handle,maxSize)!=ePvErrSuccess) return false; - if (strncmp(pixelFormat, "Mono8",NULL)==0) { + if (strcmp(pixelFormat, "Mono8")==0) { grayframe = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_8U, 1); grayframe->widthStep = (int)frameWidth; frame = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_8U, 3); @@ -199,7 +199,7 @@ bool CvCaptureCAM_PvAPI::open( int index ) Camera.Frame.ImageBufferSize = frameSize; Camera.Frame.ImageBuffer = grayframe->imageData; } - else if (strncmp(pixelFormat, "Mono16",NULL)==0) { + else if (strcmp(pixelFormat, "Mono16")==0) { grayframe = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_16U, 1); grayframe->widthStep = (int)frameWidth; frame = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_16U, 3); @@ -207,7 +207,7 @@ bool CvCaptureCAM_PvAPI::open( int index ) Camera.Frame.ImageBufferSize = frameSize; Camera.Frame.ImageBuffer = grayframe->imageData; } - else if (strncmp(pixelFormat, "Bgr24",NULL)==0) { + else if (strcmp(pixelFormat, "Bgr24")==0) { frame = cvCreateImage(cvSize((int)frameWidth, (int)frameHeight), IPL_DEPTH_8U, 3); frame->widthStep = (int)frameWidth*3; Camera.Frame.ImageBufferSize = frameSize; @@ -283,6 +283,20 @@ double CvCaptureCAM_PvAPI::getProperty( int property_id ) tPvFloat32 nfTemp; PvAttrFloat32Get(Camera.Handle, "StatFrameRate", &nfTemp); return (double)nfTemp; + case CV_CAP_PROP_PVAPI_MULTICASTIP: + char mEnable[2]; + char mIp[11]; + PvAttrEnumGet(Camera.Handle,"MulticastEnable",mEnable,sizeof(mEnable),NULL); + if (strcmp(mEnable, "Off") == 0) { + return -1; + } + else { + long int ip; + int a,b,c,d; + PvAttrStringGet(Camera.Handle, "MulticastIPAddress",mIp,sizeof(mIp),NULL); + sscanf(mIp, "%d.%d.%d.%d", &a, &b, &c, &d); ip = ((a*256 + b)*256 + c)*256 + d; + return (double)ip; + } } return -1.0; } @@ -303,7 +317,7 @@ bool CvCaptureCAM_PvAPI::setProperty( int property_id, double value ) if (value==1) { char pixelFormat[256]; PvAttrEnumGet(Camera.Handle, "PixelFormat", pixelFormat,256,NULL); - if ((strncmp(pixelFormat, "Mono8",NULL)==0) || strncmp(pixelFormat, "Mono16",NULL)==0) { + if ((strcmp(pixelFormat, "Mono8")==0) || strcmp(pixelFormat, "Mono16")==0) { monocrome=true; } else -- 2.7.4