我試圖發揮在這個網站與CLI例如一些音頻文件:的GStreamer playbin - 設置URI在Windows
http://pygstdocs.berlios.de/pygst-tutorial/playbin.html http://pygstdocs.berlios.de/pygst-tutorial/playbin.html
我在Windows和它給錯誤讀取文件。我指定了 以下路徑:
$ python cliplayer.py C:\\voice.mp3
0:00:00.125000000 3788 009DA010 ERROR basesrc
gstbasesrc.c:2834:gst_base_src_activate_pull:<source> Failed to start in
pull mode
Error: Could not open resource for reading.
..\..\..\Source\gst-plugins-base\ext\gio\gstgiosrc.c(324):
gst_gio_src_get_stream():
/GstPlayBin2:player/GstURIDecodeBin:uridecodebin0/GstGioSrc:source:
Could not open location file:///C:/file:/C:/voice.mp3 for reading: Error
opening file: Invalid argument
我應該如何在Windows上指定文件路徑?
此外,有什麼特殊的我需要在這行代碼中做?
self.player.set_property("uri", "file://" + filepath)
謝謝!
urllib.pathname2url是一個很好的建議...我沒有嘗試過,但看起來它會工作... btw還有另一種方法filename_to_uri ...沒有檢查它做什麼,但應該轉換路徑去... ...。另一方面,file:///(三斜槓)解決了Windows上的問題。 – cppb 2010-02-08 05:29:25