Update of /cvsroot/freevo/freevo/src/video/plugins In directory sc8-pr-cvs1:/tmp/cvs-serv29654/video/plugins
Modified Files: mplayer.py xine.py Log Message: use new childapp thread function Index: mplayer.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/video/plugins/mplayer.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** mplayer.py 18 Sep 2003 17:09:54 -0000 1.22 --- mplayer.py 19 Sep 2003 22:09:15 -0000 1.23 *************** *** 21,24 **** --- 21,27 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.23 2003/09/19 22:09:15 dischi + # use new childapp thread function + # # Revision 1.22 2003/09/18 17:09:54 gsbarbieri # Faster version detection + handle for CVS versions. *************** *** 35,62 **** # is used # - # Revision 1.18 2003/09/01 19:46:03 dischi - # add menuw to eventhandler, it may be needed - # - # Revision 1.17 2003/09/01 16:41:37 dischi - # send PLAY_START event - # - # Revision 1.16 2003/08/30 17:05:42 dischi - # remove bookmark support, add support for ItemPlugin eventhandler - # - # Revision 1.15 2003/08/24 19:24:19 gsbarbieri - # Fix problem: exiting mplayer from playing ROM files hang freevo - # - # Revision 1.14 2003/08/23 12:51:43 dischi - # removed some old CVS log messages - # - # Revision 1.13 2003/08/23 10:08:14 dischi - # remove dbdnav stuff, use xine for that - # - # Revision 1.12 2003/08/23 10:07:18 dischi - # restore the context - # - # Revision 1.11 2003/08/22 17:51:29 dischi - # Some changes to make freevo work when installed into the system - # # ----------------------------------------------------------------------- # Freevo - A Home Theater PC framework --- 38,41 ---- *************** *** 89,93 **** import util # Various utilities import childapp # Handle child applications - import osd # The OSD class, used to communicate with the OSD daemon import rc # The RemoteControl class. --- 68,71 ---- *************** *** 98,128 **** import re - # Setting up the default objects: - osd = osd.get_singleton() - # contains an initialized MPlayer() object mplayer = None - mplayer_version = 0 - class PluginInterface(plugin.Plugin): """ ! Mplayer plugin for the video player. Use mplayer to play all video ! files. """ def __init__(self): global mplayer ! global mplayer_version ! # create the mplayer object plugin.Plugin.__init__(self) ! child = popen2.Popen3( "%s -v" % config.MPLAYER_CMD, 1, 100 ) data = child.fromchild.readline() # Just need the first line if data: data = re.search( "^MPlayer (?P<version>\S+)", data ) if data: ! if DEBUG: ! print "MPlayer version is: %s" % data.group( "version" ) data = data.group( "version" ) if data[ 0 ] == "1": --- 76,102 ---- import re # contains an initialized MPlayer() object mplayer = None class PluginInterface(plugin.Plugin): """ ! Mplayer plugin for the video player. ! ! With this plugin Freevo can play all video files defined in ! SUFFIX_VIDEO_FILES. This is the default video player for Freevo. """ def __init__(self): global mplayer ! ! mplayer_version = 0 # create the mplayer object plugin.Plugin.__init__(self) ! child = popen2.Popen3( "%s -v" % config.MPLAYER_CMD, 1, 100) data = child.fromchild.readline() # Just need the first line if data: data = re.search( "^MPlayer (?P<version>\S+)", data ) if data: ! _debug_("MPlayer version is: %s" % data.group( "version" )) data = data.group( "version" ) if data[ 0 ] == "1": *************** *** 132,138 **** elif data[ 0 : 7 ] == "dev-CVS": mplayer_version = 9999 child.wait() ! mplayer = util.SynchronizedObject(MPlayer()) # register it as the object to play audio --- 106,113 ---- elif data[ 0 : 7 ] == "dev-CVS": mplayer_version = 9999 + _debug_("MPlayer version set to: %s" % mplayer_version) child.wait() ! mplayer = util.SynchronizedObject(MPlayer(mplayer_version)) # register it as the object to play audio *************** *** 140,170 **** - def vop_append(command): - """ - Change a mplayer command to support more than one -vop - parameter. This function will grep all -vop parameter from - the command and add it at the end as one vop argument - """ - global mplayer_version - ret = '' - vop = '' - next_is_vop = FALSE - - for arg in command.split(' '): - if next_is_vop: - vop += ',%s' % arg - next_is_vop = FALSE - elif (arg == '-vop' or arg == '-vf'): - next_is_vop=TRUE - else: - ret += '%s ' % arg - - if vop: - if mplayer_version >= 1: - return '%s -vf %s' % (ret,vop[1:]) - return '%s -vop %s' % (ret,vop[1:]) - return ret - - class MPlayer: """ --- 115,118 ---- *************** *** 172,188 **** """ ! def __init__(self): ! self.thread = MPlayer_Thread() ! self.thread.setDaemon(1) ! self.thread.start() self.mode = None self.filename = None self.app_mode = 'video' self.seek = 0 self.seek_timer = threading.Timer(0, self.reset_seek) ! def play(self, filename, options, item, mode = None): """ ! play a audioitem with mplayer """ --- 120,138 ---- """ ! def __init__(self, version): ! self.thread = childapp.ChildThread() ! self.thread.stop_osd = True ! self.mode = None self.filename = None self.app_mode = 'video' + self.version = version self.seek = 0 self.seek_timer = threading.Timer(0, self.reset_seek) ! ! def play(self, filename, options, item, mode = None): """ ! play a videoitem with mplayer """ *************** *** 275,281 **** if config.MPLAYER_AUTOCROP and command.find('crop=') == -1: (x1, y1, x2, y2) = (1000, 1000, 0, 0) ! child = popen2.Popen3(vop_append('%s -ao null -vo null ' \ ! '-ss 60 -frames 20 -vop cropdetect' % \ ! command), 1, 100) exp = re.compile('^.*-vop crop=([0-9]*):([0-9]*):([0-9]*):([0-9]*).*') while(1): --- 225,231 ---- if config.MPLAYER_AUTOCROP and command.find('crop=') == -1: (x1, y1, x2, y2) = (1000, 1000, 0, 0) ! child = popen2.Popen3(self.vop_append('%s -ao null -vo null ' \ ! '-ss 60 -frames 20 -vop cropdetect' % \ ! command), 1, 100) exp = re.compile('^.*-vop crop=([0-9]*):([0-9]*):([0-9]*):([0-9]*).*') while(1): *************** *** 296,300 **** ! command=vop_append(command) if plugin.getbyname('MIXER'): --- 246,250 ---- ! command=self.vop_append(command) if plugin.getbyname('MIXER'): *************** *** 302,307 **** self.file = item ! self.thread.play_mode = self.mode ! self.thread.item = item self.item = item --- 252,258 ---- self.file = item ! ! self.thread.start(MPlayerApp, (command, item)) ! self.item = item *************** *** 309,316 **** rc.app(self) - self.thread.mode = 'play' - self.thread.command = command - self.thread.mode_flag.set() - print command return None --- 260,263 ---- *************** *** 320,330 **** Stop mplayer and set thread to idle """ ! self.thread.app.write('quit\n') ! self.thread.mode = 'stop' ! self.thread.mode_flag.set() ! self.thread.item = None rc.app(None) ! while self.thread.mode == 'stop': ! time.sleep(0.3) def eventhandler(self, event, menuw=None): --- 267,274 ---- Stop mplayer and set thread to idle """ ! self.thread.stop('quit\n') rc.app(None) ! ! def eventhandler(self, event, menuw=None): *************** *** 337,341 **** self.seek = 0 rc.set_context('input') ! return TRUE if event.context == 'input': --- 281,285 ---- self.seek = 0 rc.set_context('input') ! return True if event.context == 'input': *************** *** 343,347 **** self.reset_seek_timeout() self.seek = self.seek * 10 + int(event); ! return TRUE elif event == INPUT_ENTER: --- 287,291 ---- self.reset_seek_timeout() self.seek = self.seek * 10 + int(event); ! return True elif event == INPUT_ENTER: *************** *** 352,356 **** self.seek = 0 rc.set_context('video') ! return TRUE elif event == INPUT_EXIT: --- 296,300 ---- self.seek = 0 rc.set_context('video') ! return True elif event == INPUT_EXIT: *************** *** 359,363 **** self.seek = 0 rc.set_context('video') ! return TRUE if event == STOP: --- 303,307 ---- self.seek = 0 rc.set_context('video') ! return True if event == STOP: *************** *** 369,373 **** self.play(self.parameter[0], self.parameter[1], self.parameter[2], self.parameter[3]) ! return TRUE if event in ( PLAY_END, USER_END ): --- 313,317 ---- self.play(self.parameter[0], self.parameter[1], self.parameter[2], self.parameter[3]) ! return True if event in ( PLAY_END, USER_END ): *************** *** 378,398 **** if event == VIDEO_SEND_MPLAYER_CMD: self.thread.app.write('%s\n' % event.arg) ! return TRUE if event == TOGGLE_OSD: self.thread.app.write('osd\n') ! return TRUE if event == PAUSE or event == PLAY: self.thread.app.write('pause\n') ! return TRUE if event == SEEK: self.thread.app.write('seek %s\n' % event.arg) ! return TRUE except: print 'Exception while sending command to mplayer:' traceback.print_exc() ! return TRUE # nothing found? Try the eventhandler of the object who called us --- 322,342 ---- if event == VIDEO_SEND_MPLAYER_CMD: self.thread.app.write('%s\n' % event.arg) ! return True if event == TOGGLE_OSD: self.thread.app.write('osd\n') ! return True if event == PAUSE or event == PLAY: self.thread.app.write('pause\n') ! return True if event == SEEK: self.thread.app.write('seek %s\n' % event.arg) ! return True except: print 'Exception while sending command to mplayer:' traceback.print_exc() ! return True # nothing found? Try the eventhandler of the object who called us *************** *** 410,453 **** self.seek_timer.start() ! # ====================================================================== - class MPlayerParser: - """ - class to parse the mplayer output and store some information - in the videoitem - """ - - def __init__(self, item): - self.item = item - self.RE_EXIT = re.compile("^Exiting\.\.\. \((.*)\)$").match - self.RE_START = re.compile("^Starting playback\.\.\.").match ! # DVD items also store mplayer_audio_broken to check if you can ! # start them with -alang or not ! if hasattr(item, 'mplayer_audio_broken') or item.mode != 'dvd': ! self.check_audio = 0 ! else: ! self.check_audio = 1 ! ! ! def parse(self, line): ! if self.check_audio: ! if line.find('MPEG: No audio stream found -> no sound') == 0: ! # OK, audio is broken, restart without -alang ! self.check_audio = 2 ! self.item.mplayer_audio_broken = TRUE ! rc.post_event(Event('AUDIO_ERROR_START_AGAIN')) ! ! if self.RE_START(line): ! if self.check_audio == 1: ! # audio seems to be ok ! self.item.mplayer_audio_broken = FALSE ! self.check_audio = 0 ! ! def end_type(self, str): ! m = self.RE_EXIT(str) ! if m: return m.group(1) ! class MPlayerApp(childapp.ChildApp): --- 354,385 ---- self.seek_timer.start() + def vop_append(self, command): + """ + Change a mplayer command to support more than one -vop + parameter. This function will grep all -vop parameter from + the command and add it at the end as one vop argument + """ + ret = '' + vop = '' + next_is_vop = False + + for arg in command.split(' '): + if next_is_vop: + vop += ',%s' % arg + next_is_vop = False + elif (arg == '-vop' or arg == '-vf'): + next_is_vop=True + else: + ret += '%s ' % arg ! if vop: ! if self.version >= 1: ! return '%s -vf %s' % (ret,vop[1:]) ! return '%s -vop %s' % (ret,vop[1:]) ! return ret ! ! # ====================================================================== class MPlayerApp(childapp.ChildApp): *************** *** 456,481 **** """ ! def __init__(self, app, item): if config.MPLAYER_DEBUG: fname_out = os.path.join(config.LOGDIR, 'mplayer_stdout.log') fname_err = os.path.join(config.LOGDIR, 'mplayer_stderr.log') try: ! self.log_stdout = open(fname_out, 'a') ! self.log_stderr = open(fname_err, 'a') except IOError: print print (('ERROR: Cannot open "%s" and "%s" for ' + 'MPlayer logging!') % (fname_out, fname_err)) ! print 'Please set MPLAYER_DEBUG=0 in local_conf.py, or ' ! print 'start Freevo from a directory that is writeable!' ! print ! else: ! print 'MPlayer logging to "%s" and "%s"' % (fname_out, fname_err) self.RE_TIME = re.compile("^A: *([0-9]+)").match self.item = item - self.parser = MPlayerParser(item) childapp.ChildApp.__init__(self, app) self.exit_type = None def kill(self): --- 388,419 ---- """ ! def __init__(self, (app, item)): if config.MPLAYER_DEBUG: fname_out = os.path.join(config.LOGDIR, 'mplayer_stdout.log') fname_err = os.path.join(config.LOGDIR, 'mplayer_stderr.log') try: ! self.log_stdout = open(fname_out, 'w') ! self.log_stderr = open(fname_err, 'w') ! print 'MPlayer logging to "%s" and "%s"' % (fname_out, fname_err) except IOError: print print (('ERROR: Cannot open "%s" and "%s" for ' + 'MPlayer logging!') % (fname_out, fname_err)) ! config.MPLAYER_DEBUG = 0 ! ! # DVD items also store mplayer_audio_broken to check if you can ! # start them with -alang or not ! if hasattr(item, 'mplayer_audio_broken') or item.mode != 'dvd': ! self.check_audio = 0 ! else: ! self.check_audio = 1 self.RE_TIME = re.compile("^A: *([0-9]+)").match + self.RE_START = re.compile("^Starting playback\.\.\.").match + self.RE_EXIT = re.compile("^Exiting\.\.\. \((.*)\)$").match self.item = item childapp.ChildApp.__init__(self, app) self.exit_type = None + def kill(self): *************** *** 490,495 **** self.log_stderr.close() - def stdout_cb(self, line): if config.MPLAYER_DEBUG: try: --- 428,443 ---- self.log_stderr.close() + def stopped(self): + if self.exit_type == "End of file": + rc.post_event(PLAY_END) + elif self.exit_type == "Quit": + rc.post_event(USER_END) + else: + print 'error while playing file' + rc.post_event(PLAY_END) + + + def stdout_cb(self, line): if config.MPLAYER_DEBUG: try: *************** *** 504,523 **** elif line.find("Exiting...") == 0: ! self.exit_type = self.parser.end_type(line) # this is the first start of the movie, parse infos elif not self.item.elapsed: ! self.parser.parse(line) def stderr_cb(self, line): - if line.find('The DVD is protected') != -1: - print - print 'WARNING: You are trying to play a protected (CSS) DVD!' - print 'DVD protection is normally enabled, please see the docs' - print 'for more information.' - print - rc.post_event(DVD_PROTECTED) - if config.MPLAYER_DEBUG: try: --- 452,476 ---- elif line.find("Exiting...") == 0: ! m = self.RE_EXIT(line) ! if m: ! self.exit_type = m.group(1) # this is the first start of the movie, parse infos elif not self.item.elapsed: ! if self.check_audio: ! if line.find('MPEG: No audio stream found -> no sound') == 0: ! # OK, audio is broken, restart without -alang ! self.check_audio = 2 ! self.item.mplayer_audio_broken = True ! rc.post_event(Event('AUDIO_ERROR_START_AGAIN')) ! ! if self.RE_START(line): ! if self.check_audio == 1: ! # audio seems to be ok ! self.item.mplayer_audio_broken = False ! self.check_audio = 0 def stderr_cb(self, line): if config.MPLAYER_DEBUG: try: *************** *** 525,588 **** except ValueError: pass # File closed - - - # ====================================================================== - - class MPlayer_Thread(threading.Thread): - """ - Thread to wait for a mplayer command to play - """ - - def __init__(self): - threading.Thread.__init__(self) - - self.play_mode = '' - self.mode = 'idle' - self.mode_flag = threading.Event() - self.command = '' - self.app = None - self.item = None - - - def run(self): - while 1: - if self.mode == 'idle': - self.mode_flag.wait() - self.mode_flag.clear() - - elif self.mode == 'play': - - if config.STOP_OSD_WHEN_PLAYING: - osd.stopdisplay() - - rc.post_event(Event(PLAY_START, arg=self.item)) - - _debug_('MPlayer_Thread.run(): Started, cmd=%s' % self.command) - - self.app = MPlayerApp(self.command, self.item) - - while self.mode == 'play' and self.app.isAlive(): - time.sleep(0.1) - - self.app.kill() - - if self.mode == 'play': - if self.app.exit_type == "End of file": - rc.post_event(PLAY_END) - elif self.app.exit_type == "Quit": - rc.post_event(USER_END) - else: - print 'error while playing file' - rc.post_event(PLAY_END) - - # Ok, we can use the OSD again. - if config.STOP_OSD_WHEN_PLAYING: - osd.restartdisplay() - osd.update() - - self.mode = 'idle' - - else: - self.mode = 'idle' - - --- 478,479 ---- Index: xine.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/video/plugins/xine.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** xine.py 14 Sep 2003 20:09:37 -0000 1.16 --- xine.py 19 Sep 2003 22:09:16 -0000 1.17 *************** *** 29,32 **** --- 29,35 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.17 2003/09/19 22:09:16 dischi + # use new childapp thread function + # # Revision 1.16 2003/09/14 20:09:37 dischi # removed some TRUE=1 and FALSE=0 add changed some debugs to _debug_ *************** *** 46,53 **** # Support for Chapter-by-chapter navigation in DVDs using the CH+ and CH- keys. # - # Revision 1.11 2003/08/23 12:51:43 dischi - # removed some old CVS log messages - # - # # ----------------------------------------------------------------------- # Freevo - A Home Theater PC framework --- 49,52 ---- *************** *** 74,78 **** import time, os ! import threading, signal import popen2, re --- 73,77 ---- import time, os ! import signal import popen2, re *************** *** 81,94 **** import childapp # Handle child applications import rc # The RemoteControl class. - import skin from event import * import plugin - # RegExp - import re - - # contains an initialized Xine() object - xine = None class PluginInterface(plugin.Plugin): --- 80,87 ---- *************** *** 96,107 **** Xine plugin for the video player. """ ! def __init__(self, dvd=TRUE, vcd=FALSE): ! global xine ! plugin.Plugin.__init__(self) - if xine: - return - try: config.XINE_COMMAND --- 89,95 ---- Xine plugin for the video player. """ ! def __init__(self): plugin.Plugin.__init__(self) try: config.XINE_COMMAND *************** *** 159,167 **** def __init__(self, type, version): ! self.thread = Xine_Thread() ! self.thread.setDaemon(1) ! self.thread.start() ! self.mode = None ! self.app_mode = '' self.xine_type = type self.xine_version = version --- 147,156 ---- def __init__(self, type, version): ! # start the thread ! self.thread = childapp.ChildThread() ! self.thread.stop_osd = True ! ! self.mode = None ! self.app_mode = '' self.xine_type = type self.xine_version = version *************** *** 184,200 **** self.app_mode = item.mode # dvd or vcd keymap if plugin.getbyname('MIXER'): plugin.getbyname('MIXER').reset() - self.item = item - self.thread.item = item - - rc.app(self) - command = self.command - _debug_('Xine.play(): Starting thread, cmd=%s' % command) - if item.deinterlace: if (config.XINE_VO_DEV == 'vidix' or self.xine_type == 'fb') and \ --- 173,183 ---- self.app_mode = item.mode # dvd or vcd keymap + self.item = item if plugin.getbyname('MIXER'): plugin.getbyname('MIXER').reset() command = self.command if item.deinterlace: if (config.XINE_VO_DEV == 'vidix' or self.xine_type == 'fb') and \ *************** *** 211,221 **** self.max_audio = max(self.max_audio, len(track['audio'])) - skin.get_singleton().clear() - self.thread.mode = 'play' if item.mode == 'dvd': ! self.thread.command = '%s dvd://' % command else: ! self.thread.command = '%s vcdx:/%s:' % (command, item.media.devicename) ! self.thread.mode_flag.set() return None --- 194,206 ---- self.max_audio = max(self.max_audio, len(track['audio'])) if item.mode == 'dvd': ! command = '%s dvd://' % command else: ! command = '%s vcdx:/%s:' % (command, item.media.devicename) ! ! _debug_('Xine.play(): Starting thread, cmd=%s' % command) ! ! rc.app(self) ! self.thread.start(childapp.ChildApp, command) return None *************** *** 225,235 **** Stop xine and set thread to idle """ ! self.thread.mode = 'stop' ! self.thread.mode_flag.set() ! self.thread.item = None rc.app(None) - - while self.thread.mode == 'stop': - time.sleep(0.3) --- 210,215 ---- Stop xine and set thread to idle """ ! self.thread.stop('quit\n') rc.app(None) *************** *** 245,264 **** # fallback for older versions of xine if self.xine_version < 922: ! return TRUE if event == PAUSE or event == PLAY: self.thread.app.write('pause\n') ! return TRUE if event == STOP: ! self.thread.app.write('quit\n') ! for i in range(10): ! if self.thread.mode == 'idle': ! break ! time.sleep(0.3) ! else: ! # sometimes xine refuses to die ! self.stop() ! return TRUE if event == SEEK: --- 225,237 ---- # fallback for older versions of xine if self.xine_version < 922: ! return True if event == PAUSE or event == PLAY: self.thread.app.write('pause\n') ! return True if event == STOP: ! self.stop() ! return self.item.eventhandler(event) if event == SEEK: *************** *** 276,317 **** pos = 30 self.thread.app.write('%s%s\n' % (action, pos)) ! return TRUE # DVD NAVIGATION if event == DVDNAV_LEFT: self.thread.app.write('EventLeft\n') ! return TRUE if event == DVDNAV_RIGHT: self.thread.app.write('EventRight\n') ! return TRUE if event == DVDNAV_UP: self.thread.app.write('EventUp\n') ! return TRUE if event == DVDNAV_DOWN: self.thread.app.write('EventDown\n') ! return TRUE if event == DVDNAV_SELECT: self.thread.app.write('EventSelect\n') ! return TRUE if event == DVDNAV_TITLEMENU: self.thread.app.write('TitleMenu\n') ! return TRUE if event == DVDNAV_MENU: self.thread.app.write('Menu\n') ! return TRUE if event == NEXT: self.thread.app.write('EventNext\n') ! return TRUE if event == PREV: self.thread.app.write('EventPrior\n') ! return TRUE --- 249,290 ---- pos = 30 self.thread.app.write('%s%s\n' % (action, pos)) ! return True # DVD NAVIGATION if event == DVDNAV_LEFT: self.thread.app.write('EventLeft\n') ! return True if event == DVDNAV_RIGHT: self.thread.app.write('EventRight\n') ! return True if event == DVDNAV_UP: self.thread.app.write('EventUp\n') ! return True if event == DVDNAV_DOWN: self.thread.app.write('EventDown\n') ! return True if event == DVDNAV_SELECT: self.thread.app.write('EventSelect\n') ! return True if event == DVDNAV_TITLEMENU: self.thread.app.write('TitleMenu\n') ! return True if event == DVDNAV_MENU: self.thread.app.write('Menu\n') ! return True if event == NEXT: self.thread.app.write('EventNext\n') ! return True if event == PREV: self.thread.app.write('EventPrior\n') ! return True *************** *** 321,329 **** time.sleep(0.1) self.thread.app.write('EventSelect\n') ! return TRUE if event == MENU: self.thread.app.write('TitleMenu\n') ! return TRUE --- 294,302 ---- time.sleep(0.1) self.thread.app.write('EventSelect\n') ! return True if event == MENU: self.thread.app.write('TitleMenu\n') ! return True *************** *** 343,427 **** time.sleep(0.1) self.current_audio = -1 ! return TRUE # nothing found? Try the eventhandler of the object who called us return self.item.eventhandler(event) - - - - # ====================================================================== - - class XineApp(childapp.ChildApp): - """ - class controlling the in and output from the xine process - """ - - def __init__(self, app, item): - self.item = item - childapp.ChildApp.__init__(self, app) - self.exit_type = None - - def kill(self): - # Use SIGINT instead of SIGKILL to make sure Xine shuts - # down properly and releases all resources before it gets - # reaped by childapp.kill().wait() - childapp.ChildApp.kill(self, signal.SIGINT) - - - # ====================================================================== - - class Xine_Thread(threading.Thread): - """ - Thread to wait for a xine command to play - """ - - def __init__(self): - threading.Thread.__init__(self) - - self.mode = 'idle' - self.mode_flag = threading.Event() - self.command = '' - self.app = None - self.item = None - - - def run(self): - while 1: - if self.mode == 'idle': - self.mode_flag.wait() - self.mode_flag.clear() - - elif self.mode == 'play': - if config.STOP_OSD_WHEN_PLAYING: - osd.stopdisplay() - - rc.post_event(Event(PLAY_START, arg=self.item)) - - _debug_('Xine_Thread.run(): Started, cmd=%s' % self.command) - - self.app = XineApp(self.command, self.item) - - while self.mode == 'play' and self.app.isAlive(): - time.sleep(0.1) - - self.app.kill() - - if self.mode == 'play': - if self.app.exit_type == "End of file": - rc.post_event(PLAY_END) - elif self.app.exit_type == "Quit": - rc.post_event(USER_END) - else: - rc.post_event(PLAY_END) - - _debug_('Xine_Thread.run(): Stopped') - - if config.STOP_OSD_WHEN_PLAYING: - osd.restartdisplay() - osd.update() - - self.mode = 'idle' - skin.get_singleton().redraw() - - else: - self.mode = 'idle' --- 316,321 ---- time.sleep(0.1) self.current_audio = -1 ! return True # nothing found? Try the eventhandler of the object who called us return self.item.eventhandler(event) ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Freevo-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog