play: Initialize debug category and error quark in class_init

Doing it in gst_play_new() means that bindings that directly call
g_object_new() with the GType wouldn't end up initializing both.
This affects at least the Python and GJS bindings.

gst_init() is nonetheless only called from gst_play_new() once because
calling it from class_init would likely lead to problems as that's
called from somewhere in the middle of GObject.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6801>
This commit is contained in:
Sebastian Dröge 2024-05-04 11:54:16 +03:00 committed by GStreamer Marge Bot
parent 19bc0da824
commit fcd7807de8
2 changed files with 6 additions and 6 deletions

View file

@ -382,6 +382,9 @@ gst_play_class_init (GstPlayClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_play_debug, "gst-play", 0, "GstPlay");
gst_play_error_quark ();
gobject_class->set_property = gst_play_set_property;
gobject_class->get_property = gst_play_get_property;
gobject_class->dispose = gst_play_dispose;
@ -2744,9 +2747,6 @@ gst_play_init_once (G_GNUC_UNUSED gpointer user_data)
{
gst_init (NULL, NULL);
GST_DEBUG_CATEGORY_INIT (gst_play_debug, "gst-play", 0, "GstPlay");
gst_play_error_quark ();
return NULL;
}

View file

@ -206,6 +206,9 @@ gst_player_class_init (GstPlayerClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GST_DEBUG_CATEGORY_INIT (gst_player_debug, "gst-player", 0, "GstPlayer");
gst_player_error_quark ();
gobject_class->set_property = gst_player_set_property;
gobject_class->get_property = gst_player_get_property;
gobject_class->finalize = gst_player_finalize;
@ -444,9 +447,6 @@ gst_player_init_once (G_GNUC_UNUSED gpointer user_data)
{
gst_init (NULL, NULL);
GST_DEBUG_CATEGORY_INIT (gst_player_debug, "gst-player", 0, "GstPlayer");
gst_player_error_quark ();
return NULL;
}