⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthread_enc.h

📁 1、基于韩国at2041芯片开发的Linux环境的DVR代码。 2、以原来代码进行了修改。 3、主要修改网络通讯出现异常问题处理 4、硬盘覆盖录像不起作用
💻 H
字号:
/* set tabstop=4 */
/********************************************************************************
 *                                                                              *
 * Copyright(C) 2004  Penta-Micro                                               *
 *                                                                              *
 * ALL RIGHT RESERVED                                                           *
 *                                                                              *
 * This software is the property of Penta-Micro and is furnished under          *
 * license by Penta-Micro. This software may be used only in accordance         *	
 * with the terms of said license. This copyright notice may not be             *
 * removed, modified or obliterated without the prior written permission        *
 * of Penta-Micro.                                                              *
 *                                                                              *
 * This software may not be copyed, transmitted, provided to or otherwise       *
 * made available to any other person, company, corporation	or other entity     *
 * except as specified in the terms of said license.                            *
 *                                                                              *
 * No right, title, ownership or other interest in the software is hereby       *
 * granted or transferred.                                                      *
 *                                                                              *
 * The information contained herein is subject to change without notice and     *
 * should not be construed as a commitment by Penta-Micro.                      *
 *                                                                              *
 ********************************************************************************
 
  MODULE NAME:  PTHREAD_ENC.H
  
  REVISION HISTORY:
  
  Date       Ver Name                  Description
  ---------- --- --------------------- -----------------------------------------
 06/30/2004 2.0 CheulBeck(whitefe)       Created 
 07/20/2005 2.1 JiGwanKang(xchannel)  Modified 
 ...............................................................................
 
  DESCRIPTION:
  
  This Module contains definition for MPEG Encoding function.
  
 ...............................................................................
*/    
 
#ifndef __PTHREAD_ENC_H
#define __PTHREAD_ENC_H


/** ************************************************************************* ** 
 ** includes
 ** ************************************************************************* **/
#include "typedef.h"

 
/** ************************************************************************* ** 
 ** defines
 ** ************************************************************************* **/

#define ENC_MAX_BUF_SIZE	64*1024

#define TX_BUF_SIZE			4
#define DUMMY_FILE_SIZE     292

/* define PROGRAM_STREAM_MAP_VERSION */
#define PROGRAM_STREAM_MAP_VERSION 2

/* define STREAM_TYPE */
#define STREAM_TYPE_JPEG  0x80
#define STREAM_TYPE_MPEG1 0x81
#define STREAM_TYPE_MPEG2 0x82
#define STREAM_TYPE_H263  0x83
#define STREAM_TYPE_MPEG4 0x84
#define STREAM_TYPE_PCM   0x90
#define STREAM_TYPE_ADPCM 0x91
#define STREAM_TYPE_MP2   0x92
#define STREAM_TYPE_MP3   0x93
#define STREAM_TYPE_DUMMY 0xFF

/** ************************************************************************* ** 
 ** typedefs
 ** ************************************************************************* **/
typedef struct __ENC_EVENT__ {
	UNS16	cur_motion;
	UNS16	prev_motion;
	UNS16	cur_sensor;
	UNS16	prev_sensor;
	UNS16	set_motion;	
	UNS16	set_sensor;
	UNS16	insert_motion;
	UNS16	insert_sensor;
	UNS16	first_I_motion;	
	UNS16	first_I_sensor;
	UNS16	first_flag_motion;
	UNS16	first_flag_sensor;
} ENC_EVENT;

/* type definition for delete DB */
typedef struct __DB_DELETE__ {
	S8		fname[32];
	UNS16	ch;
	UNS16	normal;
	UNS16	motion;
	UNS16	sensor;
} DB_DELETE; 

typedef struct __ENC_OBJECT__ {
	S8		fname_ps[32];			// file name for saving video stream 
	S8		dname_ps[16];			// directory name for saving video stream
	FILE	*p_fd_ps;				// file descriptor for video stream
	time_t	time_end;				// time when file ended
	UNS16	*p_mux_buf;				// buffer pointer to mux video stream
	UNS32	prev_packet_length;		// buffer for saving previous packet length	
	ENC_EVENT		event_ch[MAX_CH_NUM];	// save event information
	INFO_PICTURE	info_picture;	// pointer to picture info structure
	DB_RECORD		db_nrec;		// pointer to normal record db structure
	DB_DELETE		db_del;		// pointer for delete db structure
	SETUP_PARAM		*psp;		// pointer for setup parameter structure 
	PTHREAD_STATE	*pps;		// pointer for pthread state structure
} ENC_OBJECT;

/* Channel infomation structure */
typedef struct __tag_CHINFO__ {
	UNS8	stream_type; // stream_type
	UNS8	mb_width;    // coded_picture_width / 16 (video only)
	UNS8	mb_height;   // coded_picture_height / 16 (video only)
} CHINFO;


  
/** ************************************************************************* ** 
 ** function prototypes
 ** ************************************************************************* **/
void	            *pthread_enc(void *args);
RETURN	at2041_set_param(SETUP_PARAM *psp);
void	            motion_sensitivity(UNS16 ch_id, UNS16 level);
void	            motion_area(UNS16 ch_id, UNS32 *area);
void            	make_rectable(S32 *ch, S32 field_flag, S32 max_frame);
void	            get_time(time_t *time_a, struct tm *time_b, OPTION mode);
RETURN	create_rec_file(ENC_OBJECT *peo);
RETURN	insert_program_header(SETUP_PARAM *psp);
S32		      make_pshdr(UNS8 *hdr, CHINFO *v_ch_info, CHINFO *a_ch_info);
RETURN	stop_encoding(ENC_OBJECT *peo);
RETURN	get_data_inform_from_stream(ENC_OBJECT *peo);
BOOL	      stream_filter(ENC_OBJECT *peo);
RETURN	check_event_from_picture_info(ENC_OBJECT *peo);
RETURN	insert_picture_info_in_stream(ENC_OBJECT *peo);
RETURN	write_stream_to_harddisk(ENC_OBJECT *peo);
RETURN	update_rec_file(ENC_OBJECT *peo);
BOOL	      check_dummy_file(ENC_OBJECT *peo);
RETURN	at2041_update_db_normal(ENC_OBJECT *peo);
RETURN      sub_db_update(ENC_OBJECT *peo);
RETURN      main_db_update(ENC_OBJECT *peo);
RETURN      recreate_sub_db(ENC_OBJECT *peo);
#endif /* __PTHREAD_ENC_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -