diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/mp_image.c | 13 | ||||
-rw-r--r-- | video/mp_image.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index b5780b08a0..f846b0d3d3 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -265,6 +265,19 @@ struct mp_image *mp_image_alloc(int imgfmt, int w, int h) return mpi; } +int mp_image_approx_byte_size(struct mp_image *img) +{ + int total = sizeof(*img); + + for (int n = 0; n < MP_MAX_PLANES; n++) { + struct AVBufferRef *buf = img->bufs[n]; + if (buf) + total += buf->size; + } + + return total; +} + struct mp_image *mp_image_new_copy(struct mp_image *img) { struct mp_image *new = mp_image_alloc(img->imgfmt, img->w, img->h); diff --git a/video/mp_image.h b/video/mp_image.h index d321a27285..4727ed6f8d 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -163,6 +163,8 @@ void mp_image_setfmt(mp_image_t* mpi, int out_fmt); void mp_image_steal_data(struct mp_image *dst, struct mp_image *src); void mp_image_unref_data(struct mp_image *img); +int mp_image_approx_byte_size(struct mp_image *img); + struct mp_image *mp_image_new_dummy_ref(struct mp_image *img); struct mp_image *mp_image_new_custom_ref(struct mp_image *img, void *arg, void (*free)(void *arg)); |