#ifndef __SRV_AV_DEMUX_H__ #define __SRV_AV_DEMUX_H__ #include #include #include "capabilities/capa.h" #ifdef __cplusplus extern "C" { #endif #define VIDEO_PUT_DIR "/home/Work/Log_repo/video_log" #define VIDEO_CONF_DATA "/usr/bin/video_conv.sh" #define FFMPEG_BIN_DIR "/home/Work/Sources_temp/ffmpeg_sources/host/bin/ffmpeg" #define VIDEO_DURATION (5 * 60) //sec #define KB (1024.0) #define MB (KB * 1024.0) #define GB (MB * 1024.0) #define DISK_FREE_THRES (0.05) /*the player work mode status*/ enum wr_mode { NORMAL, PAUSE, }; /*playback mode set key*/ typedef struct _playback_key { /*format: 192.168.1.101*/ char name[PTOTO_ADDRESS_ADD]; /*format: 2022-6-28*/ char date[PTOTO_ADDRESS_ADD]; /*format: 21-32-19*/ char time[PTOTO_ADDRESS_ADD]; } playback_key; /*the operational handle*/ typedef struct _AVDevs { /*the devices capabilities*/ struct tagCapabilities capa; /*the profies for each servies*/ struct tagProfile *profiles; timer_t timer_id; int timer_sec; sem_t sem_cap; volatile char run_stat; volatile char slice_stat; char ip[PROTO_ADDRESS_SIZE]; char uri[PROTO_ADDRESS_SIZE + PTOTO_ADDRESS_ADD]; char uri_data[PROTO_ADDRESS_SIZE + PTOTO_ADDRESS_ADD]; /*the device work stat*/ char dev_stat; /*the process work stat*/ char proc_stat; /*the stat record for pause work mode*/ char pause_enable; char pause_prev_loc[MAX_BUF_SIZE]; char pause_cur_loc[MAX_BUF_SIZE]; enum wr_mode work_mode; } AVDevs; int proto_AVInit(void); void proto_AVStart(AVDevs *DevData); void proto_AVStop(AVDevs *DevData, enum wr_mode mode); void proto_AVClose(void); AVDevs *proto_AVGethandle(void); void get_stream(AVDevs *DevData); int playback_get_key(playback_key set, char *buf, int length); static int get_dir_with_key(char *dir_path, char *name, char *key, char *buf, int length); static int get_file_with_key(char *dir_path, char *key, char *buf, int length, int flag); static int get_dir_oldest(char *dir_path, char *buf, int length); static void cb_av_probe(char *DeviceXAddr); static int video_file_create(char *buf, int len); static int av_start_cap(AVDevs *DevData); static void system_date_get(char *buf, int len); #endif