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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3231>
This commit is contained in:
Tong Wu 2022-10-17 16:48:15 +08:00 committed by GStreamer Marge Bot
parent abe47f3fa0
commit 86d22b2e38
5 changed files with 12 additions and 11 deletions

View file

@ -75,6 +75,10 @@ mfxStatus gst_msdk_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl);
void gst_msdk_set_frame_allocator (GstMsdkContext * context); 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 G_END_DECLS
#endif /* GST_MSDK_ALLOCATOR_H_ */ #endif /* GST_MSDK_ALLOCATOR_H_ */

View file

@ -764,9 +764,10 @@ _get_va_surface (GstBuffer * buf, GstVideoInfo * info,
return va_surface; return va_surface;
} }
/* Currently parameter map_flag is not useful on Linux */
GstMsdkSurface * GstMsdkSurface *
gst_msdk_import_to_msdk_surface (GstBuffer * buf, GstMsdkContext * msdk_context, gst_msdk_import_to_msdk_surface (GstBuffer * buf, GstMsdkContext * msdk_context,
GstVideoInfo * vinfo) GstVideoInfo * vinfo, guint map_flag)
{ {
VASurfaceID va_surface = VA_INVALID_ID; VASurfaceID va_surface = VA_INVALID_ID;
GstMemory *mem = NULL; GstMemory *mem = NULL;

View file

@ -45,10 +45,6 @@ gboolean
gst_msdk_export_dmabuf_to_vasurface (GstMsdkContext *context, gst_msdk_export_dmabuf_to_vasurface (GstMsdkContext *context,
GstVideoInfo *vinfo, gint fd, VASurfaceID *surface_id); GstVideoInfo *vinfo, gint fd, VASurfaceID *surface_id);
GstMsdkSurface *
gst_msdk_import_to_msdk_surface (GstBuffer * buf, GstMsdkContext * msdk_context,
GstVideoInfo * vinfo);
gboolean gboolean
gst_msdk_replace_mfx_memid (GstMsdkContext *context, gst_msdk_replace_mfx_memid (GstMsdkContext *context,
mfxFrameSurface1 *mfx_surface, VASurfaceID surface_id); mfxFrameSurface1 *mfx_surface, VASurfaceID surface_id);

View file

@ -1658,7 +1658,7 @@ gst_msdkenc_get_surface_from_pool (GstMsdkEnc * thiz, GstBufferPool * pool,
} }
#ifndef _WIN32 #ifndef _WIN32
msdk_surface = gst_msdk_import_to_msdk_surface (new_buffer, thiz->context, msdk_surface = gst_msdk_import_to_msdk_surface (new_buffer, thiz->context,
&thiz->aligned_info); &thiz->aligned_info, 0);
#else #else
msdk_surface = msdk_surface =
gst_msdk_import_sys_mem_to_msdk_surface (new_buffer, thiz->aligned_info); 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 #ifndef _WIN32
msdk_surface = gst_msdk_import_to_msdk_surface (inbuf, thiz->context, msdk_surface = gst_msdk_import_to_msdk_surface (inbuf, thiz->context,
&thiz->input_state->info); &thiz->input_state->info, 0);
if (msdk_surface) { if (msdk_surface) {
msdk_surface->buf = gst_buffer_ref (inbuf); msdk_surface->buf = gst_buffer_ref (inbuf);
return msdk_surface; return msdk_surface;

View file

@ -734,7 +734,7 @@ get_surface_from_pool (GstMsdkVPP * thiz, GstBufferPool * pool,
} }
#ifndef _WIN32 #ifndef _WIN32
msdk_surface = gst_msdk_import_to_msdk_surface (new_buffer, thiz->context, msdk_surface = gst_msdk_import_to_msdk_surface (new_buffer, thiz->context,
&thiz->sinkpad_info); &thiz->sinkpad_info, 0);
#else #else
msdk_surface = gst_msdk_import_sys_mem_to_msdk_surface msdk_surface = gst_msdk_import_sys_mem_to_msdk_surface
(new_buffer, thiz->sinkpad_buffer_pool_info); (new_buffer, thiz->sinkpad_buffer_pool_info);
@ -760,7 +760,7 @@ get_msdk_surface_from_input_buffer (GstMsdkVPP * thiz, GstBuffer * inbuf)
} }
#ifndef _WIN32 #ifndef _WIN32
msdk_surface = gst_msdk_import_to_msdk_surface (inbuf, thiz->context, msdk_surface = gst_msdk_import_to_msdk_surface (inbuf, thiz->context,
&thiz->sinkpad_info); &thiz->sinkpad_info, 0);
if (msdk_surface) { if (msdk_surface) {
msdk_surface->buf = gst_buffer_ref (inbuf); msdk_surface->buf = gst_buffer_ref (inbuf);
return msdk_surface; return msdk_surface;
@ -846,7 +846,7 @@ gst_msdkvpp_transform (GstBaseTransform * trans, GstBuffer * inbuf,
} else { } else {
#ifndef _WIN32 #ifndef _WIN32
out_surface = gst_msdk_import_to_msdk_surface (outbuf, thiz->context, out_surface = gst_msdk_import_to_msdk_surface (outbuf, thiz->context,
&thiz->srcpad_info); &thiz->srcpad_info, 0);
#else #else
out_surface = out_surface =
gst_msdk_import_sys_mem_to_msdk_surface (outbuf, thiz->srcpad_info); 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 #ifndef _WIN32
out_surface = out_surface =
gst_msdk_import_to_msdk_surface (outbuf_new, thiz->context, gst_msdk_import_to_msdk_surface (outbuf_new, thiz->context,
&thiz->srcpad_buffer_pool_info); &thiz->srcpad_buffer_pool_info, 0);
#else #else
out_surface = out_surface =
gst_msdk_import_sys_mem_to_msdk_surface (outbuf_new, gst_msdk_import_sys_mem_to_msdk_surface (outbuf_new,