|
|
@@ -13,15 +13,11 @@
|
|
|
#include <unistd.h>
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
-
|
|
|
#include <memutil.h>
|
|
|
#include <md5.h>
|
|
|
#include "y2k_time.h"
|
|
|
#include "Event.h"
|
|
|
|
|
|
-#include <map>
|
|
|
-#include "CommEntityUtil.hpp"
|
|
|
-
|
|
|
using namespace MediaController;
|
|
|
|
|
|
#ifndef av_always_inline
|
|
|
@@ -1890,6 +1886,7 @@ namespace MediaController {
|
|
|
int icamnum = 0;
|
|
|
CSimpleStringA strCamInfoJson("");
|
|
|
CSimpleStringA strCamListInfoJson("");
|
|
|
+ Json::Value rootReq;
|
|
|
#ifdef RVC_OS_WIN
|
|
|
HRESULT hr = CoInitialize(NULL);
|
|
|
int rc;
|
|
|
@@ -1939,10 +1936,11 @@ namespace MediaController {
|
|
|
videocap_get_device_instanceid(i, tmp2, ARRAYSIZE(tmp2));
|
|
|
WideCharToMultiByte(CP_ACP, 0, tmp2, -1, t2, sizeof(t2), 0, NULL);
|
|
|
|
|
|
- std::map<std::string, std::string> msgInfo;
|
|
|
- msgInfo["DevicePath"] = t1;
|
|
|
- msgInfo["DeviceInstanceId"] = t2;
|
|
|
- msgInfo["FriendlyName"] = t;
|
|
|
+ Json::Value item;
|
|
|
+ item["DevicePath"] = t1;
|
|
|
+ item["DeviceInstanceId"] = t2;
|
|
|
+ item["FriendlyName"] = t;
|
|
|
+ rootReq["CameraDevInfo"].append(item);
|
|
|
|
|
|
{
|
|
|
unsigned char x[MD5_DIGESTSIZE] = {0};
|
|
|
@@ -1953,11 +1951,6 @@ namespace MediaController {
|
|
|
}
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d = %s;%s", i, t, t1);
|
|
|
strCamInfoJson += CSimpleStringA::Format("\"%d\":\"%s;%s\",", i, t, t1);
|
|
|
-
|
|
|
- std::pair<bool, std::string> strResult;
|
|
|
- strResult = generateJsonStr(msgInfo);
|
|
|
- strCamListInfoJson += strResult.second.c_str();
|
|
|
- strCamListInfoJson += ",";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1992,12 +1985,19 @@ namespace MediaController {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d = %s", inumber, strcamera);
|
|
|
strCamInfoJson += CSimpleStringA::Format("\"%d\":\"%s\",", inumber, strcamera);
|
|
|
inumber++;
|
|
|
- strCamListInfoJson += capture_get_video_device_json_infos(i);
|
|
|
- strCamListInfoJson += ",";
|
|
|
+
|
|
|
+ rvc_camera_info_t pcamerainfo;
|
|
|
+ memset(&pcamerainfo, 0, sizeof(rvc_camera_info_t));
|
|
|
+ if (0 == rvc_videocap_get_camera_infos(i, &pcamerainfo)) {
|
|
|
+ Json::Value item;
|
|
|
+ item["driver"] = pcamerainfo.strdriver;
|
|
|
+ item["card"] = pcamerainfo.strcard;
|
|
|
+ item["bus_info"] = pcamerainfo.strbus_info;
|
|
|
+ rootReq["CameraDevInfo"].append(item);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
if (icamnum > 0) {
|
|
|
@@ -2007,15 +2007,14 @@ namespace MediaController {
|
|
|
strCamInfoJson[strCamInfoJson.GetLength() - 1] = '\0';
|
|
|
}
|
|
|
LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_GETCAMERA_INFOS, CSimpleStringA::Format("[{%s}]", strCamInfoJson.GetData()).GetData());
|
|
|
-
|
|
|
- if (strCamListInfoJson.GetLength() > 0) {
|
|
|
- strCamListInfoJson[strCamListInfoJson.GetLength() - 1] = '\0';
|
|
|
- }
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR0402208V1").setAPI("RvcMedia_GetCameraDevInfo")(CSimpleStringA::Format("{%s}", strCamListInfoJson.GetData()).GetData());
|
|
|
}
|
|
|
|
|
|
*ivideonum = icamnum;
|
|
|
|
|
|
+ Json::StyledWriter sw;
|
|
|
+ strCamListInfoJson = sw.write(rootReq).c_str();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setLogCode("QLR0402208V1").setAPI("RvcMedia_GetCameraDevInfo")(CSimpleStringA::Format("%s", strCamListInfoJson.GetData()).GetData());
|
|
|
+
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
@@ -2363,29 +2362,4 @@ namespace MediaController {
|
|
|
#endif
|
|
|
return icount;
|
|
|
}
|
|
|
-
|
|
|
- CSimpleStringA capture_get_video_device_json_infos(int ideviceid)
|
|
|
- {
|
|
|
- CSimpleStringA strCameraJsonInfo("");
|
|
|
-#ifdef RVC_OS_WIN
|
|
|
-
|
|
|
-#else
|
|
|
- rvc_camera_info_t pcamerainfo;
|
|
|
- memset(&pcamerainfo, 0, sizeof(rvc_camera_info_t));
|
|
|
- if (0 == rvc_videocap_get_camera_infos(ideviceid, &pcamerainfo)) {
|
|
|
- std::map<std::string, std::string> msgInfo;
|
|
|
- msgInfo["driver"] = pcamerainfo.strdriver;
|
|
|
- msgInfo["card"] = pcamerainfo.strcard;
|
|
|
- msgInfo["bus_info"] = pcamerainfo.strbus_info;
|
|
|
-
|
|
|
- std::pair<bool, std::string> strResult;
|
|
|
- strResult = generateJsonStr(msgInfo);
|
|
|
- if (strResult.first) {
|
|
|
- strCameraJsonInfo += strResult.second.c_str();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-#endif // RVC_OS_WIN
|
|
|
- return strCameraJsonInfo;
|
|
|
- }
|
|
|
}
|