source/dvr_enc_api.h
Go to the documentation of this file.
00001 #ifndef __DVR_ENC_API_H__ 00002 #define __DVR_ENC_API_H__ 00003 00004 #include <linux/ioctl.h> 00005 #include "dvr_type_define.h" 00006 #include "dvr_enc_ioctl.h" 00007 00008 typedef enum dvr_enc_src_type_tag { 00009 ENC_TYPE_FROM_CAPTURE=0, 00010 ENC_TYPE_FROM_CASCADE, 00011 ENC_TYPE_FROM_BUFFER, 00012 ENC_SRC_TYPE_COUNT 00013 }dvr_enc_src_type; 00014 00015 /** 00016 * @brief no longer used, replace by EncParam_Ext4 00017 */ 00018 typedef struct EncParam_Ext1_tag{ 00019 unsigned int feature_enable; 00020 unsigned int target_rate_max; 00021 unsigned int reaction_delay_max; 00022 }EncParam_Ext1; 00023 00024 /** 00025 * @brief no longer used, replace by EncParam_Ext4 00026 */ 00027 typedef struct EncParam_Ext2_tag{ 00028 unsigned int feature_enable; 00029 unsigned int target_rate_max; 00030 unsigned int reaction_delay_max; 00031 int enc_type; 00032 int MJ_quality; 00033 }EncParam_Ext2; 00034 00035 /** 00036 * @brief no longer used, replace by EncParam_Ext4 00037 */ 00038 typedef struct EncParam_Ext3_tag{ 00039 /*! #DVR_ENC_ENHANCE_H264_RATECONTROL */ 00040 /*! #DVR_ENC_MJPEG_FUNCTION */ 00041 /*! #DVR_ENC_H264_WATERMARK */ 00042 unsigned int feature_enable; ///< this is a bit combination. If you want to involve watermark, then feature_enable |= DVR_ENC_H264_WATERMARK. 00043 /*! ECBR: usually stays at target bitrate, */ 00044 /*! produce large bitrate when big motion, but never more than max bitrate */ 00045 unsigned int target_rate_max; 00046 /*! max frame count will the rate-control stay when away from the target bitrate, only valid at ECBR */ 00047 unsigned int reaction_delay_max; 00048 /*! #EncodeType_tag */ 00049 int enc_type; 00050 /*! 1(worst) ~100(best) */ 00051 int MJ_quality; ///< Motion JPEG quality 00052 /*! Indicate watermark enable or not */ 00053 /*! if 0: disable, */ 00054 /*! if 1: enable, but only insert watermark at intra-mb, */ 00055 /*! if 3: enable, and insert warermark at intra/inter-mb, */ 00056 /*! if others: not allowed */ 00057 int watermark_enable; 00058 /*! specify the interval, to insert watermark each "interval" frame, */ 00059 /*! valid when watermark function is enabled, */ 00060 /*! if 1: will be inserted watermark each frames, */ 00061 /*! if N: will be inserted watermark each N frames */ 00062 int watermark_interval; 00063 /*! The initial pattern for watermark */ 00064 /*! valid when watermark function is enabled */ 00065 int watermark_init_pattern; 00066 /*! specify the interval, to reinit with init_pattern each "watermark"ed frames */ 00067 /*! valid when watermark function is enabled */ 00068 /*! if 1: every "watermark"ed frame with init_pattern */ 00069 /*! if N: initial with init_pattern each N "watermark"ed frame */ 00070 int watermark_init_interval; 00071 }EncParam_Ext3; 00072 00073 /** 00074 * @brief encode parameter extension 00075 */ 00076 typedef struct EncParam_Ext4_tag{ 00077 /*! #DVR_ENC_ENHANCE_H264_RATECONTROL */ 00078 /*! #DVR_ENC_MJPEG_FUNCTION */ 00079 /*! #DVR_ENC_H264_WATERMARK */ 00080 /*! #DVR_ENC_ROI_POS */ 00081 unsigned int feature_enable; ///< this is a bit combination. If you want to involve watermark, then feature_enable |= DVR_ENC_H264_WATERMARK. 00082 /*! for New rate control */ 00083 /*! ECBR: usually stays at target bitrate, */ 00084 /*! produce large bitrate when big motion, but never more than max bitrate */ 00085 unsigned int target_rate_max; 00086 /*! max frame count will the rate-control stay when away from the target bitrate, only valid at ECBR */ 00087 unsigned int reaction_delay_max; 00088 /*! for MJPEG */ 00089 /*! #EncodeType_tag */ 00090 int enc_type; 00091 /*! 1(worst) ~100(best) */ 00092 int MJ_quality; ///< Motion JPEG quality 00093 /*! for H264 Water Mark */ 00094 /*! Indicate watermark enable or not */ 00095 /*! if 0: disable, */ 00096 /*! if 1: enable, but only insert watermark at intra-mb, */ 00097 /*! if 3: enable, and insert warermark at intra/inter-mb, */ 00098 /*! if others: not allowed */ 00099 int watermark_enable; 00100 /*! specify the interval, to insert watermark each "interval" frame, */ 00101 /*! valid when watermark function is enabled, */ 00102 /*! if 1: will be inserted watermark each frames, */ 00103 /*! if N: will be inserted watermark each N frames */ 00104 int watermark_interval; 00105 /*! The initial pattern for watermark */ 00106 /*! valid when watermark function is enabled */ 00107 int watermark_init_pattern; 00108 /*! specify the interval, to reinit with init_pattern each "watermark"ed frames */ 00109 /*! valid when watermark function is enabled */ 00110 /*! if 1: every "watermark"ed frame with init_pattern */ 00111 /*! if N: initial with init_pattern each N "watermark"ed frame */ 00112 int watermark_init_interval; 00113 /*! for ROI x, y position */ 00114 POS roi_pos; 00115 }EncParam_Ext4; 00116 00117 typedef struct EncParam_Ext5_tag{ 00118 /*! #DVR_ENC_ENHANCE_H264_RATECONTROL */ 00119 /*! #DVR_ENC_MJPEG_FUNCTION */ 00120 /*! #DVR_ENC_H264_WATERMARK */ 00121 /*! #DVR_ENC_ROI_POS */ 00122 /*! #DVR_ENC_ROI_ALL */ 00123 unsigned int feature_enable; ///< this is a bit combination. If you want to involve watermark, then feature_enable |= DVR_ENC_H264_WATERMARK. 00124 /*! for New rate control */ 00125 /*! ECBR: usually stays at target bitrate, */ 00126 /*! produce large bitrate when big motion, but never more than max bitrate */ 00127 unsigned int target_rate_max; 00128 /*! max frame count will the rate-control stay when away from the target bitrate, only valid at ECBR */ 00129 unsigned int reaction_delay_max; 00130 /*! for MJPEG */ 00131 /*! #EncodeType_tag */ 00132 int enc_type; 00133 /*! 1(worst) ~100(best) */ 00134 int MJ_quality; ///< Motion JPEG quality 00135 /*! for H264 Water Mark */ 00136 /*! Indicate watermark enable or not */ 00137 /*! if 0: disable, */ 00138 /*! if 1: enable, but only insert watermark at intra-mb, */ 00139 /*! if 3: enable, and insert warermark at intra/inter-mb, */ 00140 /*! if others: not allowed */ 00141 int watermark_enable; 00142 /*! specify the interval, to insert watermark each "interval" frame, */ 00143 /*! valid when watermark function is enabled, */ 00144 /*! if 1: will be inserted watermark each frames, */ 00145 /*! if N: will be inserted watermark each N frames */ 00146 int watermark_interval; 00147 /*! The initial pattern for watermark */ 00148 /*! valid when watermark function is enabled */ 00149 int watermark_init_pattern; 00150 /*! specify the interval, to reinit with init_pattern each "watermark"ed frames */ 00151 /*! valid when watermark function is enabled */ 00152 /*! if 1: every "watermark"ed frame with init_pattern */ 00153 /*! if N: initial with init_pattern each N "watermark"ed frame */ 00154 int watermark_init_interval; 00155 /*! for ROI x, y position */ 00156 POS roi_pos; 00157 /*! for update ROI all function, x, y position, width, height, enable/disable */ 00158 ROI_ALL roi_all; 00159 }EncParam_Ext5; 00160 00161 /** 00162 * @brief encode parameter 00163 */ 00164 typedef struct EncParam_tag { 00165 /*! #EncodeType_tag */ 00166 int input_type; 00167 /*! frame rate per second */ 00168 int frame_rate; 00169 /*! bit rate per second */ 00170 int bit_rate; 00171 /*! The I-P interval frames */ 00172 int ip_interval; 00173 /*! The initial quant value */ 00174 int init_quant; 00175 /*! The max/min quant value */ 00176 int max_quant, min_quant; 00177 /*! Enable the ROI function */ 00178 int is_use_ROI; 00179 /*! #RECT_tag */ 00180 RECT ROI_win; 00181 /*! encode parameter extension size */ 00182 unsigned int ext_size; 00183 /*! point to encode parameter extension structure */ 00184 void *pext_data; 00185 int reserved[6]; 00186 } EncParam; 00187 00188 /** 00189 * @brief snapshot parameter 00190 */ 00191 typedef struct snapshot_param_tag { 00192 /*! #JpegEncInputFormatTag */ 00193 int sample; 00194 /*! not in use */ 00195 int RestartInterval; 00196 /*! #JpegEnc420InputFormatTag */ 00197 int u82D; 00198 /*! 1(worst) ~100(best) */ 00199 int quality; 00200 int reserved[8]; 00201 } snapshot_param; 00202 00203 /** 00204 * @brief dvr bit stream parameter, include main, sub1, sub2 bit-stream. 00205 */ 00206 typedef struct ReproduceBitStream_tag { 00207 /*! #DVR_ENC_EBST_ENABLE: enabled */ 00208 /*! #DVR_ENC_EBST_DISABLE: disabled */ 00209 int enabled; 00210 /*! 0: main-bitstream */ 00211 /*! 1: sub-bitstream1 */ 00212 /*! 2: sub-bitstream2 */ 00213 int out_bs; 00214 /*! #EncodeType_tag */ 00215 int enc_type; 00216 /*! indicate all system-call for this channel is "blocked" or "non-block" type */ 00217 int is_blocked; 00218 /*! #DVR_ENC_EBST_ENABLE: enabled */ 00219 /*! #DVR_ENC_EBST_DISABLE: disabled */ 00220 int en_snapshot; ///< enable/disable snapshot 00221 /*! #DIM_tag */ 00222 DIM dim; 00223 /*! #EncParam_tag */ 00224 EncParam enc; 00225 /*! #ScalerParamtag */ 00226 ScalerParam scl; 00227 /*! #snapshot_param_tag */ 00228 snapshot_param snap; 00229 int reserved[8]; 00230 } ReproduceBitStream; 00231 00232 /** 00233 * @brief dvr encode source parameter 00234 */ 00235 typedef struct dvr_enc_src_tag { 00236 /*! channle number 0~7 */ 00237 int channel; 00238 /*! #dvr_enc_src_type_tag */ 00239 int enc_src_type; 00240 /*! #DIM_tag */ 00241 DIM dim; 00242 /*! #LiveviewFrameTypeTag */ 00243 int di_mode; 00244 /*! #LiveviewFrameModeTag */ 00245 int mode; 00246 /*! #LiveviewDMAOrderTag */ 00247 int dma_order; 00248 /*! #LiveviewScalerRatioTag */ 00249 int scale_indep; 00250 /*! #MCP_VIDEO_NTSC */ 00251 /*! #MCP_VIDEO_PAL */ 00252 /*! #MCP_VIDEO_VGA */ 00253 int input_system; 00254 /*! #CaptureColorModeTag */ 00255 int color_mode; 00256 /*! #video_process_tag */ 00257 video_process vp_param; 00258 int reserved[8]; 00259 } dvr_enc_src_param; 00260 00261 /** 00262 * @brief dvr encode channel parameter. 00263 */ 00264 typedef struct dvr_enc_channel_param_tag { 00265 dvr_enc_src_param src; 00266 ReproduceBitStream main_bs; 00267 }dvr_enc_channel_param; 00268 00269 typedef enum dvr_enc_channel_param_name_tag { 00270 ENC_PARAM_SRC_DIM, 00271 ENC_PARAM_DST_WIN 00272 }dvr_enc_channel_param_name; 00273 00274 /** 00275 * @brief get dvr encode buffer 00276 */ 00277 typedef struct dvr_enc_queue_get_tag { 00278 /*! #dvr_bs_data_tag */ 00279 dvr_bs_data bs; 00280 int new_bs; ///< To indicate whether the packet using new setting 00281 int mb_len; ///< Only for debug H.264: D1:103680 HD1:50688 CIF:25344 00282 int channel; ///< Only for debug H.264: sub ==> bs.stream 00283 }dvr_enc_queue_get; 00284 00285 00286 // Declaration for DVR_ENC_CONTROL 00287 enum dvr_enc_ctrl_cmd { 00288 ENC_START, 00289 ENC_STOP, 00290 ENC_SNAP, 00291 ENC_UPDATE, 00292 ENC_RAW 00293 }; 00294 00295 /** 00296 * @brief update dvr encode channel parameter 00297 */ 00298 typedef struct dvr_enc_update_channel_param_tag { 00299 struct 00300 { 00301 /*! #LiveviewFrameTypeTag */ 00302 int di_mode; 00303 /*! #LiveviewFrameModeTag */ 00304 int mode; 00305 /*! #LiveviewScalerRatioTag */ 00306 int scale_indep; 00307 /*! TRUE : enable 3D deinterlace , False : disable 3D deinterlace */ 00308 int is_3DI; 00309 /*! TRUE : enable 3D denoise , False : disable 3D denoise */ 00310 int is_denoise; 00311 int reserved[8]; 00312 } src; 00313 int stream_enable; ///< 0:disable, 1:enable 00314 int frame_rate; ///< frame rate per second 00315 int bit_rate; ///< Bitrate per second 00316 int ip_interval; ///< The I-P interval frames 00317 /*! #DIM_tag */ 00318 DIM dim; 00319 int init_quant; ///< The initial quant value 00320 int max_quant; ///< The max quant value 00321 int min_quant; ///< The min quant value 00322 /*! encode parameter extension size */ 00323 unsigned int ext_size; 00324 /*! point to encode parameter extension structure */ 00325 void *pext_data; 00326 int reserved[8]; 00327 } dvr_enc_update_channel_param; 00328 00329 /** 00330 * @brief dvr encode control parameter 00331 */ 00332 typedef struct dvr_enc_control_tag { 00333 int command; ///< enc control command , such as ENC_START, ENC_STOP, etc. 00334 union { 00335 int *count; 00336 int *repd_bs_num; ///< 0: all, 1: SUB1, 2: SUB2. 00337 }output; 00338 int stream; ///< stream number 0 : main, 1 : sub stream 1, 2 : sub stream 2 00339 /*! #dvr_enc_update_channel_param_tag */ 00340 dvr_enc_update_channel_param update_parm; 00341 int reserved[8]; 00342 }dvr_enc_control; 00343 00344 typedef struct dvr_enc_copy_buf_tag { 00345 /* provide the value by AP */ 00346 unsigned int bs_user_va; ///< bitstream user vitural address 00347 unsigned int mv_user_va; ///< MV user vitural address 0 means nocopy 00348 unsigned int bs_buf_length; ///< bitstream length by AP prepared, and return the real bitstream length 00349 unsigned int mv_buf_length; ///< motion length by AP prepared, and return the real motion length 00350 00351 /* return value by driver */ 00352 struct timeval timestamp; 00353 unsigned int bs_length; ///< bitstream length by AP prepared, and return the real bitstream length 00354 unsigned int mv_length; ///< motion length by AP prepared, and return the real motion length 00355 00356 unsigned int is_keyframe; ///< 1: current frame is a keyframe. 0: current frame is not a keyframe. 00357 int stream; 00358 int NonRef; 00359 int new_bs; ///< To indicate whether the packet using new setting 00360 void *p_job; ///< internal use 00361 int reserved[16]; 00362 } dvr_enc_copy_buf; 00363 00364 00365 #define POLLIN_MAIN_BS 0x0001 00366 #define POLLIN_SUB1_BS (POLLIN_MAIN_BS << 1) 00367 #define POLLIN_SUB2_BS (POLLIN_MAIN_BS << 2) 00368 #define POLLIN_SUB3_BS (POLLIN_MAIN_BS << 3) 00369 #define POLLIN_SUB4_BS (POLLIN_MAIN_BS << 4) 00370 #define POLLIN_SUB5_BS (POLLIN_MAIN_BS << 5) 00371 #define POLLIN_SUB6_BS (POLLIN_MAIN_BS << 6) 00372 #define POLLIN_SUB7_BS (POLLIN_MAIN_BS << 7) 00373 #define POLLIN_SUB8_BS (POLLIN_MAIN_BS << 8) 00374 #define POLLIN_SNAP_BS (1 << DVR_ENC_REPD_BT_NUM) 00375 00376 #define DVR_ENC_MAGIC 0x1689 00377 #define DVR_ENC_MAGIC_SHIFT 16 00378 #define DVR_ENC_MAGIC_ADD_VAL(val) ((DVR_ENC_MAGIC << DVR_ENC_MAGIC_SHIFT)|(val)) 00379 00380 #define DVR_ENC_CHECK_MAGIC(v) (((v)>>DVR_ENC_MAGIC_SHIFT)==DVR_ENC_MAGIC) 00381 #define DVR_ENC_GET_VALUE(v) ((v)&((1<<DVR_ENC_MAGIC_SHIFT)-1)) 00382 #define DVR_ENC_ENHANCE_H264_RATECONTROL 1 00383 #define DVR_ENC_MJPEG_FUNCTION (1 << 1) 00384 #define DVR_ENC_H264_WATERMARK (1 << 2) 00385 #define DVR_ENC_ROI_POS (1 << 3) 00386 #define DVR_ENC_ROI_ALL (1 << 4) 00387 00388 00389 #define DVR_ENC_EBST_ENABLE 0x55887799 00390 #define DVR_ENC_EBST_DISABLE 0x0 00391 #endif /* __DVR_ENC_API_H__ */ 00392 00393
Generated on Wed Jun 15 2011 15:51:00 for This describe GM8126 ioctl functions by 1.7.1