DeaDBeeF 0.5.6 + DeaDBeeF-MPRIS-plugin + OSD Lyrics 完美显示歌词

1. DeaDBeeF-MPRIS-plugin 非线程安全的问题

OSD Lyrics 这个歌词显示程序已经有一段时间没有用上了。
原因是DeaDBeeF-MPRIS-plugin 使用的dbus库(glib-dbus)是非线程安全的,并且,和DeaDBeeF所要使用的gtkui库有冲突。
见: http://code.google.com/p/deadbeef-mpris-plugin/issues/detail?id=11

glib-dbus is not threadsafe, and will crash deadbeef 0.5.5 on startup
What steps will reproduce the problem?
run deadbeef 0.5.5 with the mpris plugin

What is the expected output? What do you see instead?

deadbeef looses X server connection on startup, or crashes in glib-dbus calls.

What version of the product are you using? On what operating system?

deadbeef 0.5.5 with gtkui, any version of mpris.so

Please provide any additional information below.

glib-dbus is not thread-safe, and conflicts with gtkui, which is now using dbus for session manager interaction (via eggsmclient).

this thread has more information: http://comments.gmane.org/gmane.comp.freedesktop.dbus/14013

recommended solution is to use GDBus instead of glib-dbus, or use libdbus directly.

that was the main reason why glib was highly not recommended to use in deadbeef plugins (i had the same problems with glib-dbus while developing libnotify plugin, which is why i had to rewrite it using libdbus directly instead of libnotify).

不过ArchLinux用户对此问题无需担心。AUR上已经有人提交patch了:
http://kode54.net/deadbeef-MPRIS-plugin-2.1.5-glibfix.patch.gz

还有是DeaDBeeF显示中文的问题,我看到在0.5.6版中作者已经解决了。因此,不用打我之前写的那个patch了。

另外,编译这个插件时,还会碰到一个 g_type_init() is deprecated的问题。
由于 g_type_init is deprecated after 2.36 ,因此,加个宏判断就是了。

1
2
3
4
#if GLIB_VERSION_CUR_STABLE < GLIB_VERSION_2_36
    /* g_type_init is deprecated after 2.36 */
    g_type_init();
#endif

打好补丁的文件在:
http://git.ihacklog.com/repo/DeaDBeeF-MPRIS-plugin.git/
直接 git clone git://ihacklog.com/DeaDBeeF-MPRIS-plugin.git 吧。

2. DeaDBeeF显示中文的问题

DeaDBeeF的作者给junklib.c 加了一个canbe_chinese的函数来判断中文。
不过默认是没有启用中文检测的,需要修改junklib.c把检测中文开启。然后再编译。

3. osdlyrics 编译时ol_singleton.c:34:1: error: unknown type name ‘int64_t’错误的问题

修改src/ol_singleton.c b/src/ol_singleton.c ,加上

1
#include <inttypes.h>

即可
adding #include in ol_singleton.c fixes this compilation error. i am not sure if this header file is portable among systems.
@see https://code.google.com/p/osd-lyrics/issues/detail?id=301

修改好了的: git clone git://ihacklog.com/osdlyrics.git

更多
3 Responses Post a comment
  1. 荒野无灯

    @pchu
    原来如此。那个quote的内容是在google group上看到的,就信以为真的。然后patch其实是在aur上看到的。
    pchu兄功力颇厚,评论一针见血。

  2. pchu

    其实那个不是GDBus 或者 glib-dbus 的线程安全问题。
    我最近装了deadbeef 0.6.1.5 以及github(https://github.com/kernelhcy/DeaDBeeF-MPRIS-plugin)上的MPRIS plugin,结果crash了

    捣鼓了好久之后仔细一看才发现,所谓glib-dbus其实就是GDBus(是glib底下的gio的一部分),另外那个obsolete的其实叫做dbus-glib(是dbus lib的一部分呢)。而MPRIS plugin的代码从一开始就是用的GDBus。
    根据文章提供的patch来看,bug的问题出在mpris.c要用mutual exclusive thread才对而不是mainloop

    不知道为什么github repository有过几次commit但是从没有打上这个patch
    所以我下载了最新的snapshot之后手动改mpris.c,顺便给Makefile.am 的AM_CFLAGS 加上 -I/opt/deadbeef/include (因为官方ubuntu deb就是装在了这里)
    ./autogen.sh
    ./configure --prefix=/opt/deadbeef
    make
    sudo make install
    然后就能用了

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS