From b384593d3d7a6ac5e300768340ecd4def6ed7d51 Mon Sep 17 00:00:00 2001 From: "U. Artie Eoff" Date: Tue, 29 Oct 2019 15:13:44 -0700 Subject: [PATCH] plugins: use plugin base macros to access pad specific data Don't access base struct fields directly since the underlying definition can change. Instead, use the accessor macros. --- gst/vaapi/gstvaapidecode.c | 12 ++++++++---- gst/vaapi/gstvaapiencode.c | 2 +- gst/vaapi/gstvaapipluginbase.h | 8 ++++++++ gst/vaapi/gstvaapipostproc.c | 9 +++++---- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index f4798f2..3acfe4f 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -499,7 +499,9 @@ is_src_allocator_dmabuf (GstVaapiDecode * decode) if (!GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAN_DMABUF (plugin)) return FALSE; - return gst_vaapi_is_dmabuf_allocator (plugin->srcpad_allocator); + return + gst_vaapi_is_dmabuf_allocator (GST_VAAPI_PLUGIN_BASE_SRC_PAD_ALLOCATOR + (plugin)); } static GstFlowReturn @@ -596,9 +598,11 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec, GstBuffer *sys_buf, *va_buf; va_buf = out_frame->output_buffer; - sys_buf = gst_buffer_new_allocate (plugin->other_srcpad_allocator, - GST_VIDEO_INFO_SIZE (&plugin->srcpad_info), - &plugin->other_allocator_params); + sys_buf = + gst_buffer_new_allocate (GST_VAAPI_PLUGIN_BASE_OTHER_ALLOCATOR + (plugin), + GST_VIDEO_INFO_SIZE (GST_VAAPI_PLUGIN_BASE_SRC_PAD_INFO (plugin)), + &GST_VAAPI_PLUGIN_BASE_OTHER_ALLOCATOR_PARAMS (plugin)); if (!sys_buf) goto error_no_sys_buffer; diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index d833f79..46b4737 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -888,7 +888,7 @@ gst_vaapiencode_init (GstVaapiEncode * encode) GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (encode); gst_vaapi_plugin_base_init (GST_VAAPI_PLUGIN_BASE (encode), GST_CAT_DEFAULT); - gst_pad_use_fixed_caps (plugin->srcpad); + gst_pad_use_fixed_caps (GST_VAAPI_PLUGIN_BASE_SRC_PAD (plugin)); } static void diff --git a/gst/vaapi/gstvaapipluginbase.h b/gst/vaapi/gstvaapipluginbase.h index 9faa063..774c4c3 100644 --- a/gst/vaapi/gstvaapipluginbase.h +++ b/gst/vaapi/gstvaapipluginbase.h @@ -85,6 +85,14 @@ typedef struct _GstVaapiPluginBaseClass GstVaapiPluginBaseClass; (&GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_info) #define GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAN_DMABUF(plugin) \ (GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_can_dmabuf) +#define GST_VAAPI_PLUGIN_BASE_SRC_PAD_BUFFER_POOL(plugin) \ + (GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_buffer_pool) +#define GST_VAAPI_PLUGIN_BASE_SRC_PAD_ALLOCATOR(plugin) \ + (GST_VAAPI_PLUGIN_BASE(plugin)->srcpad_allocator) +#define GST_VAAPI_PLUGIN_BASE_OTHER_ALLOCATOR(plugin) \ + (GST_VAAPI_PLUGIN_BASE(plugin)->other_srcpad_allocator) +#define GST_VAAPI_PLUGIN_BASE_OTHER_ALLOCATOR_PARAMS(plugin) \ + (GST_VAAPI_PLUGIN_BASE(plugin)->other_allocator_params) #define GST_VAAPI_PLUGIN_BASE_COPY_OUTPUT_FRAME(plugin) \ (GST_VAAPI_PLUGIN_BASE(plugin)->copy_output_frame) diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 82c6b5f..d40f399 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -379,7 +379,7 @@ create_output_buffer (GstVaapiPostproc * postproc) GstBuffer *outbuf; GstBufferPool *const pool = - GST_VAAPI_PLUGIN_BASE (postproc)->srcpad_buffer_pool; + GST_VAAPI_PLUGIN_BASE_SRC_PAD_BUFFER_POOL (postproc); GstFlowReturn ret; g_return_val_if_fail (pool != NULL, NULL); @@ -412,9 +412,10 @@ create_output_dump_buffer (GstVaapiPostproc * postproc) { GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (postproc); - return gst_buffer_new_allocate (plugin->other_srcpad_allocator, - GST_VIDEO_INFO_SIZE (&plugin->srcpad_info), - &plugin->other_allocator_params); + return + gst_buffer_new_allocate (GST_VAAPI_PLUGIN_BASE_OTHER_ALLOCATOR (plugin), + GST_VIDEO_INFO_SIZE (GST_VAAPI_PLUGIN_BASE_SRC_PAD_INFO (plugin)), + &GST_VAAPI_PLUGIN_BASE_OTHER_ALLOCATOR_PARAMS (plugin)); } static void -- 2.7.4