簡體   English   中英

gstreamer playbin - 在窗戶上設置uri

[英]gstreamer playbin - setting uri on windows

我試圖在此站點上使用CLI示例播放一些音頻文件:

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)

謝謝!

正如您可能懷疑的那樣,這段代碼編寫得很糟糕:

for filepath in sys.argv[1:]:
    # ...
    self.player.set_property("uri", "file://" + filepath)

使用這樣的東西:

'file:' + urllib.pathname2url(filepath)

和(在命令行中)以正常的Windows表示法指定文件路徑,例如C:\\a\\b.mp3

您是否注意到您獲得的實際路徑是file:///C:/file:/C:/voice.mp3

正確的路徑應該是: file:///C:/path/to/voice.mp3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM