mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
Don't use deprecated g_object_newv()
Use g_object_new() instead which nowadays has a shortcut for the no-properties check. It still does an extra GType check in the function guard, but there's a pending patch to remove that and it's hardly going to be a performance issue in practice, even less so on a system that's compiled without run-time checks. Alternative would be to move to the new g_object_new_properties() with a fallback define for older glib versions, but it makes the code look more unwieldy and doesn't seem worth it. Fixes deprecation warnings when building against newer GLib versions. https://bugzilla.gnome.org/show_bug.cgi?id=780903
This commit is contained in:
parent
7699b8a1bc
commit
519d64881f
22 changed files with 28 additions and 36 deletions
|
@ -219,7 +219,7 @@ gst_buffer_pool_new (void)
|
|||
{
|
||||
GstBufferPool *result;
|
||||
|
||||
result = g_object_newv (GST_TYPE_BUFFER_POOL, 0, NULL);
|
||||
result = g_object_new (GST_TYPE_BUFFER_POOL, NULL);
|
||||
GST_DEBUG_OBJECT (result, "created new buffer pool");
|
||||
|
||||
return result;
|
||||
|
|
|
@ -285,7 +285,7 @@ gst_bus_new (void)
|
|||
{
|
||||
GstBus *result;
|
||||
|
||||
result = g_object_newv (gst_bus_get_type (), 0, NULL);
|
||||
result = g_object_new (gst_bus_get_type (), NULL);
|
||||
GST_DEBUG_OBJECT (result, "created new bus");
|
||||
|
||||
return result;
|
||||
|
|
|
@ -197,9 +197,7 @@ gst_device_provider_register (GstPlugin * plugin, const gchar * name,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
factory =
|
||||
GST_DEVICE_PROVIDER_FACTORY_CAST (g_object_newv
|
||||
(GST_TYPE_DEVICE_PROVIDER_FACTORY, 0, NULL));
|
||||
factory = g_object_new (GST_TYPE_DEVICE_PROVIDER_FACTORY, NULL);
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
||||
GST_LOG_OBJECT (factory, "Created new device providerfactory for type %s",
|
||||
g_type_name (type));
|
||||
|
@ -284,8 +282,7 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
|
|||
/* create an instance of the device provider, cast so we don't assert on NULL
|
||||
* also set name as early as we can
|
||||
*/
|
||||
device_provider = GST_DEVICE_PROVIDER_CAST (g_object_newv (factory->type, 0,
|
||||
NULL));
|
||||
device_provider = g_object_new (factory->type, NULL);
|
||||
if (G_UNLIKELY (device_provider == NULL))
|
||||
goto no_device_provider;
|
||||
|
||||
|
|
|
@ -123,9 +123,7 @@ gst_dynamic_type_factory_create (GstRegistry * registry,
|
|||
{
|
||||
GstDynamicTypeFactory *factory;
|
||||
|
||||
factory =
|
||||
GST_DYNAMIC_TYPE_FACTORY_CAST (g_object_newv
|
||||
(GST_TYPE_DYNAMIC_TYPE_FACTORY, 0, NULL));
|
||||
factory = g_object_new (GST_TYPE_DYNAMIC_TYPE_FACTORY, NULL);
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
||||
GST_LOG_OBJECT (factory, "Created new dynamictypefactory for type %s", name);
|
||||
|
||||
|
|
|
@ -230,9 +230,7 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
factory =
|
||||
GST_ELEMENT_FACTORY_CAST (g_object_newv (GST_TYPE_ELEMENT_FACTORY, 0,
|
||||
NULL));
|
||||
factory = g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL);
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
||||
GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
|
||||
g_type_name (type));
|
||||
|
@ -369,10 +367,9 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
|
|||
* also set name as early as we can
|
||||
*/
|
||||
if (name)
|
||||
element =
|
||||
GST_ELEMENT_CAST (g_object_new (factory->type, "name", name, NULL));
|
||||
element = g_object_new (factory->type, "name", name, NULL);
|
||||
else
|
||||
element = GST_ELEMENT_CAST (g_object_newv (factory->type, 0, NULL));
|
||||
element = g_object_new (factory->type, NULL);
|
||||
if (G_UNLIKELY (element == NULL))
|
||||
goto no_element;
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ gst_plugin_register_static (gint major_version, gint minor_version,
|
|||
g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
|
||||
|
||||
GST_LOG ("attempting to load static plugin \"%s\" now...", name);
|
||||
plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
|
||||
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
||||
if (gst_plugin_register_func (plugin, &desc, NULL) != NULL) {
|
||||
GST_INFO ("registered static plugin \"%s\"", name);
|
||||
res = gst_registry_add_plugin (gst_registry_get (), plugin);
|
||||
|
@ -287,7 +287,7 @@ gst_plugin_register_static_full (gint major_version, gint minor_version,
|
|||
g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
|
||||
|
||||
GST_LOG ("attempting to load static plugin \"%s\" now...", name);
|
||||
plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
|
||||
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
||||
if (gst_plugin_register_func (plugin, &desc, user_data) != NULL) {
|
||||
GST_INFO ("registered static plugin \"%s\"", name);
|
||||
res = gst_registry_add_plugin (gst_registry_get (), plugin);
|
||||
|
@ -781,7 +781,7 @@ _priv_gst_plugin_load_file_for_registry (const gchar * filename,
|
|||
}
|
||||
|
||||
if (new_plugin) {
|
||||
plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
|
||||
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
||||
plugin->file_mtime = file_status.st_mtime;
|
||||
plugin->file_size = file_status.st_size;
|
||||
plugin->filename = g_strdup (filename);
|
||||
|
|
|
@ -339,7 +339,7 @@ static void
|
|||
plugin_loader_create_blacklist_plugin (GstPluginLoader * l,
|
||||
PendingPluginEntry * entry)
|
||||
{
|
||||
GstPlugin *plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
|
||||
GstPlugin *plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
||||
|
||||
plugin->filename = g_strdup (entry->filename);
|
||||
plugin->file_mtime = entry->file_mtime;
|
||||
|
|
|
@ -327,7 +327,7 @@ gst_registry_get (void)
|
|||
|
||||
g_mutex_lock (&_gst_registry_mutex);
|
||||
if (G_UNLIKELY (!_gst_registry_default)) {
|
||||
_gst_registry_default = g_object_newv (GST_TYPE_REGISTRY, 0, NULL);
|
||||
_gst_registry_default = g_object_new (GST_TYPE_REGISTRY, NULL);
|
||||
gst_object_ref_sink (GST_OBJECT_CAST (_gst_registry_default));
|
||||
}
|
||||
registry = _gst_registry_default;
|
||||
|
|
|
@ -576,7 +576,7 @@ gst_registry_chunks_load_feature (GstRegistry * registry, gchar ** in,
|
|||
plugin_name);
|
||||
return FALSE;
|
||||
}
|
||||
if (G_UNLIKELY ((feature = g_object_newv (type, 0, NULL)) == NULL)) {
|
||||
if (G_UNLIKELY ((feature = g_object_new (type, NULL)) == NULL)) {
|
||||
GST_ERROR ("Can't create feature from type");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
|
|||
*in);
|
||||
unpack_element (*in, pe, GstRegistryChunkPluginElement, end, fail);
|
||||
|
||||
plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
|
||||
plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
|
||||
|
||||
/* TODO: also set GST_PLUGIN_FLAG_CONST */
|
||||
GST_OBJECT_FLAG_SET (plugin, GST_PLUGIN_FLAG_CACHED);
|
||||
|
|
|
@ -423,7 +423,7 @@ gst_task_new (GstTaskFunction func, gpointer user_data, GDestroyNotify notify)
|
|||
|
||||
g_return_val_if_fail (func != NULL, NULL);
|
||||
|
||||
task = g_object_newv (GST_TYPE_TASK, 0, NULL);
|
||||
task = g_object_new (GST_TYPE_TASK, NULL);
|
||||
task->func = func;
|
||||
task->user_data = user_data;
|
||||
task->notify = notify;
|
||||
|
|
|
@ -166,7 +166,7 @@ gst_task_pool_new (void)
|
|||
{
|
||||
GstTaskPool *pool;
|
||||
|
||||
pool = g_object_newv (GST_TYPE_TASK_POOL, 0, NULL);
|
||||
pool = g_object_new (GST_TYPE_TASK_POOL, NULL);
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ gst_tracer_register (GstPlugin * plugin, const gchar * name, GType type)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
factory = g_object_newv (GST_TYPE_TRACER_FACTORY, 0, NULL);
|
||||
factory = g_object_new (GST_TYPE_TRACER_FACTORY, NULL);
|
||||
GST_DEBUG_OBJECT (factory, "new tracer factory for %s", name);
|
||||
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
||||
|
|
|
@ -218,7 +218,7 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
|
|||
}
|
||||
va_end (varargs);
|
||||
|
||||
self = g_object_newv (GST_TYPE_TRACER_RECORD, 0, NULL);
|
||||
self = g_object_new (GST_TYPE_TRACER_RECORD, NULL);
|
||||
self->spec = structure;
|
||||
gst_tracer_record_build_format (self);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
|
||||
GST_INFO ("registering typefind function for %s", name);
|
||||
|
||||
factory = g_object_newv (GST_TYPE_TYPE_FIND_FACTORY, 0, NULL);
|
||||
factory = g_object_new (GST_TYPE_TYPE_FIND_FACTORY, NULL);
|
||||
GST_DEBUG_OBJECT (factory, "using new typefind factory for %s", name);
|
||||
|
||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
||||
|
|
|
@ -240,7 +240,7 @@ gst_adapter_finalize (GObject * object)
|
|||
GstAdapter *
|
||||
gst_adapter_new (void)
|
||||
{
|
||||
return g_object_newv (GST_TYPE_ADAPTER, 0, NULL);
|
||||
return g_object_new (GST_TYPE_ADAPTER, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -236,7 +236,7 @@ gst_data_queue_new (GstDataQueueCheckFullFunction checkfull,
|
|||
|
||||
g_return_val_if_fail (checkfull != NULL, NULL);
|
||||
|
||||
ret = g_object_newv (GST_TYPE_DATA_QUEUE, 0, NULL);
|
||||
ret = g_object_new (GST_TYPE_DATA_QUEUE, NULL);
|
||||
ret->priv->checkfull = checkfull;
|
||||
ret->priv->checkdata = checkdata;
|
||||
ret->priv->fullcallback = fullcallback;
|
||||
|
|
|
@ -305,7 +305,7 @@ gst_index_new (void)
|
|||
{
|
||||
GstIndex *index;
|
||||
|
||||
index = g_object_newv (gst_index_get_type (), 0, NULL);
|
||||
index = g_object_new (gst_index_get_type (), NULL);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
|
|
@ -666,7 +666,7 @@ struct _GstInterpolationControlSourcePrivate
|
|||
GstControlSource *
|
||||
gst_interpolation_control_source_new (void)
|
||||
{
|
||||
return g_object_newv (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, 0, NULL);
|
||||
return g_object_new (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -424,7 +424,7 @@ gst_lfo_control_source_reset (GstLFOControlSource * self)
|
|||
GstControlSource *
|
||||
gst_lfo_control_source_new (void)
|
||||
{
|
||||
return g_object_newv (GST_TYPE_LFO_CONTROL_SOURCE, 0, NULL);
|
||||
return g_object_new (GST_TYPE_LFO_CONTROL_SOURCE, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -188,7 +188,7 @@ G_DEFINE_TYPE_WITH_CODE (GstTriggerControlSource, gst_trigger_control_source,
|
|||
GstControlSource *
|
||||
gst_trigger_control_source_new (void)
|
||||
{
|
||||
return g_object_newv (GST_TYPE_TRIGGER_CONTROL_SOURCE, 0, NULL);
|
||||
return g_object_new (GST_TYPE_TRIGGER_CONTROL_SOURCE, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -231,7 +231,7 @@ static GType gst_test_control_source_get_type (void);
|
|||
static GstTestControlSource *
|
||||
gst_test_control_source_new (void)
|
||||
{
|
||||
return g_object_newv (GST_TYPE_TEST_CONTROL_SOURCE, 0, NULL);
|
||||
return g_object_new (GST_TYPE_TEST_CONTROL_SOURCE, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -50,7 +50,7 @@ setup_factory (void)
|
|||
GstPluginFeature *feature;
|
||||
GstElementFactory *factory;
|
||||
|
||||
feature = g_object_newv (GST_TYPE_ELEMENT_FACTORY, 0, NULL);
|
||||
feature = g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL);
|
||||
gst_plugin_feature_set_name (feature, "test");
|
||||
|
||||
factory = GST_ELEMENT_FACTORY_CAST (feature);
|
||||
|
|
Loading…
Reference in a new issue