36 const uint8_t *buf,
int buf_size)
39 const uint8_t *buf_end = buf + buf_size;
41 int frame_rate_index, ext_type, bytes_left;
42 int frame_rate_ext_n, frame_rate_ext_d;
43 int top_field_first, repeat_first_field, progressive_frame;
44 int horiz_size_ext, vert_size_ext, bit_rate_ext;
51 while (buf < buf_end) {
54 bytes_left = buf_end - buf;
57 if (bytes_left >= 2) {
60 vbv_delay = ((buf[1] & 0x07) << 13) | (buf[2] << 5) | (buf[3] >> 3);
64 if (bytes_left >= 7) {
65 pc->
width = (buf[0] << 4) | (buf[1] >> 4);
66 pc->
height = ((buf[1] & 0x0f) << 8) | buf[2];
71 frame_rate_index = buf[3] & 0xf;
74 bit_rate = (buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6);
79 if (bytes_left >= 1) {
80 ext_type = (buf[0] >> 4);
83 if (bytes_left >= 6) {
84 horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7);
85 vert_size_ext = (buf[2] >> 5) & 3;
86 bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1);
87 frame_rate_ext_n = (buf[5] >> 5) & 3;
88 frame_rate_ext_d = (buf[5] & 0x1f);
92 pc->
width |=(horiz_size_ext << 12);
93 pc->
height |=( vert_size_ext << 12);
94 bit_rate = (bit_rate&0x3FFFF) | (bit_rate_ext << 18);
103 if (bytes_left >= 5) {
104 top_field_first = buf[3] & (1 << 7);
105 repeat_first_field = buf[3] & (1 << 1);
106 progressive_frame = buf[4] & (1 << 7);
110 if (repeat_first_field) {
116 }
else if (progressive_frame) {
140 (bit_rate != 0x3FFFF || vbv_delay != 0xFFFF)) {
147 const uint8_t **poutbuf,
int *poutbuf_size,
148 const uint8_t *buf,
int buf_size)
170 av_dlog(
NULL,
"pict_type=%d frame_rate=%0.3f repeat_pict=%d\n",
174 *poutbuf_size = buf_size;
179 const uint8_t *buf,
int buf_size)
185 for(i=0; i<buf_size; i++){
186 state= (state<<8) | buf[i];
189 }
else if(found && state != 0x1B5 && state < 0x200 && state >= 0x100)