| 1693 | } |
| 1694 | |
| 1695 | static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame) |
| 1696 | { |
| 1697 | #if CONFIG_LIBLCEVC_DEC |
| 1698 | AVCodecInternal *avci = avctx->internal; |
| 1699 | DecodeContext *dc = decode_ctx(avci); |
| 1700 | |
| 1701 | if (dc->lcevc.frame) { |
| 1702 | FrameDecodeData *fdd = frame->private_ref; |
| 1703 | FFLCEVCFrame *frame_ctx; |
| 1704 | int ret; |
| 1705 | |
| 1706 | if (!dc->lcevc.width || !dc->lcevc.height) { |
| 1707 | dc->lcevc.frame = 0; |
| 1708 | return 0; |
| 1709 | } |
| 1710 | |
| 1711 | frame_ctx = av_mallocz(sizeof(*frame_ctx)); |
| 1712 | if (!frame_ctx) |
| 1713 | return AVERROR(ENOMEM); |
| 1714 | |
| 1715 | frame_ctx->frame = av_frame_alloc(); |
| 1716 | if (!frame_ctx->frame) { |
| 1717 | av_free(frame_ctx); |
| 1718 | return AVERROR(ENOMEM); |
| 1719 | } |
| 1720 | |
| 1721 | frame_ctx->lcevc = av_refstruct_ref(dc->lcevc.ctx); |
| 1722 | frame_ctx->frame->width = dc->lcevc.width; |
| 1723 | frame_ctx->frame->height = dc->lcevc.height; |
| 1724 | frame_ctx->frame->format = frame->format; |
| 1725 | |
| 1726 | frame->width = dc->lcevc.base_width; |
| 1727 | frame->height = dc->lcevc.base_height; |
| 1728 | |
| 1729 | ret = avctx->get_buffer2(avctx, frame_ctx->frame, 0); |
| 1730 | if (ret < 0) { |
| 1731 | ff_lcevc_unref(frame_ctx); |
| 1732 | return ret; |
| 1733 | } |
| 1734 | |
| 1735 | validate_avframe_allocation(avctx, frame_ctx->frame); |
| 1736 | |
| 1737 | fdd->post_process_opaque = frame_ctx; |
| 1738 | fdd->post_process_opaque_free = ff_lcevc_unref; |
| 1739 | fdd->post_process = ff_lcevc_process; |
| 1740 | } |
| 1741 | dc->lcevc.frame = 0; |
| 1742 | #endif |
| 1743 | |
| 1744 | return 0; |
| 1745 | } |
| 1746 | |
| 1747 | int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) |
| 1748 | { |
no test coverage detected