You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
7.7 KiB
207 lines
7.7 KiB
//----------------------------------------------------------------------------
|
|
// Dr.Frucht Systems Ltd.
|
|
// Copyright © 2000-2017. All Rights Reserved.
|
|
// Version 2.0 6/11/2019
|
|
// Last modification: 6/11/2019
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: rgooseIPCamera.h
|
|
// AUTHOR: gagua
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Header file of rgooseIPCamera.h
|
|
//----------------------------------------------------------------------------
|
|
//
|
|
#ifndef __DEVICE_NODE_CAMERA_HEADER__
|
|
#define __DEVICE_NODE_CAMERA_HEADER__
|
|
|
|
#include <vector>
|
|
#include <queue>
|
|
#include "../../components/base/basicThread.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
#include "../../data/protocol/protocolPTZ.h"
|
|
|
|
#include "../../components/base/basicEventHeap.h"
|
|
//#include "rgooseDBConnector.h"
|
|
#include "deviceNode.h"
|
|
|
|
//https://www.ebay.com/itm/Professional-Rolling-Makeup-Case-Bulb-Mirror-Cosmetic-Artist-Dressing-Train-Case/233264525474
|
|
|
|
//ffmpeg -i input.mp4 -af loudnorm=I=-23:LRA=7:tp=-2:print_format=json -f null -
|
|
//ffmpeg -i input.mp4 -af loudnorm=I=-23:LRA=7:tp=-2:measured_I=-30:measured_LRA=1.1:measured_tp=-11 04:measured_thresh=-40.21:offset=-0.47 -ar 48k -y output.mp4
|
|
|
|
#define CAM_CTRL_PROTO_VISCA 1
|
|
#define CAM_CTRL_PROTO_PELCO 2
|
|
#define CAM_CTRL_PROTO_ONVIF 3
|
|
#define CAM_CTRL_PROTO_PSIA 4
|
|
#define CAM_CTRL_PROTO_T28181 5
|
|
|
|
#define UART_TYPE_HARDWARE 1
|
|
#define UART_TYPE_SOL 2
|
|
|
|
#define ARGUS_CAM_PCMD_MOVE_MASK 0x7F
|
|
#define ARGUS_CAM_PCMD_CMD_MASK 0x80
|
|
#define ARGUS_CAM_PCMD_STOP 1
|
|
|
|
|
|
typedef struct S_CAM_PTZ_CMD{
|
|
uint8_t CMD;
|
|
float PAN;
|
|
float TILT;
|
|
float ZOOM;
|
|
}CAM_PTZ_CMD;
|
|
|
|
typedef enum E_CAM_PTZ_CMD{
|
|
PTZ_STOP = 0,
|
|
PTZ_MOVE = 1,
|
|
PTZ_ABSOLUTE = 2,
|
|
PTZ_RELOAD_CAMERA = 3,
|
|
PTZ_CAPTURE_ONLY = 4
|
|
}PTZ_CMD;
|
|
|
|
typedef std::queue<CAM_PTZ_CMD *> CAM_PTZ_CMD_QUEUE;
|
|
|
|
typedef enum E_CAM_WORKING_STATE{
|
|
CAM_WS_INIT = 0,
|
|
CAM_WS_WHITE_BALLANCE = 1,
|
|
CAM_WS_BACKLIGHT = 2,
|
|
CAM_WS_AUTO_FOCUS = 3,
|
|
CAM_WS_INIT_GO_HOME = 4,
|
|
CAM_WS_AUTOMATED_MOVE = 10,
|
|
CAM_WS_STOP_MOVE = 11,
|
|
CAM_WS_GO_ABS_POSITION = 12,
|
|
CAM_WS_GO_HOMING_PRESET = 13,
|
|
CAM_WS_GO_PRESET = 14,
|
|
CAM_WS_GO_ABS_ROI = 15,
|
|
CAM_WS_READY = 64,
|
|
CAM_WS_BUSY = 128,
|
|
CAM_WS_END = 255
|
|
}CAM_WORK_STATE;
|
|
|
|
typedef struct S_CAM_TASK{
|
|
bool isDone;
|
|
uint32_t source_evt_id;
|
|
bool movemet_needed;
|
|
CAM_PTZ_CMD * CMD;
|
|
} CAM_TASK;
|
|
|
|
typedef std::queue<CAM_TASK *> CAM_TASK_QUEUE;
|
|
|
|
#define LOSE_INTERES_TIME_MS 2000
|
|
|
|
|
|
inline CAM_ROI *createCAM_ROI( void ){
|
|
CAM_ROI * tROI = (CAM_ROI*)malloc(sizeof(CAM_ROI));
|
|
if( tROI ){
|
|
memset( tROI,0,sizeof(CAM_ROI));
|
|
tROI->targets.clear();
|
|
};
|
|
return tROI;
|
|
};
|
|
|
|
inline void utilizeROI( CAM_ROI *&ptr ){
|
|
if( ptr ) {
|
|
if ( ptr->targets.size() ) {
|
|
for( vCAM_TRACK_RECORDS::iterator idx = ptr->targets.begin(); idx != ptr->targets.end(); idx++ ) free( *idx );
|
|
ptr->targets.clear();
|
|
};
|
|
free( ptr );
|
|
ptr = NULL;
|
|
};
|
|
};
|
|
|
|
|
|
class deviceNodeCamera: public deviceNode, public basicThread {
|
|
private:
|
|
basicPosition m_oPosition;
|
|
time_t m_tTimeTSeconds;
|
|
CAM_ROI * m_pCurrentROI;
|
|
|
|
float m_fMaxRange;
|
|
float m_fMinRange;
|
|
float m_fMaxFL;
|
|
float m_fMinFL;
|
|
float m_fR2FL; // Range to Focal Length
|
|
|
|
float m_fZoomCorrection;
|
|
|
|
uint16_t m_nRealFrameWidth;
|
|
uint16_t m_nRealFrameHeight;
|
|
float m_fMinHFov;
|
|
float m_fMaxHFov;
|
|
float m_fMinVFov;
|
|
float m_fMaxVFov;
|
|
|
|
protocolPTZ * m_pProtocol;
|
|
basicTransport * m_pTransport;
|
|
|
|
CAM_TASK_QUEUE m_qCAM_TASK;
|
|
basicMutex m_mQPROTECTOR;
|
|
|
|
uint32_t m_nRelativeMoveCounter;
|
|
uint32_t m_nHomingCounter;
|
|
uint8_t m_bRelativeMoveMatrix;
|
|
float m_fSpeedRise;
|
|
float m_fRM_Pan;
|
|
float m_fRM_Tilt;
|
|
float m_fRM_Zoom;
|
|
|
|
float m_fCP_Pan;
|
|
float m_fCP_Tilt;
|
|
float m_fCP_Zoom;
|
|
|
|
/* Methotds Sutable to Control Camera */
|
|
bool relativeMove( float PanSPD, float TiltSPD, float ZoomSPD );
|
|
bool relativeStop();
|
|
bool absoluteMove( uint32_t RefID, float PanPOS, float TiltPOS, float ZoomPOS );
|
|
bool absoluteMove( uint32_t RefID, C3D_ORIENT_ONVIF O );
|
|
|
|
/* tracking Fusion methods */
|
|
vCAM_ROIS m_vROIS;
|
|
basicMutex m_mROIsProtector;
|
|
bool fusion_consumeData( uint32_t db_id, C3D_SPH_DEGREES tOR );
|
|
bool fusion_validateROI( uint64_t cts, CAM_ROI *ptr );
|
|
bool fusion_compare( CAM_ROI *ptr, C3D_SPH_DEGREES tp );
|
|
void fusion_validate( void );
|
|
CAM_ROI * fusion_fetchROI( void );
|
|
DBC_SNAPSHOT_DATA * fusion_translate_ROI( CAM_ROI *(&ptr) );
|
|
void updateOpticalParameters( uint16_t frame_width, uint16_t frame_heigth );
|
|
protected:
|
|
DBC_CAM_DATA m_sCamData;
|
|
MEDIA_SOURCE_DESC m_sMediaSource;
|
|
basicEventHeap * m_pBEH;
|
|
//bool m_bSourceConnected;
|
|
//uint32_t m_nActiveStreamID;
|
|
//bool inTheFOV( float lat, float lon, float alt );
|
|
|
|
bool testFOV( C3D_WGS84_LOC ); //Global Coords
|
|
bool testFOV( C3D_DECART ); //System Coords
|
|
bool testFOV( C3D_SPH_RADIANS ); //Local Coords
|
|
bool testFOV( C3D_SPH_DEGREES ); //Local Coords
|
|
|
|
//bool lookAtWGS84( uint32_t TargetRefID, float lat, float lon, float alt );
|
|
bool lookAt( uint32_t TargetRefID, C3D_WGS84_LOC L ); // GLobal
|
|
bool lookAt( uint32_t TargetRefID, C3D_DECART L ); // System
|
|
bool lookAt( uint32_t TargetRefID, C3D_SPH_RADIANS L ); // Local
|
|
bool lookAt( uint32_t TargetRefID, C3D_SPH_DEGREES L ); // Local
|
|
|
|
bool makeSnap( uint32_t TargetRefID );
|
|
//void setBusy( bool Status );
|
|
bool connectToStream( uint32_t id );
|
|
bool disconnectFromStream( void );
|
|
bool validateStream( void );
|
|
CAM_TASK * fetchCamTask( void );
|
|
bool pushCamTask( CAM_TASK * );
|
|
virtual void m_fThreadProc( void );
|
|
public:
|
|
explicit deviceNodeCamera( uint32_t NodeID );
|
|
explicit deviceNodeCamera( DBC_NODE_DATA *Data );
|
|
virtual ~deviceNodeCamera();
|
|
bool create();
|
|
virtual bool validate();
|
|
|
|
};
|
|
|
|
typedef std::vector<deviceNodeCamera *> vectorNodeCameras;
|
|
|
|
#endif
|