44 int start_trim_flag, end_trim_flag, control_extension_flag, control_extension_length;
50 flags = bytestream2_get_byte(&gb);
51 start_trim_flag = (flags >> 4) & 1;
52 end_trim_flag = (flags >> 3) & 1;
53 control_extension_flag = (flags >> 2) & 1;
56 while (bytestream2_peek_byte(&gb) == 0xff)
57 *payload_len += bytestream2_get_byte(&gb);
59 *payload_len += bytestream2_get_byte(&gb);
65 if (control_extension_flag) {
66 control_extension_length = bytestream2_get_byte(&gb);
78 const uint8_t *
buf,
int buf_size,
int *header_len)
82 int ret, start_found, i = 0, payload_len = 0;
103 for (i = 0; i < buf_size-2; i++) {
104 state = (state << 8) | payload[i];
107 *header_len = payload -
buf;
115 payload_len = buf_size;
127 if (payload_len <= buf_size && (!s->
ts_framing || start_found)) {
140 if (payload_len + *header_len <= buf_size) {
143 return payload_len + *header_len;
156 const uint8_t **poutbuf,
int *poutbuf_size,
161 int next, header_len;
178 *poutbuf = buf + header_len;
179 *poutbuf_size = buf_size - header_len;