From b2001c1ca58985f1dc44d1bdfe3601e377b0c0a7 Mon Sep 17 00:00:00 2001 From: Mengkejiergeli Ba Date: Mon, 22 Aug 2022 17:44:35 +0800 Subject: [PATCH] msdk: Add a bufferpool in GstMsdkContext structure This alloc_pool is the negotiated pool and will be used in mfxFrameAllocator:Alloc to create surfaces. Part-of: --- .../gst-plugins-bad/sys/msdk/gstmsdkcontext.c | 13 +++++++++++++ .../gst-plugins-bad/sys/msdk/gstmsdkcontext.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c index 60cc61d339..df7bc6f26b 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.c @@ -48,6 +48,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_debug_msdkcontext); struct _GstMsdkContextPrivate { MsdkSession session; + GstBufferPool *alloc_pool; GList *cached_alloc_responses; gboolean hardware; gboolean has_frame_allocator; @@ -917,6 +918,18 @@ gst_msdk_context_put_surface_available (GstMsdkContext * context, g_mutex_unlock (&priv->mutex); } +void +gst_msdk_context_set_alloc_pool (GstMsdkContext * context, GstBufferPool * pool) +{ + context->priv->alloc_pool = gst_object_ref (pool); +} + +GstBufferPool * +gst_msdk_context_get_alloc_pool (GstMsdkContext * context) +{ + return context->priv->alloc_pool; +} + GstMsdkContextJobType gst_msdk_context_get_job_type (GstMsdkContext * context) { diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.h b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.h index 88746bd101..cee5541ee1 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.h +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkcontext.h @@ -144,6 +144,12 @@ gst_msdk_context_put_surface_locked (GstMsdkContext * context, mfxFrameAllocResp void gst_msdk_context_put_surface_available (GstMsdkContext * context, mfxFrameAllocResponse * resp, mfxFrameSurface1 * surface); +void +gst_msdk_context_set_alloc_pool (GstMsdkContext * context, GstBufferPool * pool); + +GstBufferPool * +gst_msdk_context_get_alloc_pool (GstMsdkContext * context); + GstMsdkContextJobType gst_msdk_context_get_job_type (GstMsdkContext * context);