python 3.x - GStreamer How to get the number of current frame? -


i using code: http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/video-player-1.0 display video, plus buttons pause , resume using code:

def pauseb(self):     #code checks if playing     self.player.set_state(gst.state.paused)  def playb(self):     #code checks if video valid , paused or stoped     self.player.set_state(gst.state.playing) 

when in pause mode can time position using:

success, position = self.videoplayer.player.query_position(gst.format.time) 

converting time frame not accurate. there way find number of current displayed frame (not converting time)?

gstreamer pipelines aren't synchronous or linear. can use queue elements run in multiple threads , tee elements branch multiple sinks. thus, current frame @ different values in different portions of pipeline.

you have relatively simple pipeline , know current frame relative final output. in case i'd suggest add identity element before sink:

... ! identity name=frame_count ! ximagesink

increment value each time callback invoked , read when needed. apologies c, gist of code is:

gstelement* frame_count = gst_bin_get_by_name(gst_bin(your_bin), "frame_count"); g_signal_connect(g_object(frame_count), "handoff",                   g_callback(frame_count_callback),                   some_object_to_accumulate_the_frame_count_in); 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -