From e5cff5a3ef373a5090f45cd1dfb0b85d9c851d5d Mon Sep 17 00:00:00 2001 From: FuJuntang <strongtiger_001@163.com> Date: 星期三, 06 七月 2022 10:04:09 +0800 Subject: [PATCH] Add video recorder and playback support. --- comm/proto_comm.h | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 38 insertions(+), 8 deletions(-) diff --git a/comm/proto_comm.h b/comm/proto_comm.h index 9ca7239..97f3a0b 100644 --- a/comm/proto_comm.h +++ b/comm/proto_comm.h @@ -8,6 +8,9 @@ #include <stdio.h> #include <stdlib.h> #include <assert.h> +#include <time.h> +#include <signal.h> + #include "soapH.h" #include "soapStub.h" #include "wsaapi.h" @@ -24,6 +27,10 @@ #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif +#define WT_TIME 5 +#define STOP_WT_TIME 3 +#define WT_MAX_TIME (60 * 20) + #define SOAP_ASSERT assert #define SOAP_DBGERR printf @@ -33,27 +40,46 @@ #define SOAP_DBGLOG #endif +#define USERNAME "On_admin" +#define PASSWORD "a12345678" + #define SOAP_TO "urn:schemas-xmlsoap-org:ws:2005:04:discovery" #define SOAP_ACTION "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe" #define SOAP_MCAST_ADDR "soap.udp://239.255.255.250:3702" -#define SOAP_ITEM "" // 寻找的设备范围 -#define SOAP_TYPES "dn:NetworkVideoTransmitter" // 寻找的设备类型 +#define SOAP_ITEM "" +#define SOAP_TYPES "dn:NetworkVideoTransmitter" //device type + +#define ADDR_PREFIX "http://" +#define ADDR_LAST "/" + +#define NAME_BRIDGE "_" +#define NAME_DOT "." +#define NAME_MID "-" #define SOAP_SOCK_TIMEOUT (10) //sec + +#define TRUE 1 +#define FALSE 0 + +#define ENABLE 0 +#define DISABLE 1 #define PARA_MIN (-1) #define PARA_MAX (1) -#define PROTO_ADDRESS_SIZE (128) // URI地址长度 -#define PROTO_TOKEN_SIZE (65) // token长度 +#define PROTO_ADDRESS_SIZE (128) +#define PROTO_TOKEN_SIZE (65) //token size +#define PTOTO_ADDRESS_ADD (65) -/* 视频编码器配置信息 */ +#define MAX_BUF_SIZE 600 + +/*video encoder configurations */ struct tagVideoEncoderConfiguration { - char token[PROTO_TOKEN_SIZE]; // 唯一标识该视频编码器的令牌字符串 - int Width; // 分辨率 + char token[PROTO_TOKEN_SIZE]; //video token + int Width; //resolution int Height; }; @@ -78,6 +104,10 @@ } \ } while (0) +int timer_init(timer_t *timer_index, void (*timer_handler)(union sigval para)); +int timer_start(timer_t timer_index, int sec); +int timer_stop(timer_t timer_index); +int timer_destroy(timer_t timer_index); void soap_perror(struct soap *soap, const char *str); void * proto_soap_malloc(struct soap *soap, unsigned int n); @@ -89,7 +119,7 @@ void proto_init_ProbeType(struct soap *soap, struct wsdd__ProbeType *probe); float para_check(float data); -int make_uri_withauth(char *src_uri, char *username, char *password, char *dest_uri, unsigned int size_dest_uri); +int bridge_uri(char *src_uri, const char *username, const char *password, char *dest_uri, unsigned int size_dest_uri); int soap_wsse_add_UsernameTokenDigest(struct soap *soap, const char *id, const char *username, const char *password); int proto_GetDeviceInformation(const char *DeviceXAddr, const char *username, const char *passwd); -- Gitblit v1.8.0