def sendNavigationKeypress(self, keyname): # Reacts to someone pressing a key on the video window. # Create the structure. structure = gst.Structure("application/x-gst-navigation") structure.set_value("event", "key-press") structure.set_value("key", keyname) # Send the event. return self.player.get_property('video-sink').get_pad('navPad').send_event(gst.event_new_navigation(structure))
def sendNavigationClick(self, event): ## Reacts to someone clicking on the video window. # Make sure we actually have a stream running. if (self.isStopped()): return # Get the current video src and sink sizes. srcDim = self.getVideoSrcDimensions() sinkDim = useful.videoWindowSize if (not sinkDim or not srcDim): return False # Translate the clicked co-ordinates to a point on the video. modX = event.x * (float(srcDim[0]) / sinkDim[0]) modY = event.y * (float(srcDim[1]) / sinkDim[1]) # Create a structure to be used for navigation. structure = gst.Structure("application/x-gst-navigation") structure.set_value("event", "mouse-button-release") structure.set_value("button", event.button) structure.set_value("pointer_x", modX) structure.set_value("pointer_y", modY) # Actually send the navigation event to gstreamer. return self.player.get_property('video-sink').get_pad('navPad').send_event(gst.event_new_navigation(structure))