航煜OSD和分辨率设置

lowmem
XI.CHEN 2 months ago
parent b5a188a5b4
commit ec6a27df28

@ -1667,7 +1667,6 @@ 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)
{ {
@ -1684,6 +1683,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
// http://192.168.1.101/Snapshot/1/2/RemoteImageCaptureV2?ImageFormat=jpg // http://192.168.1.101/Snapshot/1/2/RemoteImageCaptureV2?ImageFormat=jpg
// http://192.168.1.101/Snapshot/1/1/RemoteImageCaptureV2?ImageFormat=jpg // http://192.168.1.101/Snapshot/1/1/RemoteImageCaptureV2?ImageFormat=jpg
snprintf(netPhotoInfo.url, sizeof(netPhotoInfo.url), "/Snapshot/%u/1/RemoteImageCaptureV2?ImageFormat=jpg", (uint32_t)localPhotoInfo.cameraId); snprintf(netPhotoInfo.url, sizeof(netPhotoInfo.url), "/Snapshot/%u/1/RemoteImageCaptureV2?ImageFormat=jpg", (uint32_t)localPhotoInfo.cameraId);
vendorCtrl->EnableOsd(false, localPhotoInfo.cameraId);
} }
else else
{ {
@ -1866,7 +1866,11 @@ bool CPhoneDevice::TakeVideoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
} }
if(localPhotoInfo.vendor == 5) if(localPhotoInfo.vendor == 5)
vendorCtrl->SetOsd(localPhotoInfo.channel, osds[0].text, 0); {
vendorCtrl->SetOsd(localPhotoInfo.cameraId, osds[0].text, 0);
vendorCtrl->SetResolution(localPhotoInfo.cameraId, 1, localPhotoInfo.width, localPhotoInfo.height);
}
std::string streamingUrl = vendorCtrl->GetStreamingUrl(localPhotoInfo.cameraId); std::string streamingUrl = vendorCtrl->GetStreamingUrl(localPhotoInfo.cameraId);

@ -17,7 +17,7 @@ bool HangYuCtrl::SetResolution(uint8_t channel, uint8_t streamID, uint32_t resX,
{ {
//流类型范围1-4,1为主流 //流类型范围1-4,1为主流
char url[128] = { 0 }; char url[128] = { 0 };
snprintf(url, sizeof(url), "http://%s/Streams/%u/%u", m_ip.c_str(), (uint32_t)channel, (uint32_t)streamID); snprintf(url, sizeof(url), "http://%s/Streams/%u/1", m_ip.c_str(), (uint32_t)channel);
std::vector<uint8_t> resData; std::vector<uint8_t> resData;
@ -61,7 +61,7 @@ bool HangYuCtrl::SetOsd(uint8_t channel, std::string osdstring, uint8_t pos)
size_t posi = osdstring.find("$$DATETIME$$"); size_t posi = osdstring.find("$$DATETIME$$");
if (posi != std::string::npos) { if (posi != std::string::npos) {
size_t endPos = posi + 12; size_t endPos = posi + 12;
while (endPos < osdstring.size() && osdstring[endPos] == ' ') { while (endPos < osdstring.size() && (osdstring[endPos] == ' ' || osdstring[endPos] == '\n')) {
endPos++; endPos++;
} }
osdstring.erase(posi, endPos - posi); osdstring.erase(posi, endPos - posi);

@ -20,9 +20,8 @@ public:
virtual bool TakePhoto(std::vector<uint8_t>& img); virtual bool TakePhoto(std::vector<uint8_t>& img);
virtual bool TakeVideo(uint32_t duration, std::string path); virtual bool TakeVideo(uint32_t duration, std::string path);
virtual bool HasAuthOnStreaming() const { return true; } virtual bool HasAuthOnStreaming() const { return true; }
virtual bool SetResolution(uint8_t channel, uint8_t streamID, uint32_t resX, uint32_t resY);
private:
bool SetResolution(uint8_t channel, uint8_t streamID, uint32_t resX, uint32_t resY);
}; };

@ -26,6 +26,7 @@ public:
virtual bool TakePhoto(std::vector<uint8_t>& img) = 0; virtual bool TakePhoto(std::vector<uint8_t>& img) = 0;
virtual bool TakeVideo(uint32_t duration, std::string path) = 0; virtual bool TakeVideo(uint32_t duration, std::string path) = 0;
virtual bool HasAuthOnStreaming() const { return false; } virtual bool HasAuthOnStreaming() const { return false; }
virtual bool SetResolution(uint8_t channel, uint8_t streamID, uint32_t resX, uint32_t resY) = 0;
protected: protected:

@ -13,6 +13,11 @@ YuShiCtrl::~YuShiCtrl()
} }
bool YuShiCtrl::SetResolution(uint8_t channel, uint8_t streamID, uint32_t resX, uint32_t resY)
{
return false;
}
bool YuShiCtrl::SetOsd(uint8_t channel, std::string osd, uint8_t pos) bool YuShiCtrl::SetOsd(uint8_t channel, std::string osd, uint8_t pos)
{ {
// /LAPI/V1.0/Channels/<ID>/Media/OSDs/Contents // /LAPI/V1.0/Channels/<ID>/Media/OSDs/Contents

@ -19,6 +19,7 @@ public:
virtual bool UpdateTime(time_t ts); virtual bool UpdateTime(time_t ts);
virtual bool TakePhoto(std::vector<uint8_t>& img); virtual bool TakePhoto(std::vector<uint8_t>& img);
virtual bool TakeVideo(uint32_t duration, std::string path); virtual bool TakeVideo(uint32_t duration, std::string path);
virtual bool SetResolution(uint8_t channel, uint8_t streamID, uint32_t resX, uint32_t resY);
private: private:
void OSDJson(int id, bool enabled, std::string osdString, int x, int y, bool timeOn, std::string& jsonString); void OSDJson(int id, bool enabled, std::string osdString, int x, int y, bool timeOn, std::string& jsonString);

Loading…
Cancel
Save