44 int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
46 uint64_t payload_len_tmp;
51 flags = bytestream2_get_byte(&gb);
52 start_trim_flag = (
flags >> 4) & 1;
53 end_trim_flag = (
flags >> 3) & 1;
54 control_extension_flag = (
flags >> 2) & 1;
56 payload_len_tmp = *payload_len = 0;
57 while (bytestream2_peek_byte(&gb) == 0xff)
58 payload_len_tmp += bytestream2_get_byte(&gb);
60 payload_len_tmp += bytestream2_get_byte(&gb);
66 if (control_extension_flag) {
67 control_extension_length = bytestream2_get_byte(&gb);
74 *payload_len = payload_len_tmp;
84 const uint8_t *buf,
int buf_size,
int *header_len)
88 int ret, start_found,
i = 0, payload_len = 0;
102 if (!
s->ts_framing && buf_size > 2) {
108 if (
s->ts_framing && !start_found) {
109 for (
i = 0;
i < buf_size-2;
i++) {
117 *header_len = payload - buf;
125 payload_len = buf_size;
127 if (avctx->
extradata && !
s->extradata_parsed) {
134 s->extradata_parsed = 1;
137 if (payload_len <= buf_size && (!
s->ts_framing || start_found)) {
150 if (payload_len + *header_len <= buf_size) {
153 return payload_len + *header_len;
166 const uint8_t **poutbuf,
int *poutbuf_size,
167 const uint8_t *buf,
int buf_size)
171 int next, header_len;
188 *poutbuf = buf + header_len;
189 *poutbuf_size = buf_size - header_len;