On Tue, Nov 22, 2016 at 8:36 AM, Anton Khirnov <[email protected]> wrote:
> +
> +int ff_alloc_packet(AVPacket *avpkt, int size)
> +{
> +    if (size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
> +        return AVERROR(EINVAL);
> +
> +    if (avpkt->data) {
> +        AVBufferRef *buf = avpkt->buf;
> +
> +        if (avpkt->size < size)
> +            return AVERROR(EINVAL);
> +
> +        av_init_packet(avpkt);
> +        avpkt->buf      = buf;
> +        avpkt->size     = size;
> +        return 0;
> +    } else {
> +        return av_new_packet(avpkt, size);
> +    }
> +}

could this maybe be moved to avpacket.c later on?
-- 
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to