diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c index 13852182e8..d6bef367b8 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c @@ -1430,7 +1430,7 @@ _va_map_unlocked (GstVaMemory * mem, GstMapFlags flags) goto fail; } - if (!va_map_buffer (display, mem->image.buf, &mem->mapped_data)) + if (!va_map_buffer (display, mem->image.buf, flags, &mem->mapped_data)) goto fail; success: diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.c b/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.c index 5c5005ae7b..4155ab3987 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.c @@ -242,12 +242,22 @@ va_sync_surface (GstVaDisplay * display, VASurfaceID surface) } gboolean -va_map_buffer (GstVaDisplay * display, VABufferID buffer, gpointer * data) +va_map_buffer (GstVaDisplay * display, VABufferID buffer, GstMapFlags flags, + gpointer * data) { VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; +#if VA_CHECK_VERSION(1, 21, 0) + uint32_t vaflags = 0; + if (flags & GST_MAP_READ) + vaflags |= VA_MAPBUFFER_FLAG_READ; + if (flags & GST_MAP_WRITE) + vaflags |= VA_MAPBUFFER_FLAG_WRITE; + status = vaMapBuffer2 (dpy, buffer, data, vaflags); +#else status = vaMapBuffer (dpy, buffer, data); +#endif if (status != VA_STATUS_SUCCESS) { GST_WARNING ("vaMapBuffer: %s", vaErrorStr (status)); return FALSE; diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.h b/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.h index 80cc51f3f4..c3e2bf8fcf 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/vasurfaceimage.h @@ -88,6 +88,7 @@ gboolean va_ensure_image (GstVaDisplay * displa GST_VA_API gboolean va_map_buffer (GstVaDisplay * display, VABufferID buffer, + GstMapFlags flags, gpointer * data); GST_VA_API gboolean va_unmap_buffer (GstVaDisplay * display, diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c index 15f0d7655d..4e42a4a8cf 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c @@ -288,7 +288,7 @@ gst_va_base_enc_create_output_buffer (GstVaBaseEnc * base, seg_list = NULL; if (!va_map_buffer (base->display, picture->coded_buffer, - (gpointer *) & seg_list)) + GST_MAP_READ, (gpointer *) & seg_list)) goto error; if (!seg_list) {