1 #ifndef AVC_FUNCTION_H
2 #define AVC_FUNCTION_H
3 
4 
5 struct avc_ctx
6 {
7 	unsigned char cc_count;
8 	// buffer to hold cc data
9 	unsigned char *cc_data;
10 	long cc_databufsize;
11 	int cc_buffer_saved; // Was the CC buffer saved after it was last updated?
12 
13 	int got_seq_para;
14 	unsigned nal_ref_idc;
15 	LLONG seq_parameter_set_id;
16 	int log2_max_frame_num;
17 	int pic_order_cnt_type;
18 	int log2_max_pic_order_cnt_lsb;
19 	int frame_mbs_only_flag;
20 
21 	// Use and throw stats for debug, remove this ugliness soon
22 	long num_nal_unit_type_7;
23 	long num_vcl_hrd;
24 	long num_nal_hrd;
25 	long num_jump_in_frames;
26 	long num_unexpected_sei_length;
27 
28 	int ccblocks_in_avc_total;
29 	int ccblocks_in_avc_lost;
30 
31 	LLONG frame_num;
32 	LLONG lastframe_num;
33 	int currref;
34 	int maxidx;
35 	int lastmaxidx;
36 
37 	// Used to find tref zero in PTS mode
38 	int minidx;
39 	int lastminidx;
40 
41 	// Used to remember the max temporal reference number (poc mode)
42 	int maxtref;
43 	int last_gop_maxtref;
44 
45 	// Used for PTS ordering of CC blocks
46 	LLONG currefpts;
47 	LLONG last_pic_order_cnt_lsb;
48 	LLONG last_slice_pts;
49 };
50 
51 struct avc_ctx *init_avc(void);
52 void dinit_avc(struct avc_ctx **ctx);
53 void do_NAL (struct lib_cc_decode *ctx, unsigned char *NAL_start, LLONG NAL_length, struct cc_subtitle *sub);
54 size_t process_avc(struct lib_cc_decode *ctx, unsigned char *avcbuf, size_t avcbuflen, struct cc_subtitle *sub);
55 #endif
56