优化网络摄像头供应商的实现

移除航煜对时的实现
lowmem
Matthew 2 months ago
parent 138040baa8
commit b9fe6ce048

@ -32,6 +32,7 @@
#include <media/NdkImage.h>
#include <mat.h>
#include <string.h>
#include <memory>
#ifdef USING_HDRPLUS
#include <hdrplus/hdrplus_pipeline.h>
@ -1661,7 +1662,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
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);
std::unique_ptr<VendorCtrl> vendorCtrl(MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle, false));
NET_PHOTO_INFO netPhotoInfo = { netHandle, 0 };
if (localPhotoInfo.vendor == 1)
@ -1866,8 +1867,8 @@ bool CPhoneDevice::TakeVideoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
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);
if (vendorCtrl == NULL)
std::unique_ptr<VendorCtrl> vendorCtrl(MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle, false));
if (!vendorCtrl)
{
XYLOG(XYLOG_SEVERITY_ERROR, "Vendor(%u) not Supported CH=%u PR=%X PHOTOID=%u", (uint32_t)localPhotoInfo.vendor, (uint32_t)localPhotoInfo.channel, (unsigned int)localPhotoInfo.preset, localPhotoInfo.photoId);
TakePhotoCb(0, localPhotoInfo, "", 0);
@ -1999,7 +2000,7 @@ bool CPhoneDevice::StartPushStreaming(IDevice::PHOTO_INFO& photoInfo, const std:
}
std::string ip = GetIpStr(photoInfo.ip);
VendorCtrl* vendorCtrl = MakeVendorCtrl(photoInfo.vendor, photoInfo.channel, ip, photoInfo.userName, photoInfo.password, netHandle);
VendorCtrl* vendorCtrl = MakeVendorCtrl(photoInfo.vendor, photoInfo.channel, ip, photoInfo.userName, photoInfo.password, netHandle, true);
if (vendorCtrl == NULL)
{
XYLOG(XYLOG_SEVERITY_ERROR, "Vendor(%u) not Supported CH=%u PR=%X PHOTOID=%u", (uint32_t)photoInfo.vendor, (uint32_t)photoInfo.channel, (unsigned int)photoInfo.preset, photoInfo.photoId);
@ -5186,7 +5187,7 @@ void CPhoneDevice::SetStaticIp()
}
}
VendorCtrl* CPhoneDevice::MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle)
VendorCtrl* CPhoneDevice::MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle, bool syncTime)
{
VendorCtrl* vendorCtrl = NULL;
switch (vendor)
@ -5198,15 +5199,11 @@ VendorCtrl* CPhoneDevice::MakeVendorCtrl(int vendor, uint8_t channel, const std:
break;
case 3:
// Yu Shi
vendorCtrl = new YuShiCtrl(ip, userName, password, channel, netHandle);
vendorCtrl = new YuShiCtrl(ip, userName, password, channel, netHandle, syncTime);
break;
case 5:
// Hang Yu - New
vendorCtrl = new HangYuCtrl(ip, userName, password, channel, netHandle);
}
if (vendorCtrl != NULL)
{
vendorCtrl->UpdateTime(time(NULL));
vendorCtrl = new HangYuCtrl(ip, userName, password, channel, netHandle, syncTime);
}
return vendorCtrl;
}

@ -280,7 +280,7 @@ public:
net_handle_t GetEthnetHandle() const;
VendorCtrl* MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle);
VendorCtrl* MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle, bool syncTime);
protected:

@ -6,6 +6,11 @@
VendorCtrl::VendorCtrl(const std::string& ip, const std::string& userName, const std::string& password, uint8_t channel, net_handle_t netHandle, bool syncTime/* = true*/) :
m_ip(ip), m_userName(userName), m_password(password), m_channel(channel), m_netHandle(netHandle)
{
if (syncTime)
{
time_t ts = time(NULL);
UpdateTime(ts);
}
}
std::string VendorCtrl::CvtJSONToString(const Json::Value& data)
{

Loading…
Cancel
Save