mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-22 10:23:47 +00:00
plugins: factor out GstImplementsInterface.
This commit is contained in:
parent
fad3f538bc
commit
e5f066b719
8 changed files with 54 additions and 125 deletions
|
@ -95,24 +95,6 @@ static GstStaticPadTemplate gst_vaapidecode_src_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapidecode_src_caps_str));
|
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 */
|
/* GstVideoContext interface */
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
static void
|
static void
|
||||||
|
@ -136,10 +118,7 @@ G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiDecode,
|
GstVaapiDecode,
|
||||||
gst_vaapidecode,
|
gst_vaapidecode,
|
||||||
GST_TYPE_VIDEO_DECODER,
|
GST_TYPE_VIDEO_DECODER,
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
|
|
||||||
gst_vaapidecode_implements_iface_init);
|
|
||||||
#endif
|
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
||||||
gst_video_context_interface_init)
|
gst_video_context_interface_init)
|
||||||
|
|
|
@ -91,22 +91,6 @@ struct _GstVaapiDownloadClass {
|
||||||
GstVaapiPluginBaseClass parent_class;
|
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 */
|
/* GstVideoContext interface */
|
||||||
static void
|
static void
|
||||||
gst_vaapidownload_set_video_context(GstVideoContext *context, const gchar *type,
|
gst_vaapidownload_set_video_context(GstVideoContext *context, const gchar *type,
|
||||||
|
@ -127,8 +111,7 @@ G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiDownload,
|
GstVaapiDownload,
|
||||||
gst_vaapidownload,
|
gst_vaapidownload,
|
||||||
GST_TYPE_BASE_TRANSFORM,
|
GST_TYPE_BASE_TRANSFORM,
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
||||||
gst_vaapidownload_implements_iface_init);
|
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
||||||
gst_video_context_interface_init))
|
gst_video_context_interface_init))
|
||||||
|
|
||||||
|
|
|
@ -42,22 +42,6 @@
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_vaapiencode_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_vaapiencode_debug);
|
||||||
#define GST_CAT_DEFAULT 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 */
|
/* GstContext interface */
|
||||||
#if GST_CHECK_VERSION(1,1,0)
|
#if GST_CHECK_VERSION(1,1,0)
|
||||||
static void
|
static void
|
||||||
|
@ -93,10 +77,7 @@ gst_video_context_interface_init (GstVideoContextInterface * iface)
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstVaapiEncode,
|
G_DEFINE_TYPE_WITH_CODE (GstVaapiEncode,
|
||||||
gst_vaapiencode, GST_TYPE_VIDEO_ENCODER,
|
gst_vaapiencode, GST_TYPE_VIDEO_ENCODER,
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
|
|
||||||
gst_vaapiencode_implements_iface_init);
|
|
||||||
#endif
|
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_CONTEXT,
|
G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_CONTEXT,
|
||||||
gst_video_context_interface_init)
|
gst_video_context_interface_init)
|
||||||
|
|
|
@ -29,6 +29,38 @@
|
||||||
/* Default debug category is from the subclass */
|
/* Default debug category is from the subclass */
|
||||||
#define GST_CAT_DEFAULT (plugin->debug_category)
|
#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
|
static void
|
||||||
default_display_changed (GstVaapiPluginBase * plugin)
|
default_display_changed (GstVaapiPluginBase * plugin)
|
||||||
{
|
{
|
||||||
|
@ -37,6 +69,7 @@ default_display_changed (GstVaapiPluginBase * plugin)
|
||||||
void
|
void
|
||||||
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass)
|
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass)
|
||||||
{
|
{
|
||||||
|
klass->has_interface = default_has_interface;
|
||||||
klass->display_changed = default_display_changed;
|
klass->display_changed = default_display_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +78,6 @@ gst_vaapi_plugin_base_init (GstVaapiPluginBase * plugin,
|
||||||
GstDebugCategory * debug_category)
|
GstDebugCategory * debug_category)
|
||||||
{
|
{
|
||||||
plugin->debug_category = debug_category;
|
plugin->debug_category = debug_category;
|
||||||
|
|
||||||
plugin->display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
|
plugin->display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
|
||||||
plugin->display_type_req = GST_VAAPI_DISPLAY_TYPE_ANY;
|
plugin->display_type_req = GST_VAAPI_DISPLAY_TYPE_ANY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,9 @@ typedef struct _GstVaapiPluginBaseClass GstVaapiPluginBaseClass;
|
||||||
#define GST_VAAPI_PLUGIN_BASE_SINK_CLASS(plugin) \
|
#define GST_VAAPI_PLUGIN_BASE_SINK_CLASS(plugin) \
|
||||||
(&GST_VAAPI_PLUGIN_BASE_PARENT_CLASS(plugin)->sink)
|
(&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) \
|
#define GST_VAAPI_PLUGIN_BASE_DISPLAY(plugin) \
|
||||||
(GST_VAAPI_PLUGIN_BASE(plugin)->display)
|
(GST_VAAPI_PLUGIN_BASE(plugin)->display)
|
||||||
#define GST_VAAPI_PLUGIN_BASE_DISPLAY_TYPE(plugin) \
|
#define GST_VAAPI_PLUGIN_BASE_DISPLAY_TYPE(plugin) \
|
||||||
|
@ -107,9 +110,14 @@ struct _GstVaapiPluginBaseClass
|
||||||
GstVideoSinkClass sink;
|
GstVideoSinkClass sink;
|
||||||
} parent_class;
|
} parent_class;
|
||||||
|
|
||||||
|
gboolean (*has_interface) (GstVaapiPluginBase * plugin, GType type);
|
||||||
void (*display_changed) (GstVaapiPluginBase * plugin);
|
void (*display_changed) (GstVaapiPluginBase * plugin);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
void
|
||||||
|
gst_vaapi_plugin_base_init_interfaces (GType type);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass);
|
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass);
|
||||||
|
|
|
@ -89,24 +89,6 @@ static GstStaticPadTemplate gst_vaapipostproc_src_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapipostproc_src_caps_str));
|
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 */
|
/* GstVideoContext interface */
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
static void
|
static void
|
||||||
|
@ -137,10 +119,7 @@ G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiPostproc,
|
GstVaapiPostproc,
|
||||||
gst_vaapipostproc,
|
gst_vaapipostproc,
|
||||||
GST_TYPE_BASE_TRANSFORM,
|
GST_TYPE_BASE_TRANSFORM,
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
|
|
||||||
gst_vaapipostproc_implements_iface_init);
|
|
||||||
#endif
|
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
||||||
gst_video_context_interface_init)
|
gst_video_context_interface_init)
|
||||||
|
|
|
@ -107,25 +107,6 @@ static GstStaticPadTemplate gst_vaapisink_sink_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapisink_sink_caps_str));
|
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 */
|
/* GstVideoContext interface */
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
static void
|
static void
|
||||||
|
@ -143,6 +124,12 @@ gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_vaapisink_has_interface(GstVaapiPluginBase *plugin, GType type)
|
||||||
|
{
|
||||||
|
return type == GST_TYPE_VIDEO_OVERLAY;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapisink_video_overlay_iface_init(GstVideoOverlayInterface *iface);
|
gst_vaapisink_video_overlay_iface_init(GstVideoOverlayInterface *iface);
|
||||||
|
|
||||||
|
@ -150,10 +137,7 @@ G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiSink,
|
GstVaapiSink,
|
||||||
gst_vaapisink,
|
gst_vaapisink,
|
||||||
GST_TYPE_VIDEO_SINK,
|
GST_TYPE_VIDEO_SINK,
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
|
|
||||||
gst_vaapisink_implements_iface_init);
|
|
||||||
#endif
|
|
||||||
#if !GST_CHECK_VERSION(1,1,0)
|
#if !GST_CHECK_VERSION(1,1,0)
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
||||||
gst_vaapisink_video_context_iface_init);
|
gst_vaapisink_video_context_iface_init);
|
||||||
|
@ -1489,6 +1473,7 @@ gst_vaapisink_class_init(GstVaapiSinkClass *klass)
|
||||||
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
|
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
|
||||||
|
|
||||||
gst_vaapi_plugin_base_class_init(base_plugin_class);
|
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;
|
base_plugin_class->display_changed = gst_vaapisink_display_changed;
|
||||||
|
|
||||||
object_class->finalize = gst_vaapisink_finalize;
|
object_class->finalize = gst_vaapisink_finalize;
|
||||||
|
|
|
@ -68,23 +68,6 @@ static GstStaticPadTemplate gst_vaapiupload_src_factory =
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str));
|
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 */
|
/* GstVideoContext interface */
|
||||||
static void
|
static void
|
||||||
gst_vaapiupload_set_video_context(GstVideoContext *context, const gchar *type,
|
gst_vaapiupload_set_video_context(GstVideoContext *context, const gchar *type,
|
||||||
|
@ -110,8 +93,7 @@ G_DEFINE_TYPE_WITH_CODE(
|
||||||
GstVaapiUpload,
|
GstVaapiUpload,
|
||||||
gst_vaapiupload,
|
gst_vaapiupload,
|
||||||
GST_TYPE_BASE_TRANSFORM,
|
GST_TYPE_BASE_TRANSFORM,
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
|
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES
|
||||||
gst_vaapiupload_implements_iface_init);
|
|
||||||
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
|
||||||
gst_video_context_interface_init))
|
gst_video_context_interface_init))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue