GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapidecode_src_caps_str));
-/* GstImplementsInterface interface */
-#if !GST_CHECK_VERSION(1,0,0)
-static gboolean
-gst_vaapidecode_implements_interface_supported(
- GstImplementsInterface *iface,
- GType type
-)
-{
- return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapidecode_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
- iface->supported = gst_vaapidecode_implements_interface_supported;
-}
-#endif
-
/* GstVideoContext interface */
#if !GST_CHECK_VERSION(1,1,0)
static void
GstVaapiDecode,
gst_vaapidecode,
GST_TYPE_VIDEO_DECODER,
-#if !GST_CHECK_VERSION(1,0,0)
- G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
- gst_vaapidecode_implements_iface_init);
-#endif
+ GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
#if !GST_CHECK_VERSION(1,1,0)
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init)
GstVaapiPluginBaseClass parent_class;
};
-/* GstImplementsInterface interface */
-static gboolean
-gst_vaapidownload_implements_interface_supported(
- GstImplementsInterface *iface,
- GType type
-)
-{
- return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapidownload_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
- iface->supported = gst_vaapidownload_implements_interface_supported;
-}
-
/* GstVideoContext interface */
static void
gst_vaapidownload_set_video_context(GstVideoContext *context, const gchar *type,
GstVaapiDownload,
gst_vaapidownload,
GST_TYPE_BASE_TRANSFORM,
- G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
- gst_vaapidownload_implements_iface_init);
+ GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init))
GST_DEBUG_CATEGORY_STATIC (gst_vaapiencode_debug);
#define GST_CAT_DEFAULT gst_vaapiencode_debug
-/* GstImplementsInterface interface */
-#if !GST_CHECK_VERSION(1,0,0)
-static gboolean
-gst_vaapiencode_implements_interface_supported (GstImplementsInterface * iface,
- GType type)
-{
- return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapiencode_implements_iface_init (GstImplementsInterfaceClass * iface)
-{
- iface->supported = gst_vaapiencode_implements_interface_supported;
-}
-#endif
-
/* GstContext interface */
#if GST_CHECK_VERSION(1,1,0)
static void
G_DEFINE_TYPE_WITH_CODE (GstVaapiEncode,
gst_vaapiencode, GST_TYPE_VIDEO_ENCODER,
-#if !GST_CHECK_VERSION(1,0,0)
- G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
- gst_vaapiencode_implements_iface_init);
-#endif
+ GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
#if !GST_CHECK_VERSION(1,1,0)
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init)
/* Default debug category is from the subclass */
#define GST_CAT_DEFAULT (plugin->debug_category)
+/* GstImplementsInterface interface */
+#if !GST_CHECK_VERSION(1,0,0)
+static gboolean
+implements_interface_supported (GstImplementsInterface * iface, GType type)
+{
+ GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (iface);
+
+ return GST_VAAPI_PLUGIN_BASE_GET_CLASS (plugin)->has_interface (plugin, type);
+}
+
+static void
+implements_interface_init (GstImplementsInterfaceClass * iface)
+{
+ iface->supported = implements_interface_supported;
+}
+#endif
+
+void
+gst_vaapi_plugin_base_init_interfaces (GType g_define_type_id)
+{
+#if !GST_CHECK_VERSION(1,0,0)
+ G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
+ implements_interface_init);
+#endif
+}
+
+static gboolean
+default_has_interface (GstVaapiPluginBase * plugin, GType type)
+{
+ return FALSE;
+}
+
static void
default_display_changed (GstVaapiPluginBase * plugin)
{
void
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass)
{
+ klass->has_interface = default_has_interface;
klass->display_changed = default_display_changed;
}
GstDebugCategory * debug_category)
{
plugin->debug_category = debug_category;
-
plugin->display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
plugin->display_type_req = GST_VAAPI_DISPLAY_TYPE_ANY;
}
#define GST_VAAPI_PLUGIN_BASE_SINK_CLASS(plugin) \
(&GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin)->sink)
+#define GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES \
+ gst_vaapi_plugin_base_init_interfaces(g_define_type_id);
+
#define GST_VAAPI_PLUGIN_BASE_DISPLAY(plugin) \
(GST_VAAPI_PLUGIN_BASE(plugin)->display)
#define GST_VAAPI_PLUGIN_BASE_DISPLAY_TYPE(plugin) \
GstVideoSinkClass sink;
} parent_class;
+ gboolean (*has_interface) (GstVaapiPluginBase * plugin, GType type);
void (*display_changed) (GstVaapiPluginBase * plugin);
};
G_GNUC_INTERNAL
void
+gst_vaapi_plugin_base_init_interfaces (GType type);
+
+G_GNUC_INTERNAL
+void
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass);
G_GNUC_INTERNAL
GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapipostproc_src_caps_str));
-/* GstImplementsInterface interface */
-#if !GST_CHECK_VERSION(1,0,0)
-static gboolean
-gst_vaapipostproc_implements_interface_supported(
- GstImplementsInterface *iface,
- GType type
-)
-{
- return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapipostproc_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
- iface->supported = gst_vaapipostproc_implements_interface_supported;
-}
-#endif
-
/* GstVideoContext interface */
#if !GST_CHECK_VERSION(1,1,0)
static void
GstVaapiPostproc,
gst_vaapipostproc,
GST_TYPE_BASE_TRANSFORM,
-#if !GST_CHECK_VERSION(1,0,0)
- G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
- gst_vaapipostproc_implements_iface_init);
-#endif
+ GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
#if !GST_CHECK_VERSION(1,1,0)
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init)
GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapisink_sink_caps_str));
-/* GstImplementsInterface interface */
-#if !GST_CHECK_VERSION(1,0,0)
-static gboolean
-gst_vaapisink_implements_interface_supported(
- GstImplementsInterface *iface,
- GType type
-)
-{
- return (type == GST_TYPE_VIDEO_CONTEXT ||
- type == GST_TYPE_VIDEO_OVERLAY);
-}
-
-static void
-gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
- iface->supported = gst_vaapisink_implements_interface_supported;
-}
-#endif
-
/* GstVideoContext interface */
#if !GST_CHECK_VERSION(1,1,0)
static void
}
#endif
+static gboolean
+gst_vaapisink_has_interface(GstVaapiPluginBase *plugin, GType type)
+{
+ return type == GST_TYPE_VIDEO_OVERLAY;
+}
+
static void
gst_vaapisink_video_overlay_iface_init(GstVideoOverlayInterface *iface);
GstVaapiSink,
gst_vaapisink,
GST_TYPE_VIDEO_SINK,
-#if !GST_CHECK_VERSION(1,0,0)
- G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
- gst_vaapisink_implements_iface_init);
-#endif
+ GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
#if !GST_CHECK_VERSION(1,1,0)
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_vaapisink_video_context_iface_init);
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
gst_vaapi_plugin_base_class_init(base_plugin_class);
+ base_plugin_class->has_interface = gst_vaapisink_has_interface;
base_plugin_class->display_changed = gst_vaapisink_display_changed;
object_class->finalize = gst_vaapisink_finalize;
GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str));
-
-/* GstImplementsInterface interface */
-static gboolean
-gst_vaapiupload_implements_interface_supported(
- GstImplementsInterface *iface,
- GType type
-)
-{
- return (type == GST_TYPE_VIDEO_CONTEXT);
-}
-
-static void
-gst_vaapiupload_implements_iface_init(GstImplementsInterfaceClass *iface)
-{
- iface->supported = gst_vaapiupload_implements_interface_supported;
-}
-
/* GstVideoContext interface */
static void
gst_vaapiupload_set_video_context(GstVideoContext *context, const gchar *type,
GstVaapiUpload,
gst_vaapiupload,
GST_TYPE_BASE_TRANSFORM,
- G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
- gst_vaapiupload_implements_iface_init);
+ GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init))