📄 main.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: MAIN.H
REVISION HISTORY:
Date Ver Name Description
---------- --- --------------------- -----------------------------------------
06/28/2004 2.0 CheulBeck(whitefe) Created
07/20/2005 2.1 JiGwanKang(xchannel) Modified
...............................................................................
DESCRIPTION:
This Module contains definition for MAIN function.
...............................................................................
*/
#ifndef __MAIN_H
#define __MAIN_H
/** ************************************************************************* **
** includes
** ************************************************************************* **/
#include <time.h>
#include <sys/time.h>
#include <semaphore.h>
#include "typedef.h"
/** ************************************************************************* **
** defines
** ************************************************************************* **/
//#define CIF_INTERLACE
#if 1//for poting
#define __TRANS_THR__
#endif
#define CBR_MODE
#define FOR_DEMO
#define FAST_TEST
#define NVRAM_TEST
#define __WAIT__ 0
#define __NO_WAIT__ 1
#define __NOWAIT__ 10
/* remote controller key mapping */
#if 1//for porting
#define SDVR_KEY_POWER 0x00
#else
#define SDVR_KEY_POWER 0x80
#endif
#define SDVR_KEY_OSD 0x40
#define SDVR_KEY_1 0xB0
#define SDVR_KEY_2 0x70
#define SDVR_KEY_3 0xF0
#define SDVR_KEY_4 0x08
#define SDVR_KEY_5 0x88
#define SDVR_KEY_6 0x48
#define SDVR_KEY_7 0xC8
#define SDVR_KEY_8 0x28
#define SDVR_KEY_9 0xA8
#define SDVR_KEY_0 0x68
#define SDVR_KEY_PLUS 0x18
#define SDVR_KEY_MINUS 0xE8
#define SDVR_KEY_SETUP 0xC0
#define SDVR_KEY_SUB_PLUS 0x20
#define SDVR_KEY_SUB_MINUS 0xA0
#define SDVR_KEY_LEFT 0x60
#define SDVR_KEY_UP 0xE0
#define SDVR_KEY_DOWN 0x10
#define SDVR_KEY_RIGHT 0x90
#define SDVR_KEY_SEL 0x30
#define SDVR_KEY_F1 0x02
#define SDVR_KEY_F2 0x82
#define SDVR_KEY_F3 0x42
#define SDVR_KEY_F4 0xc2
#define SDVR_KEY_F5 0x22
#define SDVR_KEY_REW 0x38
#define SDVR_KEY_PLAY 0xB8
#define SDVR_KEY_FF 0x78
#define SDVR_KEY_REC 0x58
#define SDVR_KEY_STOP 0x98
#define SDVR_KEY_SLOW 0xD8
/* update for hard disk infomation ( 1 sec ) */
#define TEXTUPDATE_CMD 0xAA
/* definition for remocon key number */
#define POWER SDVR_KEY_POWER
#define OSD SDVR_KEY_OSD
#define NUMBER0 SDVR_KEY_0
#define NUMBER1 SDVR_KEY_1
#define NUMBER2 SDVR_KEY_2
#define NUMBER3 SDVR_KEY_3
#define NUMBER4 SDVR_KEY_4
#define NUMBER5 SDVR_KEY_5
#define NUMBER6 SDVR_KEY_6
#define NUMBER7 SDVR_KEY_7
#define NUMBER8 SDVR_KEY_8
#define NUMBER9 SDVR_KEY_9
#define NUM_PLUS SDVR_KEY_PLUS
#define NUM_MINUS SDVR_KEY_MINUS
#define SETUP SDVR_KEY_SETUP
#define SUB_PLUS SDVR_KEY_SUB_PLUS
#define SUB_MINUS SDVR_KEY_SUB_MINUS
#define LEFT SDVR_KEY_LEFT
#define RIGHT SDVR_KEY_RIGHT
#define UP SDVR_KEY_UP
#define DOWN SDVR_KEY_DOWN
#define SEL SDVR_KEY_SEL
#define REW SDVR_KEY_REW
#define PLAYBACK SDVR_KEY_PLAY
#define FF SDVR_KEY_FF
#define REC SDVR_KEY_REC
#define SEARCH SDVR_KEY_STOP
#define SLOW SDVR_KEY_SLOW
#define RECSET SDVR_KEY_F1
#define PTZ_ZOOMIN SDVR_KEY_PLUS
#define PTZ_ZOOMOUT SDVR_KEY_MINUS
#define PTZ_FOCUSIN SDVR_KEY_F1
#define PTZ_FOCUSOUT SDVR_KEY_F2
#define PTZ_CONTROL SDVR_KEY_F4
#define STEP_F SDVR_KEY_F5
#define PAUSE SDVR_KEY_F4
#define STEP_B SDVR_KEY_F3
/* Definition for TW2834 FONT */
#define UNIT_FONT_LINE 45
/* Definition for NVRAM Setup */
#if 1/* big endian code */
/* When the version is exchanged, must be modify. ex) ver 1.0.0 -> 0x010000 */
// pentamicro 2006.01.11
#define MPEG4_MAGICNUM 0x010101
#else/* little endian code */
/* When the version is exchanged, must be modify. ex) ver 1.0.0 -> 0x000001 */
#define MPEG4_MAGICNUM 0x010101
#endif
#define MAXLEN_ETHADDR 6
#define MAXLEN_HOSTNAME 16
#define MAX_CH_NUM 4
/* file name for search DB */
#define SUB_DB_NAME "sub_search.db"
#define SUB_SEARCH_DB(s, i) sprintf(*s, "/hdd%c/%s", 'a'+i, SUB_DB_NAME)
#define TEMP_SEARCH_DB(s, i) sprintf(*s, "/hdd%c/temp.db", 'a'+i)
#define GET_DIR_NAME(s, i) sprintf(*s, "/hdd%c/", 'a'+i)
#define CRC_SUM_SIZE 4
#define MAX_FILES_NUM 40000
#define MAX_FILENAME_SIZE 32
#define MAX_DISK_NUM 4
#define MAXIMUM_SEC_MB 4 /* in Mbytes, (maximum MB/sec) */
/* motion area */
#define AT2041_MB_TABLE 18
#define MB_X_NUM 12
/* NTSC = 8 block, PAL = 9 block */
UNS8 MB_Y_NUM;
#define MAB_NUM 4
#if 1//tw2834 block and at2041 block size
#define MB_2X2_SIZE 2
#define MB_1X1_SIZE 1
#endif
#define COLOR_MOTION 0x6c
#define COLOR_MOTION_CURSOR 0x70
#define COLOR_CURSOR 0x3c
/* TW2834 */
#define TW2834_PAGE0 0
#define TW2834_PAGE1 1
#define TW2834_PAGE2 2
/* define for fonRAM page list */
#define FONT_PAGE0 0
#define FONT_PAGE1 1
#define FONT_PAGE2 2
#define FONT_PAGE3 3
#define FONT_PAGE4 4
#define FONT_PAGE5 5
#define FONT_PAGE6 6
#define FONT_PAGE7 7
#define FONT_PAGE8 8
#define FONT_PAGE9 9
#define FONT_PAGE10 10
#define FONT_PAGE11 11
#define FONT_PAGE12 12
#define FONT_PAGE13 13
#define FONT_PAGE14 14
#define FONT_PAGE15 15
#define X_PATH 0x80 /* display path */
#define Y_PATH 0x40 /* record path */
#define ALL_PATH (X_PATH|Y_PATH)
/* TW2834 OSD */
#define WHITE 0x00 /* White (default color) */
#define YELLOW 0x01 /* Yellow */
#define RED 0x02 /* Red */
#define BLUE 0x03 /* Blue */
#define FILL 0x00 /* Fill color (default color) */
#define BLINK 0x04
#define BLINK_0_25S 0x00 /* 0.25 sec blink */
#define BLINK_0_5S 0x10 /* 0.5 sec blink */
#define BLINK_1S 0x20 /* 1 sec blink */
#define BLINK_2S 0x30 /* 2 sec blink */
#define BLEND 0x08 /* enable the mix with video data */
#define BITMAP 0x80 /* bitmap box type */
#define NORMAL 0x00 /* default attribute font */
//#define TRANS 0 /* Transparency color */
/* system parameter:password */
#define USER_NUM 2
/* system parameter:ptz */
#define PTZ_MAX_VENDOR 10
#define PTZ_SPEED_LEVEL 10
/* decoding trick mode */
#define trick_mode(a, b, c, d) ((a & 0x03) << 8) | ((b & 0x07) << 5) | ((c & 0x01) << 4) | (d & 0x0f)
/* setup parameter for schedule */
#define MAX_DAY_OF_WEEK 7
// swpark
//#define LOOPTHROUGH_MODE
/** ************************************************************************* **
** typedefs
** ************************************************************************* **/
typedef enum {
MAIN_SETUP = 0,
MAIN_SEARCH, // 1 //
MAIN_BACKUP, // 2 //
MAIN_LIVE, // 3 //
MAIN_PTZ, // 4 //
MAIN_IDLE
} MAIN_LOC;
typedef enum {
PTHREAD_MAIN = 0,
PTHREAD_MANAGER,
PTHREAD_INPUT,
PTHREAD_SETUP,
PTHREAD_SEARCH,
PTHREAD_ENC,
PTHREAD_DEC,
PTHREAD_LIVE,
PTHREAD_DISKM,
PTHREAD_SCHEDULE,
PTHREAD_TRANS,
PTHREAD_GPIO,
PTHREAD_PTZ,
PTHREAD_MOUSE,
PTHREAD_MAX
} PTHREAD_ID;
typedef enum {
PTHREAD_ITEM_0,
PTHREAD_ITEM_1,
PTHREAD_ITEM_2,
PTHREAD_ITEM_3,
PTHREAD_ITEM_4,
PTHREAD_ITEM_5,
PTHREAD_ITEM_6,
PTHREAD_ITEM_7,
PTHREAD_MAX_ITEM
} PTHREAD_ITEM;
typedef enum {
INIT_FLAG = 0,
WRITE_FLAG ,
READ_FLAG,
} PTHREAD_SIG_COND;
typedef enum {
SIGNAL_0,
SIGNAL_1,
SIGNAL_2,
SIGNAL_3,
SIGNAL_4,
SIGNAL_MAX
} PTHREAD_SIGNAL;
typedef struct __PTHREAD_BUF__ {
PTHREAD_ID start_id;
UNS16 m_signal;
UNS32 m_value;
UNS16 m_channel;
} PTHREAD_BUF;
/* ==================TYPEDEF for PTHREAD_STATE=============== */
typedef enum {
IDLE = 0,
BUSY,
ALIVE
} MAIN_STATE;
typedef struct __STATE_MAIN__ {
MAIN_STATE state;
VIDEO_MODE mode;
} STATE_MAIN;
typedef enum {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -