blob: 966bf088081a9bb20b1b4f2d5d9d867d6287d47c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef NAL_PARSER_H_
#define NAL_PARSER_H_
#include <stdlib.h>
#include "xine_internal.h"
#include "nal.h"
#include "dpb.h"
#define MAX_FRAME_SIZE 1024*1024
struct nal_parser {
uint8_t buf[MAX_FRAME_SIZE];
uint32_t buf_len;
/* prebuf is used to store the currently
* processed nal unit */
uint8_t prebuf[MAX_FRAME_SIZE];
uint32_t prebuf_len;
uint32_t next_nal_position;
uint8_t incomplete_nal;
uint8_t found_sps;
uint8_t found_pps;
uint8_t last_nal_res;
uint8_t is_idr;
int field; /* 0=top, 1=bottom, -1=both */
int slice;
int slice_cnt;
uint8_t have_top;
uint8_t have_frame;
struct nal_unit *nal0;
struct nal_unit *nal1;
struct nal_unit *current_nal;
struct nal_unit *last_nal;
uint8_t cpb_dpb_delays_present_flag;
uint32_t pic_order_cnt_lsb;
uint32_t pic_order_cnt_msb;
uint32_t prev_pic_order_cnt_lsb;
uint32_t prev_pic_order_cnt_msb;
/* this is dpb used for reference frame
* heading to vdpau + unordered frames
*/
struct dpb dpb;
};
int parse_nal(uint8_t *buf, int buf_len, struct nal_parser *parser);
int seek_for_nal(uint8_t *buf, int buf_len);
struct nal_parser* init_parser();
void free_parser(struct nal_parser *parser);
int parse_frame(struct nal_parser *parser, uint8_t *inbuf, int inbuf_len,
uint8_t **ret_buf, uint32_t *ret_len, uint32_t *ret_slice_cnt);
#endif
|