From 86d22b2e38318b9b00746379f7b9321e961dca15 Mon Sep 17 00:00:00 2001 From: Tong Wu Date: Mon, 17 Oct 2022 16:48:15 +0800 Subject: [PATCH] msdkallocator: add a parameter to function gst_msdk_import_to_msdk_surface Add a flags parameter to function gst_msdk_import_to_msdk_surface and move the function declaration to gstmsdkallcator.h to prepare for adding Windows implementation. Part-of: --- subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator.h | 4 ++++ subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.c | 3 ++- subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.h | 4 ---- subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c | 4 ++-- subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator.h b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator.h index 9035b54..9a4106d 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator.h +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator.h @@ -75,6 +75,10 @@ mfxStatus gst_msdk_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl); void gst_msdk_set_frame_allocator (GstMsdkContext * context); +GstMsdkSurface * +gst_msdk_import_to_msdk_surface (GstBuffer * buf, GstMsdkContext * msdk_context, + GstVideoInfo * vinfo, guint map_flag); + G_END_DECLS #endif /* GST_MSDK_ALLOCATOR_H_ */ diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.c index 22c7ebb..b1a2d29 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.c @@ -764,9 +764,10 @@ _get_va_surface (GstBuffer * buf, GstVideoInfo * info, return va_surface; } +/* Currently parameter map_flag is not useful on Linux */ GstMsdkSurface * gst_msdk_import_to_msdk_surface (GstBuffer * buf, GstMsdkContext * msdk_context, - GstVideoInfo * vinfo) + GstVideoInfo * vinfo, guint map_flag) { VASurfaceID va_surface = VA_INVALID_ID; GstMemory *mem = NULL; diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.h b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.h index fa25821..da2f4d3 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.h +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.h @@ -45,10 +45,6 @@ gboolean gst_msdk_export_dmabuf_to_vasurface (GstMsdkContext *context, GstVideoInfo *vinfo, gint fd, VASurfaceID *surface_id); -GstMsdkSurface * -gst_msdk_import_to_msdk_surface (GstBuffer * buf, GstMsdkContext * msdk_context, - GstVideoInfo * vinfo); - gboolean gst_msdk_replace_mfx_memid (GstMsdkContext *context, mfxFrameSurface1 *mfx_surface, VASurfaceID surface_id); diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c index a137693..e8ef40a 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c @@ -1658,7 +1658,7 @@ gst_msdkenc_get_surface_from_pool (GstMsdkEnc * thiz, GstBufferPool * pool, } #ifndef _WIN32 msdk_surface = gst_msdk_import_to_msdk_surface (new_buffer, thiz->context, - &thiz->aligned_info); + &thiz->aligned_info, 0); #else msdk_surface = gst_msdk_import_sys_mem_to_msdk_surface (new_buffer, thiz->aligned_info); @@ -1686,7 +1686,7 @@ gst_msdkenc_get_surface_from_frame (GstMsdkEnc * thiz, } #ifndef _WIN32 msdk_surface = gst_msdk_import_to_msdk_surface (inbuf, thiz->context, - &thiz->input_state->info); + &thiz->input_state->info, 0); if (msdk_surface) { msdk_surface->buf = gst_buffer_ref (inbuf); return msdk_surface; diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c index 89ab7ac..121ed06 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c @@ -734,7 +734,7 @@ get_surface_from_pool (GstMsdkVPP * thiz, GstBufferPool * pool, } #ifndef _WIN32 msdk_surface = gst_msdk_import_to_msdk_surface (new_buffer, thiz->context, - &thiz->sinkpad_info); + &thiz->sinkpad_info, 0); #else msdk_surface = gst_msdk_import_sys_mem_to_msdk_surface (new_buffer, thiz->sinkpad_buffer_pool_info); @@ -760,7 +760,7 @@ get_msdk_surface_from_input_buffer (GstMsdkVPP * thiz, GstBuffer * inbuf) } #ifndef _WIN32 msdk_surface = gst_msdk_import_to_msdk_surface (inbuf, thiz->context, - &thiz->sinkpad_info); + &thiz->sinkpad_info, 0); if (msdk_surface) { msdk_surface->buf = gst_buffer_ref (inbuf); return msdk_surface; @@ -846,7 +846,7 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf, } else { #ifndef _WIN32 out_surface = gst_msdk_import_to_msdk_surface (outbuf, thiz->context, - &thiz->srcpad_info); + &thiz->srcpad_info, 0); #else out_surface = gst_msdk_import_sys_mem_to_msdk_surface (outbuf, thiz->srcpad_info); @@ -940,7 +940,7 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf, #ifndef _WIN32 out_surface = gst_msdk_import_to_msdk_surface (outbuf_new, thiz->context, - &thiz->srcpad_buffer_pool_info); + &thiz->srcpad_buffer_pool_info, 0); #else out_surface = gst_msdk_import_sys_mem_to_msdk_surface (outbuf_new, -- 2.7.4