| 1616 | } |
| 1617 | |
| 1618 | static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame) |
| 1619 | { |
| 1620 | if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { |
| 1621 | int i; |
| 1622 | int num_planes = av_pix_fmt_count_planes(frame->format); |
| 1623 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); |
| 1624 | int flags = desc ? desc->flags : 0; |
| 1625 | if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL)) |
| 1626 | num_planes = 2; |
| 1627 | for (i = 0; i < num_planes; i++) { |
| 1628 | av_assert0(frame->data[i]); |
| 1629 | } |
| 1630 | // For formats without data like hwaccel allow unused pointers to be non-NULL. |
| 1631 | for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) { |
| 1632 | if (frame->data[i]) |
| 1633 | av_log(avctx, AV_LOG_ERROR, "Buffer returned by get_buffer2() did not zero unused plane pointers\n"); |
| 1634 | frame->data[i] = NULL; |
| 1635 | } |
| 1636 | } |
| 1637 | } |
| 1638 | |
| 1639 | static void decode_data_free(AVRefStructOpaque unused, void *obj) |
| 1640 | { |
no test coverage detected