45 const uint8_t *buf = start + 1;
46 int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
48 uint64_t payload_len_tmp;
53 flags = bytestream2_get_byte(&gb);
54 start_trim_flag = (
flags >> 4) & 1;
55 end_trim_flag = (
flags >> 3) & 1;
56 control_extension_flag = (
flags >> 2) & 1;
58 payload_len_tmp = *payload_len = 0;
59 while (bytestream2_peek_byte(&gb) == 0xff)
60 payload_len_tmp += bytestream2_get_byte(&gb);
62 payload_len_tmp += bytestream2_get_byte(&gb);
68 if (control_extension_flag) {
69 control_extension_length = bytestream2_get_byte(&gb);
76 *payload_len = payload_len_tmp;
86 const uint8_t *buf,
int buf_size,
int *header_len)
90 int ret, start_found,
i = 0, payload_len = 0;
91 const uint8_t *payload;
104 if (!
s->ts_framing && buf_size > 2) {
110 if (
s->ts_framing && !start_found) {
111 for (
i = 0;
i < buf_size-2;
i++) {
119 *header_len = payload - buf;
127 payload_len = buf_size;
129 if (avctx->
extradata && !
s->extradata_parsed) {
136 s->extradata_parsed = 1;
139 if (payload_len <= buf_size && (!
s->ts_framing || start_found)) {
152 if (payload_len + *header_len <= buf_size) {
155 return payload_len + *header_len;
168 const uint8_t **poutbuf,
int *poutbuf_size,
169 const uint8_t *buf,
int buf_size)
173 int next, header_len;
190 *poutbuf = buf + header_len;
191 *poutbuf_size = buf_size - header_len;