不要以爲這是可能的普通gst啓動,但你可以用python和pygst做到這一點。 只要處理MESSAGE_EOS
並更新uri
屬性與下一個文件。
這裏是pygst tutorial例2.3(這你想要做什麼,但增加了〜文件之間0.5秒的延遲)修改後的代碼:
#!/usr/bin/env python
import sys, os
import glib, gobject
import pygst
pygst.require("0.10")
import gst
class CLI_Main:
def __init__(self):
self.player = gst.element_factory_make("playbin2", "player")
fakesink = gst.element_factory_make("fakesink", "fakesink")
self.player.set_property("video-sink", fakesink)
bus = self.player.get_bus()
bus.add_signal_watch()
bus.connect("message", self.on_message)
self.currentFile = 1
self.play(self.currentFile)
def play(self, n):
filePath = "file://" + sys.argv[n]
self.player.set_property("uri", filePath)
self.player.set_state(gst.STATE_PLAYING)
def on_message(self, bus, message):
t = message.type
if t == gst.MESSAGE_EOS:
self.player.set_state(gst.STATE_NULL)
self.currentFile += 1
if self.currentFile < len(sys.argv):
self.play(self.currentFile)
else:
loop.quit()
elif t == gst.MESSAGE_ERROR:
self.player.set_state(gst.STATE_NULL)
err, debug = message.parse_error()
print "Error: %s" % err, debug
loop.quit()
mainclass = CLI_Main()
gobject.threads_init()
loop = glib.MainLoop()
loop.run()
「我的Linux發行版有一些bug」 [來源] – 2012-03-24 04:31:29
你應該張貼關於發行版的跟蹤器的錯誤報告,並看看如何去:)。 – Corbin 2012-03-24 04:38:11
我也在研究這個bug的修復方法,但是如上所述的使用bash的解決方法是這篇特定文章的原因。我想有一個簡單的解決方法,我可以在幾分鐘內應用而不需要一些驅動程序或內核補丁。 – User1 2012-03-24 12:42:51