On 2013-03-04 11:35:05 +0100, Anton Khirnov wrote:
> ---
> libavutil/Makefile | 2 +
> libavutil/buffer.c | 194 ++++++++++++++++++++++++++++++++++++++++++
> libavutil/buffer.h | 195
> +++++++++++++++++++++++++++++++++++++++++++
> libavutil/buffer_internal.h | 60 +++++++++++++
> 4 files changed, 451 insertions(+)
> create mode 100644 libavutil/buffer.c
> create mode 100644 libavutil/buffer.h
> create mode 100644 libavutil/buffer_internal.h
>
> diff --git a/libavutil/Makefile b/libavutil/Makefile
> index 4406b13..ef29d5c 100644
> --- a/libavutil/Makefile
> +++ b/libavutil/Makefile
> @@ -11,6 +11,7 @@ HEADERS = adler32.h
> \
> base64.h \
> blowfish.h \
> bswap.h \
> + buffer.h \
> channel_layout.h \
> common.h \
> cpu.h \
> @@ -59,6 +60,7 @@ OBJS = adler32.o
> \
> avstring.o \
> base64.o \
> blowfish.o \
> + buffer.o \
> channel_layout.o \
> cpu.o \
> crc.o \
> diff --git a/libavutil/buffer.c b/libavutil/buffer.c
> new file mode 100644
> index 0000000..44262f1
> --- /dev/null
> +++ b/libavutil/buffer.c
> @@ -0,0 +1,194 @@
> +/*
> + * This file is part of Libav.
> + *
> + * Libav is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * Libav is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with Libav; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
> USA
> + */
> +
> +#include <stdint.h>
> +#include <string.h>
> +
> +#include "atomic.h"
> +#include "buffer_internal.h"
> +#include "common.h"
> +#include "mem.h"
> +
> +AVBufferRef *av_buffer_create(uint8_t *data, int size,
> + void (*free)(void *opaque, uint8_t *data),
> + void *opaque, int flags)
> +{
> + AVBufferRef *ref = NULL;
> + AVBuffer *buf = NULL;
> +
> + buf = av_mallocz(sizeof(*buf));
> + if (!buf)
> + return NULL;
> +
> + buf->data = data;
> + buf->size = size;
> + buf->free = free;
since I've spotted it in the buffer pool patch. please check and set
av_buffer_default_free if free is NULL
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel