mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 17:52:29 +00:00
rtmp: proxy logging from librtmp
Helps with debugging various librtmp issues
This commit is contained in:
parent
3cb5bc8868
commit
5300e59f09
1 changed files with 50 additions and 0 deletions
|
@ -34,11 +34,61 @@
|
||||||
#include "gstrtmpsrc.h"
|
#include "gstrtmpsrc.h"
|
||||||
#include "gstrtmpsink.h"
|
#include "gstrtmpsink.h"
|
||||||
|
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
GST_DEBUG_CATEGORY_STATIC (rtmp_debug);
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtmp_log_callback (int level, const gchar * fmt, va_list vl)
|
||||||
|
{
|
||||||
|
GstDebugLevel gst_level;
|
||||||
|
|
||||||
|
switch (level) {
|
||||||
|
case RTMP_LOGCRIT:
|
||||||
|
case RTMP_LOGERROR:
|
||||||
|
gst_level = GST_LEVEL_ERROR;
|
||||||
|
break;
|
||||||
|
case RTMP_LOGWARNING:
|
||||||
|
gst_level = GST_LEVEL_WARNING;
|
||||||
|
break;
|
||||||
|
case RTMP_LOGDEBUG:
|
||||||
|
gst_level = GST_LEVEL_DEBUG;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gst_level = GST_LEVEL_INFO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_debug_log_valist (rtmp_debug, gst_level, "", "", 0, NULL, fmt, vl);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_set_debug_level (void)
|
||||||
|
{
|
||||||
|
GstDebugLevel gst_level;
|
||||||
|
|
||||||
|
RTMP_LogSetCallback (gst_rtmp_log_callback);
|
||||||
|
gst_level = gst_debug_category_get_threshold (rtmp_debug);
|
||||||
|
if (gst_level >= GST_LEVEL_LOG)
|
||||||
|
RTMP_LogSetLevel (RTMP_LOGALL);
|
||||||
|
else if (gst_level >= GST_LEVEL_DEBUG)
|
||||||
|
RTMP_LogSetLevel (RTMP_LOGDEBUG);
|
||||||
|
else if (gst_level >= GST_LEVEL_INFO)
|
||||||
|
RTMP_LogSetLevel (RTMP_LOGINFO);
|
||||||
|
else if (gst_level >= GST_LEVEL_WARNING)
|
||||||
|
RTMP_LogSetLevel (RTMP_LOGWARNING);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
GST_DEBUG_CATEGORY_INIT (rtmp_debug, "rtmp", 0, "libRTMP logging");
|
||||||
|
_set_debug_level ();
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = gst_element_register (plugin, "rtmpsrc", GST_RANK_PRIMARY,
|
ret = gst_element_register (plugin, "rtmpsrc", GST_RANK_PRIMARY,
|
||||||
GST_TYPE_RTMP_SRC);
|
GST_TYPE_RTMP_SRC);
|
||||||
ret &= gst_element_register (plugin, "rtmpsink", GST_RANK_PRIMARY,
|
ret &= gst_element_register (plugin, "rtmpsink", GST_RANK_PRIMARY,
|
||||||
|
|
Loading…
Reference in a new issue