gstreamer playbin - setting uri on windows

回眸只為那壹抹淺笑 提交于 2019-12-10 10:41:01

问题


I am trying to play some audio files with the CLI example on this site:

http://pygstdocs.berlios.de/pygst-tutorial/playbin.html http://pygstdocs.berlios.de/pygst-tutorial/playbin.html

I am on windows and it is giving error while reading the file. I specified the following path:

$ 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

How should I specify the file path on windows??

Also, is there anything special I need to do in this line of code?

self.player.set_property("uri", "file://" + filepath)

Thank you!


回答1:


As you may have suspected, this code is rather badly written:

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

Use something like this:

'file:' + urllib.pathname2url(filepath)

and (in the command line) specify the file path in normal Windows notation, e.g. C:\a\b.mp3.




回答2:


Did you notice the actual path you've got is file:///C:/file:/C:/voice.mp3?

The correct path should be: file:///C:/path/to/voice.mp3.



来源:https://stackoverflow.com/questions/2216064/gstreamer-playbin-setting-uri-on-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!