37 const uint8_t *buf,
int buf_size)
40 const uint8_t *buf_end = buf + buf_size;
42 int frame_rate_index, ext_type, bytes_left;
43 int frame_rate_ext_n, frame_rate_ext_d;
44 int top_field_first, repeat_first_field, progressive_frame;
45 int horiz_size_ext, vert_size_ext, bit_rate_ext;
50 while (buf < buf_end) {
53 bytes_left = buf_end - buf;
56 if (bytes_left >= 2) {
61 if (bytes_left >= 7) {
62 pc->
width = (buf[0] << 4) | (buf[1] >> 4);
63 pc->
height = ((buf[1] & 0x0f) << 8) | buf[2];
68 frame_rate_index = buf[3] & 0xf;
71 avctx->
bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
76 if (bytes_left >= 1) {
77 ext_type = (buf[0] >> 4);
80 if (bytes_left >= 6) {
81 horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7);
82 vert_size_ext = (buf[2] >> 5) & 3;
83 bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1);
84 frame_rate_ext_n = (buf[5] >> 5) & 3;
85 frame_rate_ext_d = (buf[5] & 0x1f);
89 pc->
width |=(horiz_size_ext << 12);
90 pc->
height |=( vert_size_ext << 12);
91 avctx->
bit_rate += (bit_rate_ext << 18) * 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) {
146 const uint8_t **poutbuf,
int *poutbuf_size,
147 const uint8_t *buf,
int buf_size)
169 av_dlog(
NULL,
"pict_type=%d frame_rate=%0.3f repeat_pict=%d\n",
173 *poutbuf_size = buf_size;
178 const uint8_t *buf,
int buf_size)
183 for(i=0; i<buf_size; i++){
184 state= (state<<8) | buf[i];
185 if(state != 0x1B3 && state != 0x1B5 && state < 0x200 && state >= 0x100)