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.
This commit is contained in:
U. Artie Eoff 2019-10-29 15:13:44 -07:00 committed by GStreamer Merge Bot
parent f4fc37ccc5
commit b384593d3d
4 changed files with 22 additions and 9 deletions

View file

@ -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;

View file

@ -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

View file

@ -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)

View file

@ -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