ciscorn / ldoce5viewer

⚠️ This software is no longer actively maintained -- Fast, free dictionary viewer for the Longman Dictionary of Contemporary English (LDOCE) 5th ed.
https://forward-backward.co.jp/ldoce5viewer/
Other
303 stars 127 forks source link

problems when both GST 1.0 and Phonon are installed #39

Open chemaper opened 8 years ago

chemaper commented 8 years ago

Hi,

I've installed ldoce5viewer in CentOS7 and it works great, but there is a problem with the sound that I've fixed modifying the source code. It occurs when both Gstreamer 1.0 and Qt-Phonon are available. This is the case of CentOS7, because PyQt4-4.10.1-13.el7.x86_64 depends on phonon-backend-gstreamer.

The problem is at file ldoce5viewer/qtgui/utils/soundplayer.py. It tries several engines, including Gstreamer 1.0 and Qt-Phonon and finally uses Phonon. The problem is that when detecting Gstreamer 1.0, it run Gst.init(None). This causes a hang later in the line:

self._player = Phonon.createPlayer(Phonon.NoCategory)

And the following messages are printed:

/usr/lib/python2.7/site-packages/ldoce5viewer/qtgui/utils/soundplayer.py:220: Warning: cannot register existing type 'GstObject' self._player = Phonon.createPlayer(Phonon.NoCategory) /usr/lib/python2.7/site-packages/ldoce5viewer/qtgui/utils/soundplayer.py:220: Warning: g_once_init_leave: assertion 'result != 0' failed self._player = Phonon.createPlayer(Phonon.NoCategory) /usr/lib/python2.7/site-packages/ldoce5viewer/qtgui/utils/soundplayer.py:220: Warning: g_type_register_static: assertion 'parent_type > 0' failed self._player = Phonon.createPlayer(Phonon.NoCategory) /usr/lib/python2.7/site-packages/ldoce5viewer/qtgui/utils/soundplayer.py:220: Warning: g_object_newv: assertion 'G_TYPE_IS_OBJECT (object_type)' failed self._player = Phonon.createPlayer(Phonon.NoCategory)

A quick workaround is to change the order of engines in create_soundplayer, to use GStreamer 1.0 instead of Phonon it both are available. But probably the real solution if moving Gst.init(None) to the init method of the GST 1.0 engine, but I don't know if the code of other platforms may be affected.

chemaper commented 8 years ago

A python file to show how the code works/fails depending of the call to Gst.init(None) test.txt