Changeset 2511
- Timestamp:
- 2006-10-02 13:07:52 (2 years ago)
- Files:
-
- keystroke/trunk/keystroke.py (modified) (4 diffs)
- keystroke/trunk/textsrc.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
keystroke/trunk/keystroke.py
r2510 r2511 210 210 clip_now = self.current_clip(self.pipeline.query_position(gst.FORMAT_TIME)[0]/gst.MSECOND) 211 211 if clip_now > 0: 212 self.seek(self.times[self.current_track]['start'][clip_now-1] ,self.times[self.current_track]['start'][clip_now])212 self.seek(self.times[self.current_track]['start'][clip_now-1]) 213 213 214 214 #Highlight chapter entry. … … 286 286 #Push relevant text to overlay. 287 287 return result 288 288 289 289 def push_text_cb(self, accel_group, window, keyval, modifier): 290 290 self.push_text() 291 291 292 def push_text(self, start=None,end=None): 293 #data = self.export_buffer() 294 #for clip in data["subtitle-en"]: 295 #buf = gst.Buffer (clip[2]) 296 #buf.timestamp = to_ms(clip[0])*gst.MSECOND 297 #buf.duration = (to_ms(clip[1]) - to_ms(clip[0]))*gst.MSECOND 298 #print "time: " + str(buf.timestamp) + " duration: " + str(buf.duration) 299 #print self.text_pad.push (buf) 292 def push_text(self): 293 data = self.export_buffer() 294 self.textsource.clear() 295 print "PUSH TEXT" 296 for clip in data["subtitle-en"]: 297 desc = clip[2] 298 timestamp = to_ms(clip[0])*gst.MSECOND 299 duration = (to_ms(clip[1]) - to_ms(clip[0]))*gst.MSECOND 300 self.textsource.append(timestamp, duration, desc) 300 301 pass 301 302 … … 598 599 self.progress.props.fraction = x/total_clips 599 600 self.pipeline_duration = self.pipeline.query_duration(gst.FORMAT_TIME)[0]/gst.MSECOND 601 self.push_text() 600 602 if (end_time!="" and to_ms(end_time) < self.pipeline_duration-3*60*1000) or to_ms(start_time) < self.pipeline_duration-4*60*1000: #If last clip is towards end, skip and play from the beginning. If not go to the last clip. 601 603 if end_time!="": … … 649 651 elif message.type == gst.MESSAGE_STATE_CHANGED and (message.parse_state_changed()[0]==gst.STATE_PAUSED or message.parse_state_changed()[0]==gst.STATE_PLAYING) and message.parse_state_changed()[2]==gst.STATE_VOID_PENDING and message.src == self.pipeline: 650 652 print message.parse_state_changed() 651 self.push_text()653 #self.push_text() 652 654 else: 653 655 #print "Unhandled: " + str(message.type) keystroke/trunk/textsrc.py
r2510 r2511 31 31 ) 32 32 33 data = [ [0*gst.MSECOND, 1958*gst.MSECOND,"...if you want to hold it."], [1958*gst.MSECOND,3627*gst.MSECOND,"Oh you gotta... Does this pick you up as well?"]]33 data = [] 34 34 current_index = 0 35 35 … … 50 50 self.current_index += 1 51 51 return gst.FLOW_OK, buf 52 elif len(self.data)>0: 53 buf = gst.Buffer(" ") 54 buf.timestamp = self.data[-1][0]+self.data[-1][1] 55 buf.duration = 9999999*gst.SECOND # A really long time. (FIXME) 56 return gst.FLOW_OK, buf 52 57 else: 53 58 buf = gst.Buffer(" ") 54 buf.timestamp = self.data[-1][0]+self.data[-1][1]59 buf.timestamp = 0*gst.SECOND 55 60 buf.duration = 9999999*gst.SECOND # A really long time. (FIXME) 56 61 return gst.FLOW_OK, buf … … 63 68 def do_is_seekable(self): 64 69 return True 70 71 def append(self, timestamp, duration, desc): 72 self.data.append([timestamp, duration, desc]) 73 return 74 75 def clear(self): 76 self.data = [] 77 return