什么是"export GST_DEBUG =&#;#"等价于Android? [英] What is the 'export GST_DEBUG=<#>' equivalent for Android?
问题描述
在Linux系统上,我已经使用'export GST_DEBUG =<#>'来调试程序对GStreamer的使用问题.我现在正在Android上工作,并且想做同样的事情-请参阅logcat输出中包含的GStreamer输出.
On Linux systems I've used 'export GST_DEBUG=<#>' to debug problems with a program's use of GStreamer. I'm now working on Android and would like to do the same - see the GStreamer output included in the logcat output.
我有一个Google Nexus 5手机,并且正在使用full_hammerhead_userdebug版本.我已经看到以下建议:
I have a Google Nexus 5 phone and I'm using the full_hammerhead_userdebug build. I've seen the following suggested:
Add the following in JNI_OnLoad:
setenv("GST_DEBUG", "*:5", 1);
setenv("GST_DEBUG_NO_COLOR", "1", 1);
不幸的是,我正在尝试调试C库,因此,我希望在环境中进行一些设置以启用调试输出.我试图将以下行添加到build.prop:
Unfortunately I'm trying to debug a C library, so I would prefer to set something in the environment to enable the debug output. I tried to add the following lines to build.prop:
export GST_DEBUG=3
GST_DEBUG=3
log.redirect-stdio=true
那没有用.我没有正确启用GST_DEBUG或我没有正确地重定向它.否则我会偏离正轨,我应该做些其他的事情.如何在Android上启用GST_DEBUG?
That didn't work. Either I'm not enabling GST_DEBUG properly or I'm not redirecting it properly. Or I'm way off track and I should be doing something else. How can I enable GST_DEBUG with Android?
P.S.这个问题类似于一个,但是这个问题并不完全回答我的问题.
P.S. This question is similar to one, but that one didn't completely answer my question.
推荐答案
我最终朝另一个方向解决了这个问题.首先,我创建了自己的GstLogFunction()
I ended up going in another direction to solve this problem. First I created my own GstLogFunction()
void gstAndroidLog(GstDebugCategory * category,
GstDebugLevel level,
const gchar * file,
const gchar * function,
gint line,
GObject * object,
GstDebugMessage * message,
gpointer data)
{
if (level <= gst_debug_category_get_threshold (category))
{
__android_log_print(ANDROID_LOG_ERROR, "MY_APP", "%s,%s: %s",
file, function, gst_debug_message_get(message));
}
}
然后在调用gst_init()之后,我设置了日志级别.如果我想查看所有内容,可以设置:
Then after gst_init() is called, I set up the log levels. If I want to see everything, I can set:
gst_debug_set_default_threshold( GST_LEVEL_DEBUG );
如果我只想查看特定类别中发生的事情,可以设置:
If I just want to see what is happening in a specific category, I can set:
gst_debug_set_threshold_for_name ("tcpclientsink", GST_LEVEL_LOG);
然后我只需要注册我创建的日志功能:
Then I just need to register the log function I created:
gst_debug_add_log_function(&gstAndroidLog, NULL);
这篇关于什么是"export GST_DEBUG =&#;#"等价于Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!