- #ifndef _MP4_HEADER_H_
- #define _MP4_HEADER_H_
- #define VO_START_CODE 0x8
- #define VOL_START_CODE 0x12
- #define GOP_START_CODE 0x1b3
- #define VOP_START_CODE 0x1b6
- #define I_VOP 0
- #define P_VOP 1
- #define B_VOP 2
- #define RECTANGULAR 0
- #define BINARY 1
- #define BINARY_SHAPE_ONLY 2
- #define GRAY_SCALE 3
- #define STATIC_SPRITE 1
- #define USER_DATA_START_CODE 0x01b2
- #define NOT_CODED -1
- #define INTER 0
- #define INTER_Q 1
- #define INTER4V 2
- #define INTRA 3
- #define INTRA_Q 4
- #define STUFFING 7
- /*** *** ***/
- // mpeg4格式的数据结构定义
- typedef struct _mp4_header {
- // 视频对象层(vol:Video Object Layer)
- int ident;
- int random_accessible_vol;
- int type_indication;
- int is_object_layer_identifier;
- int visual_object_layer_verid;
- int visual_object_layer_priority;
- int aspect_ratio_info;
- int vol_control_parameters;
- int chroma_format;
- int low_delay;
- int vbv_parameters;
- int first_half_bit_rate;
- int latter_half_bit_rate;
- int first_half_vbv_buffer_size;
- int latter_half_vbv_buffer_size;
- int first_half_vbv_occupancy;
- int latter_half_vbv_occupancy;
- int shape;
- int time_increment_resolution;
- int fixed_vop_rate;
- int fixed_vop_time_increment;
- int width;
- int height;
- int interlaced;
- int obmc_disable;
- int sprite_usage;
- int not_8_bit;
- int quant_precision;
- int bits_per_pixel;
- int quant_type;
- int load_intra_quant_matrix;
- int load_nonintra_quant_matrix;
- int quarter_pixel;
- int complexity_estimation_disable;
- int error_res_disable;
- int data_partitioning;
- int intra_acdc_pred_disable;
- int scalability;
- // 图像组(gop:Group of Pictures)
- int time_code;
- int closed_gov;
- int broken_link;
- // 视频对象层(vop:Video Object Plane)
- int prediction_type;
- int time_base;
- int time_inc;
- int vop_coded;
- int rounding_type;
- int hor_spat_ref;
- int ver_spat_ref;
- int change_CR_disable;
- int constant_alpha;
- int constant_alpha_value;
- int intra_dc_vlc_thr;
- int quantizer;
- int fcode_for;
- int shape_coding_type;
- // 宏块(macroblock)
- int not_coded;
- int mcbpc;
- int derived_mb_type;
- int cbpc;
- int ac_pred_flag;
- int cbpy;
- int dquant;
- int cbp;
- // 额外的或导出的(extra/derived)
- int mba_size;
- int mb_xsize;
- int mb_ysize;
- int picnum;
- int mba;
- int mb_xpos;
- int mb_ypos;
- int dc_scaler;
- int intrablock_rescaled;
- } mp4_header;
- /*** *** ***/
- extern int getvolhdr();
- extern int getgophdr();
- extern int getvophdr();
- extern int __inline nextbits(int nbits);
- extern int __inline bytealigned(int nbits);
- extern void __inline next_start_code();
- extern int __inline nextbits_bytealigned(int nbit);
- #endif // _MP4_HEADER_H_