Browse Source

Z991239-5647 #comment 优化摄像头亮度调节功能

80274480 1 year ago
parent
commit
b30bcc3edf

+ 1 - 1
Module/mod_mediacontroller/capture.cpp

@@ -2090,7 +2090,7 @@ namespace MediaController {
 #endif // RVC_OS_WIN
 	}
 
-	int capture_get_brightness(capture_t *cap,ErrorCodeEnum nCode)
+	int capture_get_brightness(capture_t *cap, ErrorCodeEnum nCode)
 	{
 #ifdef RVC_OS_WIN
 		int nValue1 = 0;

+ 1 - 0
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -892,6 +892,7 @@ void CMediaControllerEntity::SendCameraBright()
 		buf & nValue;
 		Info.data = buf.ToBlob();
 		m_pMediaControllerChannel->Send(Info);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("send cur camera bright value is %d.", nValue);
 	}
 	else
 	{

+ 10 - 10
Other/unix/libvideocapture/linux/videocapture_linux.cpp

@@ -1000,16 +1000,16 @@ int VideoCaptureImpl::SetCamAutoBrightness()
 {
 	int iret = -1;
 
-	//struct v4l2_control ctrl;
-	//ctrl.id = V4L2_CID_BRIGHTNESS;
-	//ctrl.value = m_idefaultbrightness;
-	//if (ioctl(m_deviceFd, VIDIOC_S_CTRL, &ctrl) == -1) {
-	//	m_callback->Debug("VIDIOC_S_CTRL set V4L2_CID_AUTOBRIGHTNESS error for %s", strerror(errno));
-	//}
-	//else {
-	//	//m_callback->Debug("VIDIOC_S_CTRL set V4L2_CID_AUTOBRIGHTNESS success.");
-	//	iret = 0;
-	//}
+	struct v4l2_control ctrl;
+	ctrl.id = V4L2_CID_BRIGHTNESS;
+	ctrl.value = m_idefaultbrightness;
+	if (ioctl(m_deviceFd, VIDIOC_S_CTRL, &ctrl) == -1) {
+		CapLog("VIDIOC_S_CTRL set V4L2_CID_AUTOBRIGHTNESS error for %s", strerror(errno));
+	}
+	else {
+		CapLog("VIDIOC_S_CTRL set V4L2_CID_AUTOBRIGHTNESS success.");
+		iret = 0;
+	}
 	iret = 0;
 
 	return iret;