| 121 | } |
| 122 | |
| 123 | static int cavs_parse_frame(AVCodecParserContext *s, AVCodecContext *avctx, |
| 124 | const uint8_t *buf, int buf_size) |
| 125 | { |
| 126 | GetBitContext gb; |
| 127 | const uint8_t *buf_end; |
| 128 | const uint8_t *buf_ptr; |
| 129 | uint32_t stc = -1; |
| 130 | |
| 131 | s->key_frame = 0; |
| 132 | s->pict_type = AV_PICTURE_TYPE_NONE; |
| 133 | |
| 134 | if (buf_size == 0) |
| 135 | return 0; |
| 136 | |
| 137 | buf_ptr = buf; |
| 138 | buf_end = buf + buf_size; |
| 139 | for (;;) { |
| 140 | buf_ptr = avpriv_find_start_code(buf_ptr, buf_end, &stc); |
| 141 | if ((stc & 0xFFFFFE00) || buf_ptr == buf_end) |
| 142 | return 0; |
| 143 | switch (stc) { |
| 144 | case CAVS_START_CODE: |
| 145 | if (init_get_bits8(&gb, buf_ptr, buf_end - buf_ptr) < 0) |
| 146 | return 0; |
| 147 | parse_seq_header(s, avctx, &gb); |
| 148 | break; |
| 149 | case PIC_I_START_CODE: |
| 150 | s->key_frame = 1; |
| 151 | s->pict_type = AV_PICTURE_TYPE_I; |
| 152 | break; |
| 153 | default: |
| 154 | break; |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | static int cavsvideo_parse(AVCodecParserContext *s, |
| 160 | AVCodecContext *avctx, |
no test coverage detected