def queue_file(self, filename, name=None, pos=0, userdata=None): try: os.stat(filename) except: print "file not found",filename return if name is None: name = os.path.split(filename)[1] if RUNNING_HILDON: ext = os.path.splitext(filename)[1][1:] known_good = ['mp3', 'wav', 'm4a', 'wma', 'mpg', 'avi', '3gp', 'rm', 'asf', 'mp4'] try: gst.element_factory_make("oggdemux", "test") known_good += ['ogg'] except: pass self._on_type_discovered(None, ext in known_good, filename, name, pos, userdata) else: #thanks gstfile.py d = Discoverer(filename) d.connect('discovered', self._on_type_discovered, filename, name, pos, userdata) d.discover()
def _discover_one(self): """ Callback to start media discovery process, used to retrieve video parameters. """ discoverer = Discoverer(self.source) discoverer.connect('discovered', self._discovered) discoverer.discover() return False
def _discover_one(self): if not len(self.files): gobject.idle_add(self.mainloop.quit) return False filename = self.files.pop(0) if not os.path.isfile(filename): gobject.idle_add(self._discover_one) return False print "Running on", filename # create a discoverer for that file self.current = Discoverer(filename) # connect a callback on the 'discovered' signal self.current.connect('discovered', self._discovered) # start the discovery self.current.discover() return False
def _run(self, filename, cutlist, app): self.app = app self.config = app.config self.filename = filename self.cutlist = self.load_cutlist(cutlist) self.keyframes, error = self.get_keyframes_from_file(filename) if self.keyframes == None: print "Error: Keyframes konnten nicht ausgelesen werden." self.movie_window.set_size_request( self.config.get('general', 'cutinterface_resolution_x'), self.config.get('general', 'cutinterface_resolution_y')) self.hide_cuts = self.config.get('general', 'cutinterface_hide_cuts') def discovered(d, is_media): if is_media: self.videolength = d.videolength self.framerate_num = d.videorate.num self.framerate_denom = d.videorate.denom self.frames = self.videolength * self.framerate_num / self.framerate_denom / gst.SECOND self.key_seek.stepnanoseconds = 25 * gst.SECOND * self.framerate_denom / self.framerate_num self.timelines = [ self.get_cuts_in_frames(self.initial_cutlist, self.initial_cutlist_in_frames) ] self.videowidth = d.videowidth self.videoheight = d.videoheight self.ready_callback() else: print "error: %r does not appear to be a media file" % filename self.d = Discoverer(filename) self.d.connect("discovered", discovered) self.d.discover() if gtk.RESPONSE_OK == self.run(): self.set_cuts(self.cutlist, self.timelines[-1]) else: self.set_cuts(self.cutlist, []) if self.timer != None: gobject.source_remove(self.timer) return self.cutlist
def discover(self): infile = self.infiles[self.i] discoverer = Discoverer(infile) discoverer.connect('discovered', self.on_discovered, infile) discoverer.discover() return False # Don't repeat idle call