2013-12-09 239 views
2

我想在mac上使用pyside的聲子。我希望能夠使用pyside在臺式機應用程序的小部件中播放Quicktime電影。如何在mac osx上安裝macports pyside

我安裝聲子,經由的MacPorts

$ sudo port -s -v install phonon qt4-mac 
$ sudo port -s -v install py27-pyside 

我可以確認安裝如下

$ port installed phonon qt4-mac 
The following ports are currently installed: 
    phonon @4.6.0_1 (active) 
    qt4-mac @4.8.5_0 (active) 

我發現一個簡單的代碼位來測試此從源Qt和pyside ..

import sys 
from PySide import QtCore, QtGui 
from PySide.phonon import Phonon 

app = QtGui.QApplication(sys.argv) 
testPlayer = Phonon.VideoPlayer() 
testMedia = Phonon.MediaSource('/path/to/media/test_MOV.MOV') 
testPlayer.load(testMedia) 
testPlayer.play() 
testPlayer.show() 

sys.exit(app.exec_()) 

但是在pycharm中運行代碼時出現以下錯誤。

Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded! 
WARNING: Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: Phonon::createPath: Cannot connect Phonon::MediaObject (no objectName) to Phonon::AudioOutput (no objectName). 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: Phonon::createPath: Cannot connect Phonon::MediaObject (no objectName) to Phonon::VideoWidget (no objectName). 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded 

它看起來像後端不能正常工作,並且聲子沒有連接到quicktime?如果是這種情況,我是否會解決這個問題?我如何設置插件路徑? - 我找不到有關osx的信息。

或者還有另一種更好的方法來播放pyside而不是聲子的音頻的快速時間嗎?

在此先感謝。

+0

好奇,如果這個解決它給你:'sudo的港口安裝聲子於後端的gstreamer'(我的機器將無法構建,由於某種原因) –

回答

0

運行下面的命令,似乎這些都列出來,但並沒有載入

sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist 
sudo launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist 
+0

這並不適用於我。我使用'PyQt4'獲得與OP相同的錯誤。另外,我不能'sudo端口安裝phonon-backend-gstreamer',因爲:https://trac.macports.org/ticket/50049 –