mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
adaptivedemux2: 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 categories properly Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2348>
This commit is contained in:
parent
7acfd0cdd1
commit
6b55f97529
11 changed files with 151 additions and 35 deletions
|
@ -291,6 +291,7 @@
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
#include <gst/net/gstnet.h>
|
#include <gst/net/gstnet.h>
|
||||||
|
|
||||||
|
#include "gstadaptivedemuxelements.h"
|
||||||
#include "gstdashdemux.h"
|
#include "gstdashdemux.h"
|
||||||
#include "gstdash_debug.h"
|
#include "gstdash_debug.h"
|
||||||
|
|
||||||
|
@ -467,13 +468,11 @@ gst_dash_demux_stream_class_init (GstDashDemux2StreamClass * klass)
|
||||||
|
|
||||||
|
|
||||||
#define gst_dash_demux2_parent_class parent_class
|
#define gst_dash_demux2_parent_class parent_class
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstDashDemux2, gst_dash_demux2,
|
G_DEFINE_TYPE (GstDashDemux2, gst_dash_demux2, GST_TYPE_ADAPTIVE_DEMUX);
|
||||||
GST_TYPE_ADAPTIVE_DEMUX, GST_DEBUG_CATEGORY_INIT (gst_dash_demux2_debug,
|
|
||||||
"dashdemux2", 0, "dashdemux2 element")
|
|
||||||
);
|
|
||||||
|
|
||||||
GST_ELEMENT_REGISTER_DEFINE (dashdemux2, "dashdemux2",
|
static gboolean dashdemux2_element_init (GstPlugin * plugin);
|
||||||
GST_RANK_PRIMARY + 1, GST_TYPE_DASH_DEMUX2);
|
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_CUSTOM (dashdemux2, dashdemux2_element_init);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_dash_demux_dispose (GObject * obj)
|
gst_dash_demux_dispose (GObject * obj)
|
||||||
|
@ -3967,3 +3966,20 @@ gst_dash_demux_get_server_now_utc (GstDashDemux2 * demux)
|
||||||
g_date_time_unref (client_now);
|
g_date_time_unref (client_now);
|
||||||
return server_now;
|
return server_now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
dashdemux2_element_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (gst_dash_demux2_debug,
|
||||||
|
"dashdemux2", 0, "dashdemux2 element");
|
||||||
|
|
||||||
|
if (!adaptivedemux2_base_element_init (plugin))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
ret = gst_element_register (plugin, "dashdemux2",
|
||||||
|
GST_RANK_PRIMARY + 1, GST_TYPE_DASH_DEMUX2);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -165,8 +165,6 @@ struct _GstDashDemux2Class
|
||||||
GType gst_dash_demux2_get_type (void);
|
GType gst_dash_demux2_get_type (void);
|
||||||
GType gst_dash_demux_stream_get_type (void);
|
GType gst_dash_demux_stream_get_type (void);
|
||||||
|
|
||||||
GST_ELEMENT_REGISTER_DECLARE (dashdemux2);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* __GST_DASH_DEMUX_H__ */
|
#endif /* __GST_DASH_DEMUX_H__ */
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ By using the api_lock a thread is protected against other API calls.
|
||||||
#include <gst/base/gstadapter.h>
|
#include <gst/base/gstadapter.h>
|
||||||
#include <gst/app/gstappsrc.h>
|
#include <gst/app/gstappsrc.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (adaptivedemux2_debug);
|
GST_DEBUG_CATEGORY_EXTERN (adaptivedemux2_debug);
|
||||||
#define GST_CAT_DEFAULT adaptivedemux2_debug
|
#define GST_CAT_DEFAULT adaptivedemux2_debug
|
||||||
|
|
||||||
#define DEFAULT_FAILED_COUNT 3
|
#define DEFAULT_FAILED_COUNT 3
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) 2021-2022 Jan Schmidt <jan@centricular.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gstadaptivedemuxelements.h"
|
||||||
|
#include "../soup/gstsouploader.h"
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY (adaptivedemux2_debug);
|
||||||
|
#define GST_CAT_DEFAULT adaptivedemux2_debug
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
adaptivedemux2_base_element_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
static gsize res = FALSE;
|
||||||
|
if (g_once_init_enter (&res)) {
|
||||||
|
GST_DEBUG_CATEGORY_INIT (adaptivedemux2_debug, "adaptivedemux2", 0,
|
||||||
|
"adaptivedemux2");
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) 2021-2022 Jan Schmidt <jan@centricular.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GST_ADAPTIVEDEMUX2_ELEMENTS_H__
|
||||||
|
#define __GST_ADAPTIVEDEMUX2_ELEMENTS_H__
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
gboolean adaptivedemux2_base_element_init (GstPlugin * plugin);
|
||||||
|
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (mssdemux2);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (hlsdemux2);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (dashdemux2);
|
||||||
|
|
||||||
|
#endif
|
|
@ -51,6 +51,7 @@
|
||||||
#include <gst/tag/tag.h>
|
#include <gst/tag/tag.h>
|
||||||
|
|
||||||
#include "gsthlselements.h"
|
#include "gsthlselements.h"
|
||||||
|
#include "gstadaptivedemuxelements.h"
|
||||||
#include "gsthlsdemux.h"
|
#include "gsthlsdemux.h"
|
||||||
|
|
||||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
@ -147,8 +148,9 @@ static void gst_hls_demux_stream_finalize (GObject * object);
|
||||||
G_DEFINE_TYPE (GstHLSDemuxStream, gst_hls_demux_stream,
|
G_DEFINE_TYPE (GstHLSDemuxStream, gst_hls_demux_stream,
|
||||||
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
|
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
|
||||||
|
|
||||||
GST_ELEMENT_REGISTER_DEFINE (hlsdemux2, "hlsdemux2",
|
static gboolean hlsdemux2_element_init (GstPlugin * plugin);
|
||||||
GST_RANK_PRIMARY + 1, GST_TYPE_HLS_DEMUX2);
|
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_CUSTOM (hlsdemux2, hlsdemux2_element_init);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
|
gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
|
||||||
|
@ -279,9 +281,6 @@ gst_hls_demux2_class_init (GstHLSDemux2Class * klass)
|
||||||
adaptivedemux_class->start_fragment = gst_hls_demux_start_fragment;
|
adaptivedemux_class->start_fragment = gst_hls_demux_start_fragment;
|
||||||
adaptivedemux_class->finish_fragment = gst_hls_demux_finish_fragment;
|
adaptivedemux_class->finish_fragment = gst_hls_demux_finish_fragment;
|
||||||
adaptivedemux_class->data_received = gst_hls_demux_data_received;
|
adaptivedemux_class->data_received = gst_hls_demux_data_received;
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_hls_demux2_debug, "hlsdemux2", 0,
|
|
||||||
"hlsdemux2 element");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2674,3 +2673,20 @@ gst_hls_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start,
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
hlsdemux2_element_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (gst_hls_demux2_debug, "hlsdemux2", 0,
|
||||||
|
"hlsdemux2 element");
|
||||||
|
|
||||||
|
if (!adaptivedemux2_base_element_init (plugin))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
ret = gst_element_register (plugin, "hlsdemux2",
|
||||||
|
GST_RANK_PRIMARY + 1, GST_TYPE_HLS_DEMUX2);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -246,7 +246,5 @@ GstHLSTimeMap *gst_hls_find_time_map (GstHLSDemux * demux, gint64 dsn);
|
||||||
GType gst_hls_demux2_get_type (void);
|
GType gst_hls_demux2_get_type (void);
|
||||||
GType gst_hls_demux_stream_get_type (void);
|
GType gst_hls_demux_stream_get_type (void);
|
||||||
|
|
||||||
GST_ELEMENT_REGISTER_DECLARE (hlsdemux2);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* __GST_HLS_DEMUX_H__ */
|
#endif /* __GST_HLS_DEMUX_H__ */
|
||||||
|
|
|
@ -41,6 +41,7 @@ plugin_sources = [
|
||||||
'plugin.c',
|
'plugin.c',
|
||||||
'gstisoff.c',
|
'gstisoff.c',
|
||||||
'gstadaptivedemux.c',
|
'gstadaptivedemux.c',
|
||||||
|
'gstadaptivedemuxelement.c',
|
||||||
'gstadaptivedemuxutils.c',
|
'gstadaptivedemuxutils.c',
|
||||||
'gstadaptivedemux-period.c',
|
'gstadaptivedemux-period.c',
|
||||||
'gstadaptivedemux-stream.c',
|
'gstadaptivedemux-stream.c',
|
||||||
|
|
|
@ -73,9 +73,11 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gstadaptivedemuxelements.h"
|
||||||
#include "gstmssdemux.h"
|
#include "gstmssdemux.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (mssdemux2_debug);
|
GST_DEBUG_CATEGORY (mssdemux2_debug);
|
||||||
|
#define GST_CAT_DEFAULT mssdemux2_debug
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_mss_demux_sink_template =
|
static GstStaticPadTemplate gst_mss_demux_sink_template =
|
||||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
@ -106,8 +108,9 @@ G_DEFINE_TYPE (GstMssDemux2, gst_mss_demux2, GST_TYPE_ADAPTIVE_DEMUX);
|
||||||
G_DEFINE_TYPE (GstMssDemuxStream, gst_mss_demux_stream,
|
G_DEFINE_TYPE (GstMssDemuxStream, gst_mss_demux_stream,
|
||||||
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
|
GST_TYPE_ADAPTIVE_DEMUX2_STREAM);
|
||||||
|
|
||||||
GST_ELEMENT_REGISTER_DEFINE (mssdemux2, "mssdemux2",
|
static gboolean mssdemux_element_init (GstPlugin * plugin);
|
||||||
GST_RANK_PRIMARY + 1, GST_TYPE_MSS_DEMUX2);
|
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_CUSTOM (mssdemux2, mssdemux_element_init);
|
||||||
|
|
||||||
static void gst_mss_demux_dispose (GObject * object);
|
static void gst_mss_demux_dispose (GObject * object);
|
||||||
|
|
||||||
|
@ -204,8 +207,6 @@ gst_mss_demux2_class_init (GstMssDemuxClass * klass)
|
||||||
gstadaptivedemux_class->requires_periodical_playlist_update =
|
gstadaptivedemux_class->requires_periodical_playlist_update =
|
||||||
gst_mss_demux_requires_periodical_playlist_update;
|
gst_mss_demux_requires_periodical_playlist_update;
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (mssdemux2_debug, "mssdemux2", 0,
|
|
||||||
"mssdemux2 element");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -688,3 +689,21 @@ gst_stream_type_from_mss_type (GstMssStreamType mtype)
|
||||||
return GST_STREAM_TYPE_UNKNOWN;
|
return GST_STREAM_TYPE_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
mssdemux_element_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (mssdemux2_debug, "mssdemux2", 0,
|
||||||
|
"mssdemux2 element");
|
||||||
|
|
||||||
|
if (!adaptivedemux2_base_element_init (plugin))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
ret =
|
||||||
|
gst_element_register (plugin, "mssdemux2", GST_RANK_PRIMARY + 1,
|
||||||
|
GST_TYPE_MSS_DEMUX2);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_EXTERN (mssdemux2_debug);
|
|
||||||
#define GST_CAT_DEFAULT mssdemux2_debug
|
|
||||||
|
|
||||||
#define GST_TYPE_MSS_DEMUX2 \
|
#define GST_TYPE_MSS_DEMUX2 \
|
||||||
(gst_mss_demux2_get_type())
|
(gst_mss_demux2_get_type())
|
||||||
#define GST_MSS_DEMUX(obj) \
|
#define GST_MSS_DEMUX(obj) \
|
||||||
|
@ -80,7 +77,7 @@ struct _GstMssDemux2Class {
|
||||||
GType gst_mss_demux2_get_type (void);
|
GType gst_mss_demux2_get_type (void);
|
||||||
GType gst_mss_demux_stream_get_type (void);
|
GType gst_mss_demux_stream_get_type (void);
|
||||||
|
|
||||||
GST_ELEMENT_REGISTER_DECLARE (mssdemux2);
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_MSSDEMUX_H__ */
|
#endif /* __GST_MSSDEMUX_H__ */
|
||||||
|
|
|
@ -21,23 +21,13 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dash/gstdashdemux.h"
|
#include "gstadaptivedemuxelements.h"
|
||||||
#include "hls/gsthlsdemux.h"
|
|
||||||
#include "mss/gstmssdemux.h"
|
|
||||||
#include "../soup/gstsouploader.h"
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
|
|
||||||
#ifndef STATIC_SOUP
|
|
||||||
if (!gst_soup_load_library ()) {
|
|
||||||
GST_WARNING ("Failed to load libsoup library");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret |= GST_ELEMENT_REGISTER (hlsdemux2, plugin);
|
ret |= GST_ELEMENT_REGISTER (hlsdemux2, plugin);
|
||||||
ret |= GST_ELEMENT_REGISTER (dashdemux2, plugin);
|
ret |= GST_ELEMENT_REGISTER (dashdemux2, plugin);
|
||||||
ret |= GST_ELEMENT_REGISTER (mssdemux2, plugin);
|
ret |= GST_ELEMENT_REGISTER (mssdemux2, plugin);
|
||||||
|
|
Loading…
Reference in a new issue