gstreamer playbin-在Windows上设置uri [英] gstreamer playbin - setting uri on windows

查看:207
本文介绍了gstreamer playbin-在Windows上设置uri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此站点上的CLI示例来播放一些音频文件:

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

我在Windows上,读取文件时出现错误.我指定 以下路径:

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

如何在Windows上指定文件路径?

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)

谢谢!

推荐答案

您可能会怀疑,这段代码写得很糟糕:

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

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

使用类似这样的内容:

'file:' + urllib.pathname2url(filepath)

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

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

这篇关于gstreamer playbin-在Windows上设置uri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆