Update of /cvsroot/freevo/freevo/src/audio/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv7400
Modified Files:
mplayer.py xine.py
Log Message:
move to new ChildApp2 and remove the internal thread
Index: mplayer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/plugins/mplayer.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** mplayer.py 6 Dec 2003 13:43:35 -0000 1.27
--- mplayer.py 10 Dec 2003 19:02:38 -0000 1.28
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.28 2003/12/10 19:02:38 dischi
+ # move to new ChildApp2 and remove the internal thread
+ #
# Revision 1.27 2003/12/06 13:43:35 dischi
# expand the <audio> parsing in fxd files
***************
*** 50,64 ****
#endif
! import time, os
! import string
! import threading, signal
import re
import config # Configuration handler. reads config file.
- import util # Various utilities
import childapp # Handle child applications
import rc
import plugin
from event import *
--- 53,65 ----
#endif
! import os
import re
import config # Configuration handler. reads config file.
import childapp # Handle child applications
import rc
import plugin
+
from event import *
***************
*** 72,79 ****
# create the mplayer object
plugin.Plugin.__init__(self)
- mplayer = util.SynchronizedObject(MPlayer())
! # register it as the object to play audio
! plugin.register(mplayer, plugin.AUDIO_PLAYER, True)
--- 73,79 ----
# create the mplayer object
plugin.Plugin.__init__(self)
! # register mplayer as the object to play audio
! plugin.register(MPlayer(), plugin.AUDIO_PLAYER, True)
***************
*** 84,91 ****
def __init__(self):
! self.name = 'mplayer'
! self.thread = childapp.ChildThread()
! self.mode = None
self.app_mode = 'audio'
--- 84,90 ----
def __init__(self):
! self.name = 'mplayer'
self.app_mode = 'audio'
+ self.app = None
***************
*** 106,112 ****
DEMUXER_OGG = 18
rest, extension = os.path.splitext(filename)
! if string.lower(extension) == '.mp3':
return "-demuxer " + str(DEMUXER_MP3)
! if string.lower(extension) == '.ogg':
return "-demuxer " + str(DEMUXER_OGG)
else:
--- 105,111 ----
DEMUXER_OGG = 18
rest, extension = os.path.splitext(filename)
! if extension.lower() == '.mp3':
return "-demuxer " + str(DEMUXER_MP3)
! if extension.lower() == '.ogg':
return "-demuxer " + str(DEMUXER_OGG)
else:
***************
*** 184,190 ****
return _('Invalid audio file')
! _debug_('MPlayer.play(): Starting thread, cmd=%s' % command)
! self.thread.start(MPlayerApp, (command, item, self.refresh))
return None
--- 183,189 ----
return _('Invalid audio file')
! _debug_('MPlayer.play(): Starting cmd=%s' % command)
! self.app = MPlayerApp(command, self)
return None
***************
*** 192,202 ****
def stop(self):
"""
! Stop mplayer and set thread to idle
"""
! self.thread.stop('quit\n')
def is_playing(self):
! return self.thread.mode != 'idle'
--- 191,201 ----
def stop(self):
"""
! Stop mplayer
"""
! self.app.stop('quit\n')
def is_playing(self):
! return self.app.isAlive()
***************
*** 219,223 ****
if event == AUDIO_SEND_MPLAYER_CMD:
! self.thread.app.write('%s\n' % event.arg)
return True
--- 218,222 ----
if event == AUDIO_SEND_MPLAYER_CMD:
! self.app.write('%s\n' % event.arg)
return True
***************
*** 227,235 ****
elif event == PAUSE or event == PLAY:
! self.thread.app.write('pause\n')
return True
elif event == SEEK:
! self.thread.app.write('seek %s\n' % event.arg)
return True
--- 226,234 ----
elif event == PAUSE or event == PLAY:
! self.app.write('pause\n')
return True
elif event == SEEK:
! self.app.write('seek %s\n' % event.arg)
return True
***************
*** 241,261 ****
# ======================================================================
! class MPlayerApp(childapp.ChildApp):
"""
class controlling the in and output from the mplayer process
"""
!
! def __init__(self, (app, item, refresh)):
! self.item = item
! self.elapsed = 0
! childapp.ChildApp.__init__(self, app)
! self.RE_TIME = re.compile("^A: *([0-9]+)").match
! self.RE_TIME_NEW = re.compile("^A: *([0-9]+):([0-9]+)").match
! self.refresh = refresh
self.stop_reason = 0 # 0 = ok, 1 = error
! def stopped(self):
! rc.post_event(Event(AUDIO_PLAY_END, self.stop_reason))
--- 240,259 ----
# ======================================================================
! class MPlayerApp(childapp.ChildApp2):
"""
class controlling the in and output from the mplayer process
"""
! def __init__(self, app, player):
! self.item = player.item
! self.player = player
! self.elapsed = 0
self.stop_reason = 0 # 0 = ok, 1 = error
+ self.RE_TIME = re.compile("^A: *([0-9]+)").match
+ self.RE_TIME_NEW = re.compile("^A: *([0-9]+):([0-9]+)").match
+ childapp.ChildApp2.__init__(self, app)
! def stop_event(self):
! return Event(PLAY_END, self.stop_reason, handler=self.player.eventhandler)
***************
*** 265,269 ****
if m:
self.stop_reason = 0
! timestrs = string.split(m.group(),":")
if len(timestrs) == 5:
# playing for days!
--- 263,267 ----
if m:
self.stop_reason = 0
! timestrs = m.group().split(":")
if len(timestrs) == 5:
# playing for days!
***************
*** 289,293 ****
if self.item.elapsed != self.elapsed:
! self.refresh()
self.elapsed = self.item.elapsed
--- 287,291 ----
if self.item.elapsed != self.elapsed:
! self.player.refresh()
self.elapsed = self.item.elapsed
Index: xine.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/plugins/xine.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** xine.py 22 Nov 2003 15:30:55 -0000 1.9
--- xine.py 10 Dec 2003 19:02:38 -0000 1.10
***************
*** 8,16 ****
# xine-ui > 0.9.22 (when writing this plugin this means cvs)
#
! # Todo: test it
#
#
# -----------------------------------------------------------------------
# $Log$
# Revision 1.9 2003/11/22 15:30:55 dischi
# support more than one player
--- 8,19 ----
# xine-ui > 0.9.22 (when writing this plugin this means cvs)
#
! # Todo:
#
#
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.10 2003/12/10 19:02:38 dischi
+ # move to new ChildApp2 and remove the internal thread
+ #
# Revision 1.9 2003/11/22 15:30:55 dischi
# support more than one player
***************
*** 22,41 ****
# fix cd playback
#
- # Revision 1.6 2003/10/21 21:17:41 gsbarbieri
- # Some more i18n improvements.
- #
- # Revision 1.5 2003/09/19 22:09:16 dischi
- # use new childapp thread function
- #
- # Revision 1.4 2003/09/01 19:46:02 dischi
- # add menuw to eventhandler, it may be needed
- #
- # Revision 1.3 2003/08/26 20:24:07 outlyer
- # Apparently some files have spaces in them... D'oh :)
- #
- # Revision 1.2 2003/08/23 12:51:42 dischi
- # removed some old CVS log messages
- #
- #
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
--- 25,28 ----
***************
*** 61,70 ****
- import time, os
- import signal
import popen2, re
import config # Configuration handler. reads config file.
- import util # Various utilities
import childapp # Handle child applications
import rc # The RemoteControl class.
--- 48,54 ----
***************
*** 114,122 ****
return
! # create the xine object
! xine = util.SynchronizedObject(Xine(xine_version))
!
! # register it as the object to play
! plugin.register(xine, plugin.AUDIO_PLAYER, True)
--- 98,103 ----
return
! # register xine as the object to play
! plugin.register(Xine(xine_version), plugin.AUDIO_PLAYER, True)
***************
*** 129,138 ****
def __init__(self, version):
! self.name = 'xine'
! self.thread = childapp.ChildThread()
! self.mode = None
self.xine_version = version
! self.app_mode = 'audio'
!
self.command = '%s -V none -A %s --stdctl' % (config.CONF.fbxine,
config.XINE_AO_DEV)
if rc.PYLIRC:
--- 110,117 ----
def __init__(self, version):
! self.name = 'xine'
self.xine_version = version
! self.app_mode = 'audio'
! self.app = None
self.command = '%s -V none -A %s --stdctl' % (config.CONF.fbxine,
config.XINE_AO_DEV)
if rc.PYLIRC:
***************
*** 172,182 ****
command = '%s %s "%s"' % (self.command, add_args, filename)
! _debug_('Xine.play(): Starting thread, cmd=%s' % command)
! self.thread.start(XineApp, (command, item, self.refresh))
def is_playing(self):
! return self.thread.mode != 'idle'
--- 151,161 ----
command = '%s %s "%s"' % (self.command, add_args, filename)
! _debug_('Xine.play(): Starting cmd=%s' % command)
! self.app = XineApp(command, self)
def is_playing(self):
! return self.app.isAlive()
***************
*** 187,193 ****
def stop(self):
"""
! Stop xine and set thread to idle
"""
! self.thread.stop('quit\n')
--- 166,172 ----
def stop(self):
"""
! Stop xine
"""
! self.app.stop('quit\n')
***************
*** 197,206 ****
function it will be passed over to the items eventhandler
"""
! if event == AUDIO_PLAY_END:
! if event.arg:
! self.stop()
! if self.playerGUI.try_next_player():
! return True
! event = PLAY_END
if event in ( PLAY_END, USER_END ):
--- 176,183 ----
function it will be passed over to the items eventhandler
"""
! if event == PLAY_END and event.arg:
! self.stop()
! if self.playerGUI.try_next_player():
! return True
if event in ( PLAY_END, USER_END ):
***************
*** 209,213 ****
if event == PAUSE or event == PLAY:
! self.thread.app.write('pause\n')
return True
--- 186,190 ----
if event == PAUSE or event == PLAY:
! self.app.write('pause\n')
return True
***************
*** 229,233 ****
else:
pos = 30
! self.thread.app.write('%s%s\n' % (action, pos))
return True
--- 206,210 ----
else:
pos = 30
! self.app.write('%s%s\n' % (action, pos))
return True
***************
*** 239,256 ****
# ======================================================================
! class XineApp(childapp.ChildApp):
"""
class controlling the in and output from the xine process
"""
! def __init__(self, (app, item, refresh)):
! self.item = item
! childapp.ChildApp.__init__(self, app)
! self.elapsed = 0
! self.refresh = refresh
self.stop_reason = 0 # 0 = ok, 1 = error
! def stopped(self):
! rc.post_event(Event(AUDIO_PLAY_END, self.stop_reason))
--- 216,234 ----
# ======================================================================
! class XineApp(childapp.ChildApp2):
"""
class controlling the in and output from the xine process
"""
! def __init__(self, app, player):
! self.item = player.item
! self.player = player
! self.elapsed = 0
self.stop_reason = 0 # 0 = ok, 1 = error
+ childapp.ChildApp2.__init__(self, app)
!
! def stop_event(self):
! return Event(PLAY_END, self.stop_reason, handler=self.player.eventhandler)
***************
*** 260,264 ****
if self.item.elapsed != self.elapsed:
! self.refresh()
self.elapsed = self.item.elapsed
--- 238,242 ----
if self.item.elapsed != self.elapsed:
! self.player.refresh()
self.elapsed = self.item.elapsed
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog