plugins: use G_DEFINE_TYPE_* instead of deprecated GST_BOILERPLATE_*.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Javier Jardón 2012-07-01 02:58:36 +09:00 committed by Gwenole Beauchesne
parent 187c503870
commit 2594aadb0e
6 changed files with 157 additions and 171 deletions

View file

@ -9,6 +9,15 @@ m4_if(gst_vaapi_pre_version, [0], [], [
m4_append([gst_vaapi_version], gst_vaapi_pre_version, [.pre])
])
# glib version number
m4_define([glib_major_version], [2])
m4_define([glib_minor_version], [4])
m4_define([glib_micro_version], [0])
m4_define([glib_major_minor_version],
[glib_major_version.glib_minor_version])
m4_define([glib_version],
[glib_major_version.glib_minor_version.glib_micro_version])
# gst version number
m4_define([gst_major_version], [0])
m4_define([gst_minor_version], [10])
@ -146,7 +155,7 @@ AC_SUBST(GTKDOC_VERSION)
dnl Check for GLib
AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
PKG_CHECK_MODULES([GLIB], [glib-2.0])
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= glib_version])
AC_CHECK_LIB([glib-2.0], [g_list_free_full], [
AC_DEFINE([HAVE_G_LIST_FREE_FULL], [1],
[Define to 1 if g_list_free_full() is available.])])

View file

@ -104,15 +104,16 @@ static GstStaticPadTemplate gst_vaapidecode_src_factory =
GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapidecode_src_caps_str));
static void
gst_video_context_interface_init(GstVideoContextInterface *iface);
#define GstVideoContextClass GstVideoContextInterface
GST_BOILERPLATE_WITH_INTERFACE(
G_DEFINE_TYPE_WITH_CODE(
GstVaapiDecode,
gst_vaapidecode,
GstElement,
GST_TYPE_ELEMENT,
GstVideoContext,
GST_TYPE_VIDEO_CONTEXT,
gst_video_context);
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init));
enum {
PROP_0,
@ -425,31 +426,6 @@ gst_video_context_interface_init(GstVideoContextInterface *iface)
iface->set_context = gst_vaapidecode_set_video_context;
}
static void
gst_vaapidecode_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
gst_element_class_set_details_simple(
element_class,
gst_vaapidecode_details.longname,
gst_vaapidecode_details.klass,
gst_vaapidecode_details.description,
gst_vaapidecode_details.author
);
/* sink pad */
pad_template = gst_static_pad_template_get(&gst_vaapidecode_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
pad_template = gst_static_pad_template_get(&gst_vaapidecode_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
}
static void
gst_vaapidecode_finalize(GObject *object)
{
@ -482,7 +458,7 @@ gst_vaapidecode_finalize(GObject *object)
decode->delayed_new_seg = NULL;
}
G_OBJECT_CLASS(parent_class)->finalize(object);
G_OBJECT_CLASS(gst_vaapidecode_parent_class)->finalize(object);
}
static void
@ -543,7 +519,7 @@ gst_vaapidecode_change_state(GstElement *element, GstStateChange transition)
break;
}
ret = GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
ret = GST_ELEMENT_CLASS(gst_vaapidecode_parent_class)->change_state(element, transition);
if (ret != GST_STATE_CHANGE_SUCCESS)
return ret;
@ -571,6 +547,7 @@ gst_vaapidecode_class_init(GstVaapiDecodeClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
GST_DEBUG_CATEGORY_INIT(gst_debug_vaapidecode,
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
@ -581,6 +558,24 @@ gst_vaapidecode_class_init(GstVaapiDecodeClass *klass)
element_class->change_state = gst_vaapidecode_change_state;
gst_element_class_set_details_simple(
element_class,
gst_vaapidecode_details.longname,
gst_vaapidecode_details.klass,
gst_vaapidecode_details.description,
gst_vaapidecode_details.author
);
/* sink pad */
pad_template = gst_static_pad_template_get(&gst_vaapidecode_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
pad_template = gst_static_pad_template_get(&gst_vaapidecode_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
#if USE_FFMPEG
g_object_class_install_property
(object_class,
@ -764,8 +759,9 @@ gst_vaapidecode_query (GstPad *pad, GstQuery *query) {
}
static void
gst_vaapidecode_init(GstVaapiDecode *decode, GstVaapiDecodeClass *klass)
gst_vaapidecode_init(GstVaapiDecode *decode)
{
GstVaapiDecodeClass *klass = GST_VAAPIDECODE_GET_CLASS(decode);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
decode->display = NULL;

View file

@ -108,15 +108,16 @@ struct _GstVaapiDownloadClass {
GstBaseTransformClass parent_class;
};
static void
gst_video_context_interface_init(GstVideoContextInterface *iface);
#define GstVideoContextClass GstVideoContextInterface
GST_BOILERPLATE_WITH_INTERFACE(
G_DEFINE_TYPE_WITH_CODE(
GstVaapiDownload,
gst_vaapidownload,
GstBaseTransform,
GST_TYPE_BASE_TRANSFORM,
GstVideoContext,
GST_TYPE_VIDEO_CONTEXT,
gst_video_context);
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init));
static gboolean
gst_vaapidownload_start(GstBaseTransform *trans);
@ -217,11 +218,33 @@ gst_vaapidownload_destroy(GstVaapiDownload *download)
}
static void
gst_vaapidownload_base_init(gpointer klass)
gst_vaapidownload_finalize(GObject *object)
{
gst_vaapidownload_destroy(GST_VAAPIDOWNLOAD(object));
G_OBJECT_CLASS(gst_vaapidownload_parent_class)->finalize(object);
}
static void
gst_vaapidownload_class_init(GstVaapiDownloadClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstBaseTransformClass * const trans_class = GST_BASE_TRANSFORM_CLASS(klass);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
GST_DEBUG_CATEGORY_INIT(gst_debug_vaapidownload,
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
object_class->finalize = gst_vaapidownload_finalize;
trans_class->start = gst_vaapidownload_start;
trans_class->stop = gst_vaapidownload_stop;
trans_class->before_transform = gst_vaapidownload_before_transform;
trans_class->transform = gst_vaapidownload_transform;
trans_class->transform_caps = gst_vaapidownload_transform_caps;
trans_class->transform_size = gst_vaapidownload_transform_size;
trans_class->set_caps = gst_vaapidownload_set_caps;
gst_element_class_set_details_simple(
element_class,
gst_vaapidownload_details.longname,
@ -242,34 +265,7 @@ gst_vaapidownload_base_init(gpointer klass)
}
static void
gst_vaapidownload_finalize(GObject *object)
{
gst_vaapidownload_destroy(GST_VAAPIDOWNLOAD(object));
G_OBJECT_CLASS(parent_class)->finalize(object);
}
static void
gst_vaapidownload_class_init(GstVaapiDownloadClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstBaseTransformClass * const trans_class = GST_BASE_TRANSFORM_CLASS(klass);
GST_DEBUG_CATEGORY_INIT(gst_debug_vaapidownload,
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
object_class->finalize = gst_vaapidownload_finalize;
trans_class->start = gst_vaapidownload_start;
trans_class->stop = gst_vaapidownload_stop;
trans_class->before_transform = gst_vaapidownload_before_transform;
trans_class->transform = gst_vaapidownload_transform;
trans_class->transform_caps = gst_vaapidownload_transform_caps;
trans_class->transform_size = gst_vaapidownload_transform_size;
trans_class->set_caps = gst_vaapidownload_set_caps;
}
static void
gst_vaapidownload_init(GstVaapiDownload *download, GstVaapiDownloadClass *klass)
gst_vaapidownload_init(GstVaapiDownload *download)
{
GstPad *sinkpad, *srcpad;

View file

@ -74,15 +74,16 @@ static GstStaticPadTemplate gst_vaapipostproc_src_factory =
GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapipostproc_src_caps_str));
static void
gst_video_context_interface_init(GstVideoContextInterface *iface);
#define GstVideoContextClass GstVideoContextInterface
GST_BOILERPLATE_WITH_INTERFACE(
G_DEFINE_TYPE_WITH_CODE(
GstVaapiPostproc,
gst_vaapipostproc,
GstElement,
GST_TYPE_ELEMENT,
GstVideoContext,
GST_TYPE_VIDEO_CONTEXT,
gst_video_context);
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init));
enum {
PROP_0,
@ -526,7 +527,7 @@ gst_vaapipostproc_finalize(GObject *object)
gst_caps_replace(&postproc->srcpad_caps, NULL);
gst_caps_replace(&postproc->allowed_caps, NULL);
G_OBJECT_CLASS(parent_class)->finalize(object);
G_OBJECT_CLASS(gst_vaapipostproc_parent_class)->finalize(object);
}
static void
@ -594,7 +595,7 @@ gst_vaapipostproc_change_state(GstElement *element, GstStateChange transition)
break;
}
ret = GST_ELEMENT_CLASS(parent_class)->change_state(element, transition);
ret = GST_ELEMENT_CLASS(gst_vaapipostproc_parent_class)->change_state(element, transition);
if (ret != GST_STATE_CHANGE_SUCCESS)
return ret;
@ -618,6 +619,7 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
GST_DEBUG_CATEGORY_INIT(gst_debug_vaapipostproc,
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
@ -628,6 +630,24 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
element_class->change_state = gst_vaapipostproc_change_state;
gst_element_class_set_details_simple(
element_class,
gst_vaapipostproc_details.longname,
gst_vaapipostproc_details.klass,
gst_vaapipostproc_details.description,
gst_vaapipostproc_details.author
);
/* sink pad */
pad_template = gst_static_pad_template_get(&gst_vaapipostproc_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
pad_template = gst_static_pad_template_get(&gst_vaapipostproc_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/**
* GstVaapiPostproc:deinterlace-mode:
*
@ -662,33 +682,9 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
}
static void
gst_vaapipostproc_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
gst_element_class_set_details_simple(
element_class,
gst_vaapipostproc_details.longname,
gst_vaapipostproc_details.klass,
gst_vaapipostproc_details.description,
gst_vaapipostproc_details.author
);
/* sink pad */
pad_template = gst_static_pad_template_get(&gst_vaapipostproc_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
pad_template = gst_static_pad_template_get(&gst_vaapipostproc_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
}
static void
gst_vaapipostproc_init(GstVaapiPostproc *postproc, GstVaapiPostprocClass *klass)
gst_vaapipostproc_init(GstVaapiPostproc *postproc)
{
GstVaapiPostprocClass *klass = GST_VAAPIPOSTPROC_GET_CLASS(postproc);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
postproc->allowed_caps = NULL;

View file

@ -77,14 +77,25 @@ static GstStaticPadTemplate gst_vaapisink_sink_factory =
GST_PAD_ALWAYS,
GST_STATIC_CAPS(GST_VAAPI_SURFACE_CAPS));
static void gst_vaapisink_iface_init(GType type);
static void
gst_vaapisink_implements_iface_init(GstImplementsInterfaceClass *iface);
GST_BOILERPLATE_FULL(
static void
gst_vaapisink_video_context_iface_init(GstVideoContextInterface *iface);
static void
gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface);
G_DEFINE_TYPE_WITH_CODE(
GstVaapiSink,
gst_vaapisink,
GstVideoSink,
GST_TYPE_VIDEO_SINK,
gst_vaapisink_iface_init);
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
gst_vaapisink_implements_iface_init);
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_vaapisink_video_context_iface_init);
G_IMPLEMENT_INTERFACE(GST_TYPE_X_OVERLAY,
gst_vaapisink_xoverlay_iface_init));
enum {
PROP_0,
@ -215,19 +226,6 @@ gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface)
iface->expose = gst_vaapisink_xoverlay_expose;
}
static void
gst_vaapisink_iface_init(GType type)
{
const GType g_define_type_id = type;
G_IMPLEMENT_INTERFACE(GST_TYPE_IMPLEMENTS_INTERFACE,
gst_vaapisink_implements_iface_init);
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_vaapisink_video_context_iface_init);
G_IMPLEMENT_INTERFACE(GST_TYPE_X_OVERLAY,
gst_vaapisink_xoverlay_iface_init);
}
static void
gst_vaapisink_destroy(GstVaapiSink *sink)
{
@ -733,7 +731,7 @@ gst_vaapisink_finalize(GObject *object)
{
gst_vaapisink_destroy(GST_VAAPISINK(object));
G_OBJECT_CLASS(parent_class)->finalize(object);
G_OBJECT_CLASS(gst_vaapisink_parent_class)->finalize(object);
}
static void
@ -794,30 +792,13 @@ gst_vaapisink_get_property(
}
}
static void
gst_vaapisink_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
gst_element_class_set_details_simple(
element_class,
gst_vaapisink_details.longname,
gst_vaapisink_details.klass,
gst_vaapisink_details.description,
gst_vaapisink_details.author
);
pad_template = gst_static_pad_template_get(&gst_vaapisink_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
}
static void
gst_vaapisink_class_init(GstVaapiSinkClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstBaseSinkClass * const basesink_class = GST_BASE_SINK_CLASS(klass);
GstPadTemplate *pad_template;
GST_DEBUG_CATEGORY_INIT(gst_debug_vaapisink,
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
@ -833,6 +814,18 @@ gst_vaapisink_class_init(GstVaapiSinkClass *klass)
basesink_class->render = gst_vaapisink_show_frame;
basesink_class->query = gst_vaapisink_query;
gst_element_class_set_details_simple(
element_class,
gst_vaapisink_details.longname,
gst_vaapisink_details.klass,
gst_vaapisink_details.description,
gst_vaapisink_details.author
);
pad_template = gst_static_pad_template_get(&gst_vaapisink_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
#if USE_VAAPISINK_GLX
g_object_class_install_property
(object_class,
@ -879,7 +872,7 @@ gst_vaapisink_class_init(GstVaapiSinkClass *klass)
}
static void
gst_vaapisink_init(GstVaapiSink *sink, GstVaapiSinkClass *klass)
gst_vaapisink_init(GstVaapiSink *sink)
{
sink->caps = NULL;
sink->display = NULL;

View file

@ -84,15 +84,16 @@ static GstStaticPadTemplate gst_vaapiupload_src_factory =
GST_PAD_ALWAYS,
GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str));
static void
gst_video_context_interface_init(GstVideoContextInterface *iface);
#define GstVideoContextClass GstVideoContextInterface
GST_BOILERPLATE_WITH_INTERFACE(
G_DEFINE_TYPE_WITH_CODE(
GstVaapiUpload,
gst_vaapiupload,
GstBaseTransform,
GST_TYPE_BASE_TRANSFORM,
GstVideoContext,
GST_TYPE_VIDEO_CONTEXT,
gst_video_context);
G_IMPLEMENT_INTERFACE(GST_TYPE_VIDEO_CONTEXT,
gst_video_context_interface_init));
/*
* Direct rendering levels (direct-rendering)
@ -207,37 +208,12 @@ gst_vaapiupload_destroy(GstVaapiUpload *upload)
}
}
static void
gst_vaapiupload_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstPadTemplate *pad_template;
gst_element_class_set_details_simple(
element_class,
gst_vaapiupload_details.longname,
gst_vaapiupload_details.klass,
gst_vaapiupload_details.description,
gst_vaapiupload_details.author
);
/* sink pad */
pad_template = gst_static_pad_template_get(&gst_vaapiupload_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
pad_template = gst_static_pad_template_get(&gst_vaapiupload_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
}
static void
gst_vaapiupload_finalize(GObject *object)
{
gst_vaapiupload_destroy(GST_VAAPIUPLOAD(object));
G_OBJECT_CLASS(parent_class)->finalize(object);
G_OBJECT_CLASS(gst_vaapiupload_parent_class)->finalize(object);
}
@ -287,7 +263,9 @@ static void
gst_vaapiupload_class_init(GstVaapiUploadClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstBaseTransformClass * const trans_class = GST_BASE_TRANSFORM_CLASS(klass);
GstPadTemplate *pad_template;
GST_DEBUG_CATEGORY_INIT(gst_debug_vaapiupload,
GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC);
@ -304,6 +282,24 @@ gst_vaapiupload_class_init(GstVaapiUploadClass *klass)
trans_class->get_unit_size = gst_vaapiupload_get_unit_size;
trans_class->prepare_output_buffer = gst_vaapiupload_prepare_output_buffer;
gst_element_class_set_details_simple(
element_class,
gst_vaapiupload_details.longname,
gst_vaapiupload_details.klass,
gst_vaapiupload_details.description,
gst_vaapiupload_details.author
);
/* sink pad */
pad_template = gst_static_pad_template_get(&gst_vaapiupload_sink_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/* src pad */
pad_template = gst_static_pad_template_get(&gst_vaapiupload_src_factory);
gst_element_class_add_pad_template(element_class, pad_template);
gst_object_unref(pad_template);
/**
* GstVaapiUpload:direct-rendering:
*
@ -335,7 +331,7 @@ gst_vaapiupload_class_init(GstVaapiUploadClass *klass)
}
static void
gst_vaapiupload_init(GstVaapiUpload *upload, GstVaapiUploadClass *klass)
gst_vaapiupload_init(GstVaapiUpload *upload)
{
GstPad *sinkpad, *srcpad;