plugins: use plugin base macros to access pad specific data
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Tue, 29 Oct 2019 22:13:44 +0000 (15:13 -0700)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 11 Dec 2019 21:27:48 +0000 (21:27 +0000)
Don't access base struct fields directly since the underlying
definition can change.  Instead, use the accessor macros.

gst/vaapi/gstvaapidecode.c
gst/vaapi/gstvaapiencode.c
gst/vaapi/gstvaapipluginbase.h
gst/vaapi/gstvaapipostproc.c

index f4798f2..3acfe4f 100644 (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;
 
index d833f79..46b4737 100644 (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
index 9faa063..774c4c3 100644 (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)
 
index 82c6b5f..d40f399 100644 (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