Tuesday, 28 December 2010

android gstreamer debug information can not work

在android上面做一些gstreamer的工作
尝试显示出gstreamer自己的调试信息
在android模拟器上面运行:

gst-launch-0.10 --gst-debug-level=1 audiotestsrc ! audioflingersink

结果显示:

Could not open converter from 'ASCII' to 'UTF-8'

调试发现:libiconv在android上面已经移除了

在gconvert.c g_convert()中添加了以上代码自己转换,将ASCII 转换成 UTF-8,debug 消息就可以打印出来了

//--> allen add for testing
printf("allen in gconvert.c g_convert() %s %d\n", str, len);
gsize retval;
gchar *utf;
gsize utfmax;
if (len < 0)
{
len = strlen (str);
}
utfmax = 2 * (len + 1);
printf("utfmax: %d\n", utfmax);
utf = g_malloc (utfmax);
for (retval = 0; *str && utfmax > 1; utfmax -= 2, retval += 2)
{
*(utf + retval/2) = *(str + retval/2);
*(utf + retval/2 + 1) = 0;
}
if (utfmax > 0)
{
*utf = *str;
++retval;
}
if (bytes_read)
*bytes_read = len + 1;
if (bytes_written)
*bytes_written = retval;
printf("allen in gconvert.c g_convert() %s %d\n", utf, utfmax);
return utf;
//<--end

No comments:

Post a Comment