| 400 | } |
| 401 | |
| 402 | static int xan_decode_frame(AVCodecContext *avctx, AVFrame *rframe, |
| 403 | int *got_frame, AVPacket *avpkt) |
| 404 | { |
| 405 | XanContext *s = avctx->priv_data; |
| 406 | int ftype; |
| 407 | int ret; |
| 408 | |
| 409 | if ((ret = ff_reget_buffer(avctx, s->pic, 0)) < 0) |
| 410 | return ret; |
| 411 | |
| 412 | bytestream2_init(&s->gb, avpkt->data, avpkt->size); |
| 413 | ftype = bytestream2_get_le32(&s->gb); |
| 414 | switch (ftype) { |
| 415 | case 0: |
| 416 | ret = xan_decode_frame_type0(avctx); |
| 417 | break; |
| 418 | case 1: |
| 419 | ret = xan_decode_frame_type1(avctx); |
| 420 | break; |
| 421 | default: |
| 422 | av_log(avctx, AV_LOG_ERROR, "Unknown frame type %d\n", ftype); |
| 423 | return AVERROR_INVALIDDATA; |
| 424 | } |
| 425 | if (ret) |
| 426 | return ret; |
| 427 | |
| 428 | if ((ret = av_frame_ref(rframe, s->pic)) < 0) |
| 429 | return ret; |
| 430 | |
| 431 | *got_frame = 1; |
| 432 | |
| 433 | return avpkt->size; |
| 434 | } |
| 435 | |
| 436 | const FFCodec ff_xan_wc4_decoder = { |
| 437 | .p.name = "xan_wc4", |
nothing calls this directly
no test coverage detected