| 208 | } |
| 209 | |
| 210 | static int dirac_parse(AVCodecParserContext *s, AVCodecContext *avctx, |
| 211 | const uint8_t **poutbuf, int *poutbuf_size, |
| 212 | const uint8_t *buf, int buf_size) |
| 213 | { |
| 214 | DiracParseContext *pc = s->priv_data; |
| 215 | int next; |
| 216 | |
| 217 | *poutbuf = NULL; |
| 218 | *poutbuf_size = 0; |
| 219 | |
| 220 | if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { |
| 221 | next = buf_size; |
| 222 | *poutbuf = buf; |
| 223 | *poutbuf_size = buf_size; |
| 224 | /* Assume that data has been packetized into an encapsulation unit. */ |
| 225 | } else { |
| 226 | next = find_frame_end(pc, buf, buf_size); |
| 227 | if (!pc->is_synced && next == -1) { |
| 228 | /* No frame start found yet. So throw away the entire buffer. */ |
| 229 | return buf_size; |
| 230 | } |
| 231 | |
| 232 | if (dirac_combine_frame(s, avctx, next, &buf, &buf_size) < 0) { |
| 233 | return buf_size; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | *poutbuf = buf; |
| 238 | *poutbuf_size = buf_size; |
| 239 | return next; |
| 240 | } |
| 241 | |
| 242 | static void dirac_parse_close(AVCodecParserContext *s) |
| 243 | { |
no test coverage detected