| 81 | } |
| 82 | |
| 83 | int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int flags) |
| 84 | { |
| 85 | int ret; |
| 86 | |
| 87 | if (avpkt->size < 0 || avpkt->size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) |
| 88 | return AVERROR(EINVAL); |
| 89 | |
| 90 | if (avpkt->data || avpkt->buf) { |
| 91 | av_log(avctx, AV_LOG_ERROR, "avpkt->{data,buf} != NULL in avcodec_default_get_encode_buffer()\n"); |
| 92 | return AVERROR(EINVAL); |
| 93 | } |
| 94 | |
| 95 | ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE); |
| 96 | if (ret < 0) { |
| 97 | av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %d\n", avpkt->size); |
| 98 | return ret; |
| 99 | } |
| 100 | avpkt->data = avpkt->buf->data; |
| 101 | |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags) |
| 106 | { |
nothing calls this directly
no test coverage detected