Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法在gstreamer中从中间播放歌曲? 我在Python gStuffe中寻找歌曲的方法不是从初学者开始的,考虑一下: import threading import gst import gobject class GobInit(threading.Thread): ... class BasicPlayer(threading.Thread): def __init__(self, musiclist): threading.Thread.__init__(self) self.musiclist = musiclist self.song_num = 0 self.construct_pipeline() self.set_property_file() def construct_pipeline(self): self.player = gst.element_factory_make("playbin") self.is_playing = False self.connect_signals() def connect_signals(self): ... def play(self): self.is_playing = True self.player.set_state(gst.STATE_PLAYING) def set_property_file(self): self.player.set_property( "uri", "file://"+"/home/user/work/mp3/"+self.musiclist[ self.song_num]) def main(): gob = GobInit() gob.start() print('start') player = BasicPlayer(['test1.mp3', 'test2.mp3', 'test3.mp3']) print('player created') player.play() print('start play') main()_Python_Gstreamer - Fatal编程技术网

有没有办法在gstreamer中从中间播放歌曲? 我在Python gStuffe中寻找歌曲的方法不是从初学者开始的,考虑一下: import threading import gst import gobject class GobInit(threading.Thread): ... class BasicPlayer(threading.Thread): def __init__(self, musiclist): threading.Thread.__init__(self) self.musiclist = musiclist self.song_num = 0 self.construct_pipeline() self.set_property_file() def construct_pipeline(self): self.player = gst.element_factory_make("playbin") self.is_playing = False self.connect_signals() def connect_signals(self): ... def play(self): self.is_playing = True self.player.set_state(gst.STATE_PLAYING) def set_property_file(self): self.player.set_property( "uri", "file://"+"/home/user/work/mp3/"+self.musiclist[ self.song_num]) def main(): gob = GobInit() gob.start() print('start') player = BasicPlayer(['test1.mp3', 'test2.mp3', 'test3.mp3']) print('player created') player.play() print('start play') main()

有没有办法在gstreamer中从中间播放歌曲? 我在Python gStuffe中寻找歌曲的方法不是从初学者开始的,考虑一下: import threading import gst import gobject class GobInit(threading.Thread): ... class BasicPlayer(threading.Thread): def __init__(self, musiclist): threading.Thread.__init__(self) self.musiclist = musiclist self.song_num = 0 self.construct_pipeline() self.set_property_file() def construct_pipeline(self): self.player = gst.element_factory_make("playbin") self.is_playing = False self.connect_signals() def connect_signals(self): ... def play(self): self.is_playing = True self.player.set_state(gst.STATE_PLAYING) def set_property_file(self): self.player.set_property( "uri", "file://"+"/home/user/work/mp3/"+self.musiclist[ self.song_num]) def main(): gob = GobInit() gob.start() print('start') player = BasicPlayer(['test1.mp3', 'test2.mp3', 'test3.mp3']) print('player created') player.play() print('start play') main(),python,gstreamer,Python,Gstreamer,所以我只有这个函数可以启动: self.player.set_state(gst.STATE_PLAYING) 但我敢打赌,有一种方法可以从歌曲的中间开始播放,就像这样: self.player.play_from_middle(gst.STATE_PLAYING, <sec_after_begin>) self.player.play\u从中间(gst.STATE\u PLAYING,) 或者我可以倒回歌曲,让它从中间播放吗?是的,我想应该有几种方法,但我马上想到的一种方法(

所以我只有这个函数可以启动:

self.player.set_state(gst.STATE_PLAYING)
但我敢打赌,有一种方法可以从歌曲的中间开始播放,就像这样:

self.player.play_from_middle(gst.STATE_PLAYING, <sec_after_begin>)
self.player.play\u从中间(gst.STATE\u PLAYING,)

或者我可以倒回歌曲,让它从中间播放吗?

是的,我想应该有几种方法,但我马上想到的一种方法(对于非直播流)是:

  • 将管道设置为暂停而不是播放
  • 等待GST\u message\u ASYNC\u DONE消息出现在总线处理程序中
  • 查询管道(gst_元素_查询())的持续时间,然后查找管道(gst_元素_搜索())的持续时间/2次
  • 将管道设置为播放

是的,我想应该有几种方法,但我马上想到的一种方法(对于非实时流):

  • 将管道设置为暂停而不是播放
  • 等待GST\u message\u ASYNC\u DONE消息出现在总线处理程序中
  • 查询管道(gst_元素_查询())的持续时间,然后查找管道(gst_元素_搜索())的持续时间/2次
  • 将管道设置为播放