44 const uint8_t *buf = start + 1;
45 int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
47 uint64_t payload_len_tmp;
52 flags = bytestream2_get_byte(&gb);
53 start_trim_flag = (
flags >> 4) & 1;
54 end_trim_flag = (
flags >> 3) & 1;
55 control_extension_flag = (
flags >> 2) & 1;
57 payload_len_tmp = *payload_len = 0;
58 while (bytestream2_peek_byte(&gb) == 0xff)
59 payload_len_tmp += bytestream2_get_byte(&gb);
61 payload_len_tmp += bytestream2_get_byte(&gb);
67 if (control_extension_flag) {
68 control_extension_length = bytestream2_get_byte(&gb);
75 *payload_len = payload_len_tmp;
85 const uint8_t *buf,
int buf_size,
int *header_len)
89 int ret, start_found,
i = 0, payload_len = 0;
90 const uint8_t *payload;
103 if (!
s->ts_framing && buf_size > 2) {
109 if (
s->ts_framing && !start_found) {
110 for (
i = 0;
i < buf_size-2;
i++) {
118 *header_len = payload - buf;
126 payload_len = buf_size;
128 if (avctx->
extradata && !
s->extradata_parsed) {
135 s->extradata_parsed = 1;
138 if (payload_len <= buf_size && (!
s->ts_framing || start_found)) {
151 if (payload_len + *header_len <= buf_size) {
154 return payload_len + *header_len;
167 const uint8_t **poutbuf,
int *poutbuf_size,
168 const uint8_t *buf,
int buf_size)
172 int next, header_len;
189 *poutbuf = buf + header_len;
190 *poutbuf_size = buf_size - header_len;