28 const uint8_t *buf,
int buf_size)
31 const uint8_t *buf_end = buf + buf_size;
34 int frame_rate_ext_n, frame_rate_ext_d;
36 int horiz_size_ext, vert_size_ext, bit_rate_ext;
41 while (buf < buf_end) {
44 bytes_left = buf_end - buf;
47 if (bytes_left >= 2) {
52 if (bytes_left >= 7) {
53 pc->
width = (buf[0] << 4) | (buf[1] >> 4);
54 pc->
height = ((buf[1] & 0x0f) << 8) | buf[2];
59 frame_rate_index = buf[3] & 0xf;
62 avctx->
bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
68 if (bytes_left >= 1) {
69 ext_type = (buf[0] >> 4);
72 if (bytes_left >= 6) {
73 horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7);
74 vert_size_ext = (buf[2] >> 5) & 3;
75 bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1);
76 frame_rate_ext_n = (buf[5] >> 5) & 3;
77 frame_rate_ext_d = (buf[5] & 0x1f);
81 pc->
width |=(horiz_size_ext << 12);
82 pc->
height |=( vert_size_ext << 12);
85 if (bit_rate_ext < INT_MAX / 400 &&
86 bit_rate_ext * 400 < INT_MAX - avctx->
bit_rate) {
87 avctx->
bit_rate += bit_rate_ext * 400;
100 if (bytes_left >= 5) {
101 top_field_first = buf[3] & (1 << 7);
102 repeat_first_field = buf[3] & (1 << 1);
103 progressive_frame = buf[4] & (1 << 7);
107 if (repeat_first_field) {
113 }
else if (progressive_frame) {
138 const uint8_t **poutbuf,
int *poutbuf_size,
139 const uint8_t *buf,
int buf_size)
161 av_dlog(
NULL,
"pict_type=%d frame_rate=%0.3f repeat_pict=%d\n",
165 *poutbuf_size = buf_size;
170 const uint8_t *buf,
int buf_size)
175 for(i=0; i<buf_size; i++){
176 state= (state<<8) | buf[i];
177 if(state != 0x1B3 && state != 0x1B5 && state < 0x200 && state >= 0x100)