summaryrefslogtreecommitdiff
path: root/ext/rtmp
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2014-06-05 09:40:38 +0200
committerEdward Hervey <bilboed@bilboed.com>2014-06-05 09:41:31 +0200
commit5300e59f09a5aa97492862791f18a8afa9277cbd (patch)
treed6314e34c6e64c73b413bfa0039820f20bc03205 /ext/rtmp
parent3cb5bc886869349c75ad2f1c6662a899b166bb91 (diff)
downloadgstreamer-plugins-bad-5300e59f09a5aa97492862791f18a8afa9277cbd.tar.gz
rtmp: proxy logging from librtmp
Helps with debugging various librtmp issues
Diffstat (limited to 'ext/rtmp')
-rw-r--r--ext/rtmp/gstrtmp.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/ext/rtmp/gstrtmp.c b/ext/rtmp/gstrtmp.c
index 2b9dfbe28..76173f3ed 100644
--- a/ext/rtmp/gstrtmp.c
+++ b/ext/rtmp/gstrtmp.c
@@ -34,11 +34,61 @@
#include "gstrtmpsrc.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
plugin_init (GstPlugin * plugin)
{
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,
GST_TYPE_RTMP_SRC);
ret &= gst_element_register (plugin, "rtmpsink", GST_RANK_PRIMARY,