航煜视频水印根据时间是否设置改变

lowmem
XI.CHEN 2 months ago
parent 39b94cee90
commit 2d67c94bc9

@ -1653,6 +1653,9 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
// SetStaticIp(); // SetStaticIp();
std::this_thread::sleep_for(std::chrono::milliseconds(256)); std::this_thread::sleep_for(std::chrono::milliseconds(256));
std::string ip = GetIpStr(localPhotoInfo.ip);
VendorCtrl* vendorCtrl = MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle);
NET_PHOTO_INFO netPhotoInfo = { netHandle, 0 }; NET_PHOTO_INFO netPhotoInfo = { netHandle, 0 };
if (localPhotoInfo.vendor == 1) if (localPhotoInfo.vendor == 1)
{ {
@ -1664,6 +1667,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
{ {
// Hang Yu // Hang Yu
strcpy(netPhotoInfo.url, "/cgi-bin/snapshot.cgi"); strcpy(netPhotoInfo.url, "/cgi-bin/snapshot.cgi");
vendorCtrl->EnableOsd(false, localPhotoInfo.channel);
} }
else if (localPhotoInfo.vendor == 3) else if (localPhotoInfo.vendor == 3)
{ {
@ -1861,6 +1865,9 @@ bool CPhoneDevice::TakeVideoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
return false; return false;
} }
if(localPhotoInfo.vendor == 5)
vendorCtrl->SetOsd(localPhotoInfo.channel, osds[0].text, 0);
std::string streamingUrl = vendorCtrl->GetStreamingUrl(localPhotoInfo.cameraId); std::string streamingUrl = vendorCtrl->GetStreamingUrl(localPhotoInfo.cameraId);
if (streamingUrl.empty()) if (streamingUrl.empty())

@ -56,11 +56,22 @@ bool HangYuCtrl::SetOsd(uint8_t channel, std::string osdstring, uint8_t pos)
{ {
// /LAPI/V1.0/Channels/<ID>/Media/OSDs/Contents // /LAPI/V1.0/Channels/<ID>/Media/OSDs/Contents
//左上OSD //左上OSD
bool hasDateTime = (osdstring.find("$$DATETIME$$") != std::string::npos);
size_t posi = osdstring.find("$$DATETIME$$");
if (posi != std::string::npos) {
size_t endPos = posi + 12;
while (endPos < osdstring.size() && osdstring[endPos] == ' ') {
endPos++;
}
osdstring.erase(posi, endPos - posi);
}
char url[128] = { 0 }; char url[128] = { 0 };
snprintf(url, sizeof(url), "http://%s/Pictures/%u/MultiOSDV2", m_ip.c_str(), (uint32_t)channel); snprintf(url, sizeof(url), "http://%s/Pictures/%u/MultiOSDV2", m_ip.c_str(), (uint32_t)channel);
std::vector<uint8_t> resData; std::vector<uint8_t> resData;
std::replace(osdstring.begin(), osdstring.end(), '\n', '^'); std::replace(osdstring.begin(), osdstring.end(), '\n', '^');
string xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><MultiLineOSD><DisplayTime><Enable>true</Enable><PosX>8</PosX><PosY>0</PosY></DisplayTime><OSD><ID>1</ID><Enable>true</Enable><Text>"+ osdstring+ "</Text><x>8</x><y>24</y></MultiLineOSD>"; string xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><MultiLineOSD><DisplayTime><Enable>" + string(hasDateTime ? "true" : "false") + "</Enable><PosX>8</PosX><PosY>0</PosY></DisplayTime><OSD><ID>1</ID><Enable>true</Enable><Text>"+ osdstring+ "</Text><x>8</x><y>" + string(hasDateTime ? "24" : "0") + "</y></MultiLineOSD>";
int res = DoPutRequest(url, HTTP_AUTH_TYPE_BASIC, m_userName.c_str(), m_password.c_str(), m_netHandle, xmlString.c_str(), resData); int res = DoPutRequest(url, HTTP_AUTH_TYPE_BASIC, m_userName.c_str(), m_password.c_str(), m_netHandle, xmlString.c_str(), resData);
return res; return res;
} }

Loading…
Cancel
Save