| 895 | } |
| 896 | |
| 897 | static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) |
| 898 | { |
| 899 | BinkContext * const c = avctx->priv_data; |
| 900 | GetBitContext gb; |
| 901 | int plane, plane_idx; |
| 902 | int bits_count = pkt->size << 3; |
| 903 | |
| 904 | if(c->pic.data[0]) |
| 905 | avctx->release_buffer(avctx, &c->pic); |
| 906 | |
| 907 | if(avctx->get_buffer(avctx, &c->pic) < 0){ |
| 908 | av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
| 909 | return -1; |
| 910 | } |
| 911 | |
| 912 | init_get_bits(&gb, pkt->data, bits_count); |
| 913 | if (c->has_alpha) { |
| 914 | if (c->version >= 'i') |
| 915 | skip_bits_long(&gb, 32); |
| 916 | if (bink_decode_plane(c, &gb, 3, 0) < 0) |
| 917 | return -1; |
| 918 | } |
| 919 | if (c->version >= 'i') |
| 920 | skip_bits_long(&gb, 32); |
| 921 | |
| 922 | for (plane = 0; plane < 3; plane++) { |
| 923 | plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); |
| 924 | |
| 925 | if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0) |
| 926 | return -1; |
| 927 | if (get_bits_count(&gb) >= bits_count) |
| 928 | break; |
| 929 | } |
| 930 | emms_c(); |
| 931 | |
| 932 | *data_size = sizeof(AVFrame); |
| 933 | *(AVFrame*)data = c->pic; |
| 934 | |
| 935 | FFSWAP(AVFrame, c->pic, c->last); |
| 936 | |
| 937 | /* always report that the buffer was completely consumed */ |
| 938 | return pkt->size; |
| 939 | } |
| 940 | |
| 941 | static av_cold int decode_init(AVCodecContext *avctx) |
| 942 | { |
nothing calls this directly
no test coverage detected