On 2/11/2018 3:14 PM, Mark Thompson wrote:
> +int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx,
> + CodedBitstreamUnit *unit,
> + size_t size,
> + void (*free)(void *opaque, uint8_t *data))
> +{
> + av_assert0(!unit->content && !unit->content_ref);
> +
> + unit->content = av_mallocz(size);
> + if (!unit->content)
> + return AVERROR(ENOMEM);
> +
> + unit->content_ref = av_buffer_create(unit->content, size,
> + free ? free
> + : &av_buffer_default_free,
av_buffer_create() defaults to av_buffer_default_free() on its own if
free is NULL, so no need to do it here.
> + ctx, 0);
> + if (!unit->content_ref) {
> + av_freep(&unit->content);
> + return AVERROR(ENOMEM);
> + }
> +
> + return 0;
> +}
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel