summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-02-20 13:15:50 +0100
committerwm4 <wm4@nowhere>2017-02-20 13:15:50 +0100
commitfefc5a8f735a62f3dd317fd18e51e33959c07690 (patch)
treea799fa43126866c596739cca4ad9f3e262aa8a41 /video/mp_image.c
parent79272e1469a591e753240b5e8e7a3069194759da (diff)
downloadmpv-fefc5a8f735a62f3dd317fd18e51e33959c07690.tar.bz2
mpv-fefc5a8f735a62f3dd317fd18e51e33959c07690.tar.xz
lavfi: use mp_image to store the filter pad format
Preparation for enabling hw filters. mp_image_params can't have an AVHWFramesContext reference (because it can't hold any allocations, and isn't meant to hold "active" data in the first place. So just use a mp_image. It has all real data removed, because that would essentially leak 1 frame once the decoder or renderer don't need it anymore.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index e4e6ffa266..7e0dd173b7 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -177,6 +177,17 @@ void mp_image_steal_data(struct mp_image *dst, struct mp_image *src)
talloc_free(src);
}
+// Unref most data buffer (and clear the data array), but leave other fields
+// allocated. In particular, mp_image.hwctx is preserved.
+void mp_image_unref_data(struct mp_image *img)
+{
+ for (int n = 0; n < MP_MAX_PLANES; n++) {
+ img->planes[n] = NULL;
+ img->stride[n] = 0;
+ av_buffer_unref(&img->bufs[n]);
+ }
+}
+
// Return a new reference to img. The returned reference is owned by the caller,
// while img is left untouched.
struct mp_image *mp_image_new_ref(struct mp_image *img)