validate: Update for g_type_class_add_private() deprecation in recent GLib

https://gitlab.gnome.org/GNOME/glib/merge_requests/7
This commit is contained in:
Wonchul Lee 2018-09-19 11:50:09 +09:00 committed by Thibault Saunier
parent 6457690e1c
commit 955fc5fcce
11 changed files with 91 additions and 117 deletions

View file

@ -39,12 +39,6 @@ typedef struct _SSimWindowCache
gfloat element_summ;
} SSimWindowCache;
enum
{
PROP_FIRST_PROP = 1,
N_PROPS
};
struct _GssimPrivate
{
gint width;
@ -67,6 +61,12 @@ struct _GssimPrivate
G_DEFINE_TYPE_WITH_PRIVATE (Gssim, gssim, GST_TYPE_OBJECT)
/* *INDENT-ON* */
enum
{
PROP_FIRST_PROP = 1,
N_PROPS
};
static void
gssim_calculate_mu (Gssim * self, guint8 * buf)
{

View file

@ -41,9 +41,6 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
#define GENERAL_INPUT_ERROR g_quark_from_static_string ("ssim::general-file-error")
#define WRONG_FORMAT g_quark_from_static_string ("ssim::wrong-format")
G_DEFINE_TYPE_WITH_CODE (GstValidateSsim, gst_validate_ssim,
GST_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL));
enum
{
PROP_FIRST_PROP = 1,
@ -58,16 +55,7 @@ typedef struct
GstVideoInfo out_info;
} SSimConverterInfo;
static void
ssim_convert_info_free (SSimConverterInfo * info)
{
if (info->converter)
gst_video_converter_free (info->converter);
g_slice_free (SSimConverterInfo, info);
}
struct _GstValidateSsimPriv
struct _GstValidateSsimPrivate
{
gint width;
gint height;
@ -85,6 +73,18 @@ struct _GstValidateSsimPriv
GHashTable *ref_frames_cache;
};
G_DEFINE_TYPE_WITH_CODE (GstValidateSsim, gst_validate_ssim,
GST_TYPE_OBJECT, G_ADD_PRIVATE (GstValidateSsim)
G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL));
static void
ssim_convert_info_free (SSimConverterInfo * info)
{
if (info->converter)
gst_video_converter_free (info->converter);
g_slice_free (SSimConverterInfo, info);
}
static gboolean
gst_validate_ssim_convert (GstValidateSsim * self, SSimConverterInfo * info,
@ -945,8 +945,6 @@ gst_validate_ssim_class_init (GstValidateSsimClass * klass)
oclass->dispose = gst_validate_ssim_dispose;
oclass->finalize = gst_validate_ssim_finalize;
g_type_class_add_private (klass, sizeof (GstValidateSsimPriv));
g_once (&_once, _register_issues, NULL);
g_object_class_install_property (oclass, PROP_RUNNER,
@ -959,9 +957,7 @@ gst_validate_ssim_class_init (GstValidateSsimClass * klass)
static void
gst_validate_ssim_init (GstValidateSsim * self)
{
self->priv =
G_TYPE_INSTANCE_GET_PRIVATE (self, GST_VALIDATE_SSIM_TYPE,
GstValidateSsimPriv);
self->priv = gst_validate_ssim_get_instance_private (self);
self->priv->ssim = gssim_new ();
self->priv->ref_frames_cache = g_hash_table_new_full (g_str_hash,

View file

@ -35,12 +35,12 @@
G_BEGIN_DECLS
typedef struct _GstValidateSsimPriv GstValidateSsimPriv;
typedef struct _GstValidateSsimPrivate GstValidateSsimPrivate;
typedef struct {
GstObject parent;
GstValidateSsimPriv *priv;
GstValidateSsimPrivate *priv;
} GstValidateSsim;
typedef struct {

View file

@ -41,10 +41,7 @@
/* *INDENT-OFF* */
G_DEFINE_TYPE_WITH_CODE (GstValidateOverride, gst_validate_override,
GST_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL))
struct _GstValidateOverridePriv
struct _GstValidateOverridePrivate
{
GHashTable *level_override;
};
@ -56,6 +53,10 @@ enum
PROP_LAST
};
G_DEFINE_TYPE_WITH_CODE (GstValidateOverride, gst_validate_override,
GST_TYPE_OBJECT, G_ADD_PRIVATE (GstValidateOverride)
G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL))
/* *INDENT-ON* */
static void
@ -108,8 +109,6 @@ gst_validate_override_class_init (GstValidateOverrideClass * klass)
oclass->finalize = gst_validate_override_finalize;
g_type_class_add_private (klass, sizeof (GstValidateOverridePriv));
oclass->get_property = _get_property;
oclass->set_property = _set_property;
@ -123,8 +122,7 @@ gst_validate_override_class_init (GstValidateOverrideClass * klass)
static void
gst_validate_override_init (GstValidateOverride * self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
GST_TYPE_VALIDATE_OVERRIDE, GstValidateOverridePriv);
self->priv = gst_validate_override_get_instance_private (self);
self->priv->level_override = g_hash_table_new (g_direct_hash, g_direct_equal);
}

View file

@ -27,7 +27,7 @@
typedef struct _GstValidateOverride GstValidateOverride;
typedef struct _GstValidateOverrideClass GstValidateOverrideClass;
typedef struct _GstValidateOverridePriv GstValidateOverridePriv;
typedef struct _GstValidateOverridePrivate GstValidateOverridePrivate;
#include <gst/validate/gst-validate-report.h>
@ -71,7 +71,7 @@ struct _GstValidateOverride
GstValidateOverrideElementAddedHandler element_added_handler;
/*<private>*/
GstValidateOverridePriv *priv;
GstValidateOverridePrivate *priv;
};
GST_VALIDATE_API

View file

@ -113,7 +113,8 @@ typedef struct _PatternLevel
} G_STMT_END
#define gst_validate_runner_parent_class parent_class
G_DEFINE_TYPE (GstValidateRunner, gst_validate_runner, GST_TYPE_TRACER);
G_DEFINE_TYPE_WITH_PRIVATE (GstValidateRunner, gst_validate_runner,
GST_TYPE_TRACER);
/* signals */
enum
@ -413,8 +414,6 @@ gst_validate_runner_class_init (GstValidateRunnerClass * klass)
gobject_class->get_property = gst_validate_runner_get_property;
gobject_class->constructor = gst_validate_runner_constructor;
g_type_class_add_private (klass, sizeof (GstValidateRunnerPrivate));
properties[PROP_PARAMS] =
g_param_spec_string ("params", "Params", "Extra configuration parameters",
NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
@ -437,9 +436,7 @@ gst_validate_runner_class_init (GstValidateRunnerClass * klass)
static void
gst_validate_runner_init (GstValidateRunner * runner)
{
runner->priv = G_TYPE_INSTANCE_GET_PRIVATE (runner, GST_TYPE_VALIDATE_RUNNER,
GstValidateRunnerPrivate);
g_mutex_init (&runner->priv->mutex);
runner->priv = gst_validate_runner_get_instance_private (runner);
runner->priv->reports_by_type = g_hash_table_new (g_direct_hash,
g_direct_equal);

View file

@ -55,9 +55,6 @@
#include <gst/validate/gst-validate-override-registry.h>
#include <gst/validate/gst-validate-pipeline-monitor.h>
#define GST_VALIDATE_SCENARIO_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_VALIDATE_SCENARIO, GstValidateScenarioPrivate))
#define GST_VALIDATE_SCENARIO_SUFFIX ".scenario"
#define GST_VALIDATE_SCENARIO_DIRECTORY "scenarios"
@ -222,8 +219,8 @@ _reporter_iface_init (GstValidateReporterInterface * iface)
}
G_DEFINE_TYPE_WITH_CODE (GstValidateScenario, gst_validate_scenario,
GST_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER,
_reporter_iface_init));
GST_TYPE_OBJECT, G_ADD_PRIVATE (GstValidateScenario)
G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, _reporter_iface_init));
/* GstValidateAction implementation */
static GType _gst_validate_action_type = 0;
@ -3111,8 +3108,6 @@ gst_validate_scenario_class_init (GstValidateScenarioClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (GstValidateScenarioPrivate));
object_class->dispose = gst_validate_scenario_dispose;
object_class->finalize = gst_validate_scenario_finalize;
@ -3156,7 +3151,7 @@ static void
gst_validate_scenario_init (GstValidateScenario * scenario)
{
GstValidateScenarioPrivate *priv = scenario->priv =
GST_VALIDATE_SCENARIO_GET_PRIVATE (scenario);
gst_validate_scenario_get_instance_private (scenario);
priv->seek_pos_tol = DEFAULT_SEEK_TOLERANCE;
priv->segment_start = 0;

View file

@ -22,16 +22,6 @@
#include "media-descriptor-parser.h"
#include <string.h>
G_DEFINE_TYPE (GstValidateMediaDescriptorParser,
gst_validate_media_descriptor_parser, GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR);
enum
{
PROP_0,
PROP_PATH,
N_PROPERTIES
};
struct _GstValidateMediaDescriptorParserPrivate
{
gchar *xmlpath;
@ -41,6 +31,16 @@ struct _GstValidateMediaDescriptorParserPrivate
GMarkupParseContext *parsecontext;
};
G_DEFINE_TYPE_WITH_PRIVATE (GstValidateMediaDescriptorParser,
gst_validate_media_descriptor_parser, GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR);
enum
{
PROP_0,
PROP_PATH,
N_PROPERTIES
};
/* Private methods and callbacks */
static gint
compare_frames (GstValidateMediaFrameNode * frm,
@ -391,9 +391,8 @@ gst_validate_media_descriptor_parser_init (GstValidateMediaDescriptorParser *
{
GstValidateMediaDescriptorParserPrivate *priv;
parser->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (parser,
GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_PARSER,
GstValidateMediaDescriptorParserPrivate);
parser->priv = priv =
gst_validate_media_descriptor_parser_get_instance_private (parser);
priv->xmlpath = NULL;
}
@ -404,8 +403,6 @@ static void
{
GObjectClass *object_class = G_OBJECT_CLASS (self_class);
g_type_class_add_private (self_class,
sizeof (GstValidateMediaDescriptorParserPrivate));
object_class->dispose = (void (*)(GObject * object)) dispose;
object_class->finalize = (void (*)(GObject * object)) finalize;
object_class->get_property = get_property;

View file

@ -23,7 +23,17 @@
#include "media-descriptor-writer.h"
#include <string.h>
G_DEFINE_TYPE (GstValidateMediaDescriptorWriter,
struct _GstValidateMediaDescriptorWriterPrivate
{
GstElement *pipeline;
GstCaps *raw_caps;
GMainLoop *loop;
GList *parsers;
GstValidateMediaDescriptorWriterFlags flags;
};
G_DEFINE_TYPE_WITH_PRIVATE (GstValidateMediaDescriptorWriter,
gst_validate_media_descriptor_writer, GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR);
#define STR_APPEND(arg, nb_white) \
@ -44,16 +54,6 @@ enum
N_PROPERTIES
};
struct _GstValidateMediaDescriptorWriterPrivate
{
GstElement *pipeline;
GstCaps *raw_caps;
GMainLoop *loop;
GList *parsers;
GstValidateMediaDescriptorWriterFlags flags;
};
static void
finalize (GstValidateMediaDescriptorWriter * writer)
{
@ -95,9 +95,8 @@ gst_validate_media_descriptor_writer_init (GstValidateMediaDescriptorWriter *
GstValidateMediaDescriptorWriterPrivate *priv;
writer->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (writer,
GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR_WRITER,
GstValidateMediaDescriptorWriterPrivate);
writer->priv = priv =
gst_validate_media_descriptor_writer_get_instance_private (writer);
writer->priv->parsers =
gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_PARSER,
@ -110,8 +109,6 @@ static void
{
GObjectClass *object_class = G_OBJECT_CLASS (self_class);
g_type_class_add_private (self_class,
sizeof (GstValidateMediaDescriptorWriterPrivate));
object_class->finalize = (void (*)(GObject * object)) finalize;
object_class->get_property = get_property;
object_class->set_property = set_property;

View file

@ -23,13 +23,16 @@
#include <string.h>
#include "media-descriptor.h"
struct _GstValidateMediaDescriptorPrivate
{
gpointer dummy;
};
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstValidateMediaDescriptor,
gst_validate_media_descriptor, GST_TYPE_OBJECT,
G_ADD_PRIVATE (GstValidateMediaDescriptor)
G_IMPLEMENT_INTERFACE (GST_TYPE_VALIDATE_REPORTER, NULL));
#define GST_VALIDATE_MEDIA_DESCRIPTOR_GET_PRIVATE(o)\
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_VALIDATE_MEDIA_DESCRIPTOR, GstValidateMediaDescriptorPrivate))
static inline void
free_tagnode (GstValidateMediaTagNode * tagnode)
{
@ -125,11 +128,6 @@ gboolean
return TRUE;
}
struct _GstValidateMediaDescriptorPrivate
{
gpointer dummy;
};
enum
{
PROP_0,
@ -199,8 +197,6 @@ gst_validate_media_descriptor_class_init (GstValidateMediaDescriptorClass *
{
GObjectClass *object_class = G_OBJECT_CLASS (self_class);
g_type_class_add_private (self_class,
sizeof (GstValidateMediaDescriptorPrivate));
object_class->dispose =
(void (*)(GObject * object)) gst_validate_media_descriptor_dispose;
object_class->finalize =

View file

@ -125,13 +125,13 @@
#define SSIM_SAVING_ERROR g_quark_from_static_string ("validatessim::saving-error")
#define MONITOR_DATA g_quark_from_static_string ("validate-ssim-monitor-data")
typedef struct _ValidateSsimOverridePriv ValidateSsimOverridePriv;
typedef struct _ValidateSsimOverridePrivate ValidateSsimOverridePrivate;
typedef struct
{
GstValidateOverride parent;
ValidateSsimOverridePriv *priv;
ValidateSsimOverridePrivate *priv;
} ValidateSsimOverride;
@ -154,21 +154,7 @@ free_frame (Frame * frame)
g_free (frame->path);
}
static GType validate_ssim_override_get_type (void);
#define VALIDATE_SSIM_OVERRIDE_TYPE (validate_ssim_override_get_type ())
#define VALIDATE_SSIM_OVERRIDE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALIDATE_SSIM_OVERRIDE_TYPE, ValidateSsimOverride))
#define VALIDATE_SSIM_OVERRIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALIDATE_SSIM_OVERRIDE_TYPE, ValidateSsimOverrideClass))
#define IS_VALIDATE_SSIM_OVERRIDE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALIDATE_SSIM_OVERRIDE_TYPE))
#define IS_VALIDATE_SSIM_OVERRIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALIDATE_SSIM_OVERRIDE_TYPE))
#define VALIDATE_SSIM_OVERRIDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALIDATE_SSIM_OVERRIDE_TYPE, ValidateSsimOverrideClass))
/* *INDENT-OFF* */
G_DEFINE_TYPE (ValidateSsimOverride, validate_ssim_override, GST_TYPE_VALIDATE_OVERRIDE)
/* *INDENT-ON* */
struct _ValidateSsimOverridePriv
struct _ValidateSsimOverridePrivate
{
gchar *outdir;
gchar *result_outdir;
@ -193,6 +179,22 @@ struct _ValidateSsimOverridePriv
const gchar *ref_ext;
};
static GType validate_ssim_override_get_type (void);
#define VALIDATE_SSIM_OVERRIDE_TYPE (validate_ssim_override_get_type ())
#define VALIDATE_SSIM_OVERRIDE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALIDATE_SSIM_OVERRIDE_TYPE, ValidateSsimOverride))
#define VALIDATE_SSIM_OVERRIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALIDATE_SSIM_OVERRIDE_TYPE, ValidateSsimOverrideClass))
#define IS_VALIDATE_SSIM_OVERRIDE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALIDATE_SSIM_OVERRIDE_TYPE))
#define IS_VALIDATE_SSIM_OVERRIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALIDATE_SSIM_OVERRIDE_TYPE))
#define VALIDATE_SSIM_OVERRIDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALIDATE_SSIM_OVERRIDE_TYPE, ValidateSsimOverrideClass))
/* *INDENT-OFF* */
G_DEFINE_TYPE_WITH_PRIVATE (ValidateSsimOverride, validate_ssim_override,
GST_TYPE_VALIDATE_OVERRIDE)
/* *INDENT-ON* */
static void
runner_stopping (GstValidateRunner * runner, ValidateSsimOverride * self)
{
@ -413,7 +415,7 @@ fail:
static void
_finalize (GObject * object)
{
ValidateSsimOverridePriv *priv = VALIDATE_SSIM_OVERRIDE (object)->priv;
ValidateSsimOverridePrivate *priv = VALIDATE_SSIM_OVERRIDE (object)->priv;
if (priv->converter)
gst_video_converter_free (priv->converter);
@ -458,16 +460,12 @@ validate_ssim_override_class_init (ValidateSsimOverrideClass * klass)
"The ValidateSSim plugin could not save PNG file",
"The ValidateSSim plugin could not save PNG file",
GST_VALIDATE_REPORT_LEVEL_CRITICAL));
g_type_class_add_private (klass, sizeof (ValidateSsimOverridePriv));
}
static void
validate_ssim_override_init (ValidateSsimOverride * self)
{
self->priv =
G_TYPE_INSTANCE_GET_PRIVATE (self, VALIDATE_SSIM_OVERRIDE_TYPE,
ValidateSsimOverridePriv);
self->priv = validate_ssim_override_get_instance_private (self);
self->priv->needs_reconfigure = TRUE;
self->priv->frames = g_array_new (TRUE, TRUE, sizeof (Frame));
@ -480,7 +478,7 @@ _set_videoconvert (ValidateSsimOverride * o,
{
GstCaps *caps;
GstVideoFormat format;
ValidateSsimOverridePriv *priv = o->priv;
ValidateSsimOverridePrivate *priv = o->priv;
GstPad *pad =
GST_PAD (gst_validate_monitor_get_target (GST_VALIDATE_MONITOR
(pad_monitor)));
@ -585,7 +583,7 @@ static gboolean
_should_dump_buffer (ValidateSsimOverride * self,
GstValidatePadMonitor * pad_monitor, GstClockTime position)
{
ValidateSsimOverridePriv *priv = self->priv;
ValidateSsimOverridePrivate *priv = self->priv;
if (!GST_CLOCK_TIME_IS_VALID (priv->recurrence))
return TRUE;
@ -654,7 +652,7 @@ _handle_buffer (GstValidateOverride * override,
Frame iframe;
ValidateSsimOverride *o = VALIDATE_SSIM_OVERRIDE (override);
ValidateSsimOverridePriv *priv = o->priv;
ValidateSsimOverridePrivate *priv = o->priv;
GstClockTime running_time, position;