From 9e7665b21b530cbbfeb187521dc9db78c2ca60db Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 23 Jul 2017 09:31:27 +0200 Subject: mp_image: expose some image allocation code as helpers, refactor Refactor the image allocation code, and expose part of it as helper code. This aims towards allowing callers to easily allocate mp_image references from custom-allocated linear buffers. This is exposing only as much as what should be actually required. --- video/mp_image.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'video/mp_image.h') diff --git a/video/mp_image.h b/video/mp_image.h index 56ce2257f4..e949b9b81f 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -104,6 +104,12 @@ typedef struct mp_image { int mp_chroma_div_up(int size, int shift); +int mp_image_get_alloc_size(int imgfmt, int w, int h, int stride_align); +struct mp_image *mp_image_from_buffer(int imgfmt, int w, int h, int stride_align, + uint8_t *buffer, int buffer_size, + void *free_opaque, + void (*free)(void *opaque, uint8_t *data)); + struct mp_image *mp_image_alloc(int fmt, int w, int h); void mp_image_copy(struct mp_image *dmpi, struct mp_image *mpi); void mp_image_copy_gpu(struct mp_image *dst, struct mp_image *src); -- cgit v1.2.3