mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
soup: Fix plugin/element init
In case of per features registration such as the customizable gstreamer-full library, each element should check that the soup library can be loaded to facilitate the element registration. Initialize the debug category properly Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2349>
This commit is contained in:
parent
9b128f1841
commit
39b13fcdbd
5 changed files with 52 additions and 21 deletions
|
@ -31,15 +31,6 @@ plugin_init (GstPlugin * plugin)
|
|||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_soup_debug, "soup", 0, "soup");
|
||||
|
||||
#ifndef STATIC_SOUP
|
||||
if (!gst_soup_load_library ()) {
|
||||
GST_WARNING ("Failed to load libsoup library");
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret |= GST_ELEMENT_REGISTER (souphttpsrc, plugin);
|
||||
ret |= GST_ELEMENT_REGISTER (souphttpclientsink, plugin);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
GST_DEBUG_CATEGORY (soup_utils_debug);
|
||||
|
||||
void
|
||||
gboolean
|
||||
soup_element_init (GstPlugin * plugin)
|
||||
{
|
||||
static gsize res = FALSE;
|
||||
|
@ -55,4 +55,11 @@ soup_element_init (GstPlugin * plugin)
|
|||
|
||||
g_once_init_leave (&res, TRUE);
|
||||
}
|
||||
#ifndef STATIC_SOUP
|
||||
if (!gst_soup_load_library ()) {
|
||||
GST_WARNING ("Failed to load libsoup library");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void soup_element_init (GstPlugin * plugin);
|
||||
gboolean soup_element_init (GstPlugin * plugin);
|
||||
|
||||
GST_ELEMENT_REGISTER_DECLARE (souphttpsrc);
|
||||
GST_ELEMENT_REGISTER_DECLARE (souphttpclientsink);
|
||||
|
|
|
@ -115,8 +115,11 @@ GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
#define gst_soup_http_client_sink_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstSoupHttpClientSink, gst_soup_http_client_sink,
|
||||
GST_TYPE_BASE_SINK);
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (souphttpclientsink, "souphttpclientsink",
|
||||
GST_RANK_NONE, GST_TYPE_SOUP_HTTP_CLIENT_SINK, soup_element_init (plugin));
|
||||
|
||||
static gboolean souphttpclientsink_element_init (GstPlugin * plugin);
|
||||
GST_ELEMENT_REGISTER_DEFINE_CUSTOM (souphttpclientsink,
|
||||
souphttpclientsink_element_init);
|
||||
|
||||
|
||||
static void
|
||||
gst_soup_http_client_sink_class_init (GstSoupHttpClientSinkClass * klass)
|
||||
|
@ -211,9 +214,6 @@ gst_soup_http_client_sink_class_init (GstSoupHttpClientSinkClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_soup_http_client_sink_unlock);
|
||||
base_sink_class->render =
|
||||
GST_DEBUG_FUNCPTR (gst_soup_http_client_sink_render);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (souphttpclientsink_dbg, "souphttpclientsink", 0,
|
||||
"souphttpclientsink element");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -912,3 +912,21 @@ authenticate (SoupMessage * msg, SoupAuth * auth,
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
souphttpclientsink_element_init (GstPlugin * plugin)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (souphttpclientsink_dbg, "souphttpclientsink", 0,
|
||||
"souphttpclientsink element");
|
||||
|
||||
if (!soup_element_init (plugin))
|
||||
return TRUE;
|
||||
|
||||
ret =
|
||||
gst_element_register (plugin, "souphttpclientsink", GST_RANK_NONE,
|
||||
GST_TYPE_SOUP_HTTP_CLIENT_SINK);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -272,8 +272,9 @@ static gboolean gst_soup_http_src_accept_certificate_cb (SoupMessage * msg,
|
|||
G_DEFINE_TYPE_WITH_CODE (GstSoupHTTPSrc, gst_soup_http_src, GST_TYPE_PUSH_SRC,
|
||||
G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
|
||||
gst_soup_http_src_uri_handler_init));
|
||||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (souphttpsrc, "souphttpsrc",
|
||||
GST_RANK_PRIMARY, GST_TYPE_SOUP_HTTP_SRC, soup_element_init (plugin));
|
||||
|
||||
static gboolean souphttpsrc_element_init (GstPlugin * plugin);
|
||||
GST_ELEMENT_REGISTER_DEFINE_CUSTOM (souphttpsrc, souphttpsrc_element_init);
|
||||
|
||||
static void
|
||||
gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass)
|
||||
|
@ -519,9 +520,6 @@ gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass)
|
|||
gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_soup_http_src_query);
|
||||
|
||||
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_soup_http_src_create);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (souphttpsrc_debug, "souphttpsrc", 0,
|
||||
"SOUP HTTP src");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2631,3 +2629,20 @@ gst_soup_http_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|||
iface->get_uri = gst_soup_http_src_uri_get_uri;
|
||||
iface->set_uri = gst_soup_http_src_uri_set_uri;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
souphttpsrc_element_init (GstPlugin * plugin)
|
||||
{
|
||||
gboolean ret = TRUE;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (souphttpsrc_debug, "souphttpsrc", 0,
|
||||
"SOUP HTTP src");
|
||||
|
||||
if (!soup_element_init (plugin))
|
||||
return TRUE;
|
||||
|
||||
ret = gst_element_register (plugin, "souphttpsrc",
|
||||
GST_RANK_PRIMARY, GST_TYPE_SOUP_HTTP_SRC);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue