Author: duncan
Date: Mon Oct 9 21:47:47 2006
New Revision: 8338
Added:
branches/rel-1-5/freevo/src/tv/plugins/ivtv_xine_tv.py
- copied, changed from r8334,
/branches/rel-1-5/freevo/src/tv/ivtv_xine_tv.py
Removed:
branches/rel-1-5/freevo/src/tv/ivtv_xine_tv.py
Modified:
branches/rel-1-5/freevo/src/config.py
branches/rel-1-5/freevo/src/helpers/recordserver.py
branches/rel-1-5/freevo/src/tv/channels.py
branches/rel-1-5/freevo/src/tv/plugins/generic_record.py
branches/rel-1-5/freevo/src/tv/plugins/ivtv_record.py
branches/rel-1-5/freevo/src/tv/plugins/mplayer.py
branches/rel-1-5/freevo/src/tv/plugins/tvtime.py
branches/rel-1-5/freevo/src/tv/plugins/xawtv.py
branches/rel-1-5/freevo/src/tv/plugins/xine.py
branches/rel-1-5/freevo/src/tv/tvguide.py
branches/rel-1-5/freevo/src/tv/v4l2.py
Log:
Multi-tuner support changes
---------------------------
Added to channels a new argument to determine if the device is being used for
playing or recording
Added player to video groups to allow another video group to be used as the
player
Removed recordable from video groups as it was not used
Changed the plugins to use this new argument
Moved the ivtv_xine_tv to the correct place
Modified: branches/rel-1-5/freevo/src/config.py
==============================================================================
--- branches/rel-1-5/freevo/src/config.py (original)
+++ branches/rel-1-5/freevo/src/config.py Mon Oct 9 21:47:47 2006
@@ -21,30 +21,6 @@
# Todo:
#
# -----------------------------------------------------------------------
-# $Log$
-# Revision 1.110.2.2 2004/08/28 17:07:42 dischi
-# support empty ITEM variables
-#
-# Revision 1.110.2.1 2004/08/09 14:37:27 dischi
-# fix encoding detection
-#
-# Revision 1.110 2004/07/10 12:33:36 dischi
-# header cleanup
-#
-# Revision 1.109 2004/06/28 20:39:27 dischi
-# make sure HOME and USER are set
-#
-# Revision 1.108 2004/06/20 18:19:53 rshortt
-# Bugfix: 'config' has no namespace here, we are config. UMASK is a local from
-# freevo_config.py or local_conf.py.
-#
-# Revision 1.107 2004/06/20 15:52:14 dischi
-# set umask as early as possible
-#
-# Revision 1.106 2004/06/09 17:08:45 rshortt
-# Attempt to sort channels properly (numericly, if possible).
-#
-# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
@@ -145,7 +121,7 @@
class VideoGroup:
"""
- vdev: The video device, such as /dev/video.
+ vdev: The video recording device, such as /dev/video0.
adev: The audio device, such as /dev/dsp.
input_type: tuner, composite, svideo, webcam
input_num: The number of this input according to V4L
@@ -154,7 +130,7 @@
tuner_chanlist: us-cable,
tuner_chan: If using input_type=tuner and tuner_type=external set this to
what channel it needs to be to get the signal, usually 3 or 4.
- recordable: True or False. Can you record from this VideoGroup.
+ player: VideoGroup that plays for this tuner, default is to use the
same device for record and play
desc: A nice description for this VideoGroup.
group_type: Special variable to identify devices like dvb or ivtv. This
can be left as default, 'normal', or set to 'ivtv' or 'dvb'.
@@ -163,7 +139,7 @@
def __init__(self, vdev='/dev/video', adev='/dev/dsp', input_type='tuner',
input_num=0, tuner_norm='NTSC', tuner_chanlist='us-cable',
tuner_type='internal', tuner_chan=None,
- recordable=True, desc='Freevo default VideoGroup',
+ player=None, desc='Freevo default VideoGroup',
group_type='normal'):
# XXX: Put checks in here for supplied values.
@@ -175,7 +151,7 @@
self.tuner_norm = string.upper(tuner_norm)
self.tuner_chanlist = tuner_chanlist
self.tuner_chan = tuner_chan
- self.recordable = recordable
+ self.player = player
self.desc = desc
self.group_type = group_type
self.in_use = FALSE
Modified: branches/rel-1-5/freevo/src/helpers/recordserver.py
==============================================================================
--- branches/rel-1-5/freevo/src/helpers/recordserver.py (original)
+++ branches/rel-1-5/freevo/src/helpers/recordserver.py Mon Oct 9 21:47:47 2006
@@ -506,7 +506,7 @@
self.removeScheduledRecording(rec_prog)
return
- self.vg = self.fc.getVideoGroup(rec_prog.channel_id)
+ self.vg = self.fc.getVideoGroup(rec_prog.channel_id, False)
suffix=self.vg.vdev.split('/')[-1]
self.tv_lock_file = config.FREEVO_CACHEDIR + '/record.'+suffix
self.record_app.Record(rec_prog)
Modified: branches/rel-1-5/freevo/src/tv/channels.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/channels.py (original)
+++ branches/rel-1-5/freevo/src/tv/channels.py Mon Oct 9 21:47:47 2006
@@ -48,7 +48,8 @@
DEBUG = config.DEBUG
-# Sample from local_conf.py:
+# Sample for local_conf.py:
+# Three video cards and one web camera.
#VIDEO_GROUPS = [
# VideoGroup(vdev='/dev/video0',
# adev=None,
@@ -56,17 +57,24 @@
# tuner_type='external',
# tuner_chan='3',
# desc='Bell ExpressVu',
-# recordable=True),
+# player=1),
# VideoGroup(vdev='/dev/video1',
+# adev=None,
+# input_type='tuner',
+# tuner_type='external',
+# tuner_chan='3',
+# desc='Bell ExpressVu (second card)',
+# player=None),
+# VideoGroup(vdev='/dev/video2',
# adev='/dev/dsp1',
# input_type='tuner',
# desc='ATI TV-Wonder',
-# recordable=True),
-# VideoGroup(vdev='/dev/video2',
+# player=None),
+# VideoGroup(vdev='/dev/video3',
# adev=None,
# input_type='webcam',
# desc='Logitech Quickcam',
-# recordable=False),
+# player=None),
#]
class FreevoChannels:
@@ -79,7 +87,7 @@
plugin.init_special_plugin(config.plugin_external_tuner)
- def getVideoGroup(self, chan):
+ def getVideoGroup(self, chan, player):
"""
Gets the VideoGroup object used by this Freevo channel.
"""
@@ -92,30 +100,36 @@
if chan_info[2] == chan:
try:
group = int(chan_info[4])
- except:
- # XXX: put a better exception here
+ except: # XXX: put a better exception here
group = 0
+ if player:
+ play_group = config.VIDEO_GROUPS[group].player
+ if play_group:
+ try:
+ group = int(play_group)
+ except:
+ print 'VIDEO_GROUPS[%s].player=%s is invalid' %
(group, play_group)
finally:
self.lock.release()
return config.VIDEO_GROUPS[group]
- def chanUp(self, app=None, app_cmd=None):
+ def chanUp(self, player, app=None, app_cmd=None):
"""
Using this method will not support custom frequencies.
"""
- return self.chanSet(self.getNextChannel(), app, app_cmd)
+ return self.chanSet(self.getNextChannel(), player, app, app_cmd)
- def chanDown(self, app=None, app_cmd=None):
+ def chanDown(self, player, app=None, app_cmd=None):
"""
Using this method will not support custom frequencies.
"""
- return self.chanSet(self.getPrevChannel(), app, app_cmd)
+ return self.chanSet(self.getPrevChannel(), player, app, app_cmd)
- def chanSet(self, chan, app=None, app_cmd=None):
+ def chanSet(self, chan, player, app=None, app_cmd=None):
new_chan = None
for pos in range(len(config.TV_CHANNELS)):
@@ -126,10 +140,10 @@
if not new_chan:
print String(_('ERROR')+': '+\
- (_('Cannot find tuner channel "%s" in the TV channel
listing') % chan))
+ (_('Cannot find tuner channel "%s" in the TV channel
listing') % chan))
return
- vg = self.getVideoGroup(new_chan)
+ vg = self.getVideoGroup(new_chan, player)
if vg.tuner_type == 'external':
tuner = plugin.getbyname('EXTERNAL_TUNER')
@@ -143,14 +157,14 @@
return 0
else:
- return self.tunerSetFreq(chan, app, app_cmd)
+ return self.tunerSetFreq(chan, player, app, app_cmd)
return 0
- def tunerSetFreq(self, chan, app=None, app_cmd=None):
+ def tunerSetFreq(self, chan, player, app=None, app_cmd=None):
chan = str(chan)
- vg = self.getVideoGroup(chan)
+ vg = self.getVideoGroup(chan, player)
freq = config.FREQUENCY_TABLE.get(chan)
if freq:
@@ -254,8 +268,10 @@
-
-# fc = FreevoChannels()
-# print 'CHAN: %s' % fc.getChannel()
-# fc.chanSet('780')
-# print 'CHAN: %s' % fc.getChannel()
+if __name__ == '__main__':
+ fc = FreevoChannels()
+ print 'CHAN: %s' % fc.getChannel()
+ fc.chanSet('K35', True)
+ print 'CHAN: %s' % fc.getChannel()
+ fc.chanSet('K35', False)
+ print 'CHAN: %s' % fc.getChannel()
Modified: branches/rel-1-5/freevo/src/tv/plugins/generic_record.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/plugins/generic_record.py (original)
+++ branches/rel-1-5/freevo/src/tv/plugins/generic_record.py Mon Oct 9
21:47:47 2006
@@ -92,7 +92,7 @@
def Record(self, rec_prog):
- frequency = self.fc.chanSet(str(rec_prog.tunerid), 'record plugin')
+ frequency = self.fc.chanSet(str(rec_prog.tunerid), False, 'record
plugin')
rec_prog.filename = tv_util.getProgFilename(rec_prog)
Modified: branches/rel-1-5/freevo/src/tv/plugins/ivtv_record.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/plugins/ivtv_record.py (original)
+++ branches/rel-1-5/freevo/src/tv/plugins/ivtv_record.py Mon Oct 9
21:47:47 2006
@@ -149,13 +149,13 @@
v = tv.ivtv.IVTV(v_dev)
v.init_settings()
- vg = fc.getVideoGroup(self.prog.tunerid)
+ vg = fc.getVideoGroup(self.prog.tunerid, False)
if DEBUG: print 'Setting Input to %s' % vg.input_num
v.setinput(vg.input_num)
if DEBUG: print 'Setting Channel to %s' % self.prog.tunerid
- fc.chanSet(str(self.prog.tunerid))
+ fc.chanSet(str(self.prog.tunerid), False)
if DEBUG: v.print_settings()
Copied: branches/rel-1-5/freevo/src/tv/plugins/ivtv_xine_tv.py (from r8334,
/branches/rel-1-5/freevo/src/tv/ivtv_xine_tv.py)
==============================================================================
--- /branches/rel-1-5/freevo/src/tv/ivtv_xine_tv.py (original)
+++ branches/rel-1-5/freevo/src/tv/plugins/ivtv_xine_tv.py Mon Oct 9
21:47:47 2006
@@ -119,7 +119,7 @@
tuner_channel = self.fc.getChannel()
print 'PLAY CHAN: %s' % tuner_channel
- vg = self.current_vg = self.fc.getVideoGroup(tuner_channel)
+ vg = self.current_vg = self.fc.getVideoGroup(tuner_channel, True)
print 'PLAY GROUP: %s' % vg.desc
if mode == 'tv':
@@ -127,10 +127,8 @@
ivtv_dev = ivtv.IVTV(vg.vdev)
ivtv_dev.init_settings()
ivtv_dev.setinput(vg.input_num)
-# CO by JM ivtv_dev.print_settings()
- self.fc.chanSet(tuner_channel)
+ self.fc.chanSet(tuner_channel, True)
-# command = '%s -V --no-splash --no-lirc --stdctl pvr://' %
config.XINE_COMMAND
command = '%s -V --no-splash --no-lirc --stdctl %s
pvr:///home/livetv' % (config.XINE_COMMAND, config.XINE_ARGS_DEF)
else:
print 'Mode "%s" is not implemented' % mode # XXX ui.message()
@@ -281,7 +279,7 @@
#cmd = 'osd_show_text "%s"\n' % msg
print 'NEXT CHAN: %s' % nextchan
- nextvg = self.fc.getVideoGroup(nextchan)
+ nextvg = self.fc.getVideoGroup(nextchan, True)
print 'NEXT GROUP: %s' % nextvg.desc
if self.current_vg != nextvg:
@@ -293,14 +291,14 @@
return
elif self.current_vg.group_type == 'ivtv':
- self.fc.chanSet(nextchan)
+ self.fc.chanSet(nextchan, True)
self.thread.app.write('seek 999999 0\n')
else:
- freq_khz = self.fc.chanSet(nextchan, app=self.thread.app)
+ freq_khz = self.fc.chanSet(nextchan, True, app=self.thread.app)
new_freq = '%1.3f' % (freq_khz / 1000.0)
self.thread.app.write('tv_set_freq %s\n' % new_freq)
- self.current_vg = self.fc.getVideoGroup(self.fc.getChannel())
+ self.current_vg = self.fc.getVideoGroup(self.fc.getChannel(), True)
# Display a channel changed message (mplayer ? api osd xine ?)
tuner_id, chan_name, prog_info = self.fc.getChannelInfo()
Modified: branches/rel-1-5/freevo/src/tv/plugins/mplayer.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/plugins/mplayer.py (original)
+++ branches/rel-1-5/freevo/src/tv/plugins/mplayer.py Mon Oct 9 21:47:47 2006
@@ -108,7 +108,7 @@
if not tuner_channel:
tuner_channel = self.fc.getChannel()
- vg = self.current_vg = self.fc.getVideoGroup(tuner_channel)
+ vg = self.current_vg = self.fc.getVideoGroup(tuner_channel, True)
# Convert to MPlayer TV setting strings
norm = 'norm=%s' % vg.tuner_norm
@@ -129,7 +129,7 @@
ivtv_dev.setinput(vg.input_num)
#ivtv_dev.print_settings()
ivtv_dev.close()
- self.fc.chanSet(tuner_channel)
+ self.fc.chanSet(tuner_channel, True)
tvcmd = vg.vdev
@@ -137,19 +137,19 @@
args += (config.MPLAYER_ARGS['ivtv'],)
elif vg.group_type == 'webcam':
- self.fc.chanSet(tuner_channel, app='mplayer')
+ self.fc.chanSet(tuner_channel, True, app='mplayer')
tvcmd = ''
if config.MPLAYER_ARGS.has_key('webcam'):
args += (config.MPLAYER_ARGS['webcam'],)
elif vg.group_type == 'dvb':
- self.fc.chanSet(tuner_channel, app='mplayer')
+ self.fc.chanSet(tuner_channel, True, app='mplayer')
tvcmd = ''
args += ('"dvb://%s" %s' % (tuner_channel,
config.MPLAYER_ARGS['dvb']),)
else:
- freq_khz = self.fc.chanSet(tuner_channel, app='mplayer')
+ freq_khz = self.fc.chanSet(tuner_channel, True, app='mplayer')
tuner_freq = '%1.3f' % (freq_khz / 1000.0)
tvcmd = ('tv:// -tv driver=%s:freq=%s:%s:%s:'
@@ -255,7 +255,7 @@
chan = int( s_event[6] )
nextchan = self.fc.getManChannel(chan)
- nextvg = self.fc.getVideoGroup(nextchan)
+ nextvg = self.fc.getVideoGroup(nextchan, True)
if self.current_vg != nextvg:
self.Stop(channel_change=1)
@@ -271,15 +271,15 @@
return TRUE
elif self.current_vg.group_type == 'ivtv':
- self.fc.chanSet(nextchan)
+ self.fc.chanSet(nextchan, True)
self.app.write('seek 999999 0\n')
else:
- freq_khz = self.fc.chanSet(nextchan, app=self.app)
+ freq_khz = self.fc.chanSet(nextchan, True, app=self.app)
new_freq = '%1.3f' % (freq_khz / 1000.0)
self.app.write('tv_set_freq %s\n' % new_freq)
- self.current_vg = self.fc.getVideoGroup(self.fc.getChannel())
+ self.current_vg = self.fc.getVideoGroup(self.fc.getChannel(), True)
# Display a channel changed message
tuner_id, chan_name, prog_info = self.fc.getChannelInfo()
Modified: branches/rel-1-5/freevo/src/tv/plugins/tvtime.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/plugins/tvtime.py (original)
+++ branches/rel-1-5/freevo/src/tv/plugins/tvtime.py Mon Oct 9 21:47:47 2006
@@ -203,7 +203,7 @@
configcmd = os.path.join(os.path.dirname(config.TVTIME_CMD),
"tvtime-configure")
#cf_norm, cf_input, cf_clist, cf_device = config.TV_SETTINGS.split()
fc = FreevoChannels()
- vg = fc.getVideoGroup(config.TV_CHANNELS[0][2])
+ vg = fc.getVideoGroup(config.TV_CHANNELS[0][2], True)
cf_norm = vg.tuner_norm
cf_input = vg.input_num
cf_device = vg.vdev
@@ -411,7 +411,7 @@
if not tuner_channel:
tuner_channel = self.fc.getChannel()
- vg = self.current_vg = self.fc.getVideoGroup(tuner_channel)
+ vg = self.current_vg = self.fc.getVideoGroup(tuner_channel, True)
if not vg.group_type == 'normal':
print 'Tvtime only supports normal. "%s" is not implemented' %
vg.group_type
@@ -534,7 +534,7 @@
nextchan = self.fc.getNextChannel()
elif event == em.TV_CHANNEL_DOWN:
nextchan = self.fc.getPrevChannel()
- nextvg = self.fc.getVideoGroup(nextchan)
+ nextvg = self.fc.getVideoGroup(nextchan, True)
_debug_("nextchan is %s" % nextchan)
# XXX hazardous to your health. don't use tvtime with anything
@@ -546,8 +546,8 @@
# self.Play('tv', nextchan)
# return TRUE
- self.fc.chanSet(nextchan, app=self.app)
- #self.current_vg = self.fc.getVideoGroup(self.fc.getChannel())
+ self.fc.chanSet(nextchan, True, app=self.app)
+ #self.current_vg = self.fc.getVideoGroup(self.fc.getChannel(),
True)
# Go to the prev/next channel in the list
if event == em.TV_CHANNEL_UP:
Modified: branches/rel-1-5/freevo/src/tv/plugins/xawtv.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/plugins/xawtv.py (original)
+++ branches/rel-1-5/freevo/src/tv/plugins/xawtv.py Mon Oct 9 21:47:47 2006
@@ -146,7 +146,7 @@
pass
if not tuner_channel:
tuner_channel = self.fc.getChannel()
- vg = self.current_vg = self.fc.getVideoGroup(tuner_channel)
+ vg = self.current_vg = self.fc.getVideoGroup(tuner_channel, True)
if not vg.group_type == 'normal':
print 'Xawtv only supports normal. "%s" is not implemented' %
vg.group_type
Modified: branches/rel-1-5/freevo/src/tv/plugins/xine.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/plugins/xine.py (original)
+++ branches/rel-1-5/freevo/src/tv/plugins/xine.py Mon Oct 9 21:47:47 2006
@@ -200,7 +200,7 @@
nextchan = self.fc.getManChannel(int(event.arg))
self.stop(channel_change=1)
- self.fc.chanSet(nextchan)
+ self.fc.chanSet(nextchan, True)
self.Play('tv', nextchan)
return True
Modified: branches/rel-1-5/freevo/src/tv/tvguide.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/tvguide.py (original)
+++ branches/rel-1-5/freevo/src/tv/tvguide.py Mon Oct 9 21:47:47 2006
@@ -191,7 +191,7 @@
elif event == MENU_SELECT or event == PLAY:
- suffix =
self.fc.getVideoGroup(self.selected.channel_id).vdev.split('/')[-1]
+ suffix = self.fc.getVideoGroup(self.selected.channel_id,
False).vdev.split('/')[-1]
tvlockfile = config.FREEVO_CACHEDIR + '/record.'+suffix
# Check if the selected program is >7 min in the future
Modified: branches/rel-1-5/freevo/src/tv/v4l2.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/v4l2.py (original)
+++ branches/rel-1-5/freevo/src/tv/v4l2.py Mon Oct 9 21:47:47 2006
@@ -8,20 +8,6 @@
# Todo:
#
# -----------------------------------------------------------------------
-# $Log$
-# Revision 1.15.2.2 2005/09/12 16:14:08 rshortt
-# Fix GET_FMT ioctl, thanks to Duncan Webb.
-#
-# Revision 1.15.2.1 2005/06/10 14:25:15 tack
-# Fix OverflowError exceptions with Python 2.4 in the ioctl calls.
-#
-# Revision 1.15 2004/07/10 12:33:42 dischi
-# header cleanup
-#
-# Revision 1.14 2004/01/13 15:08:22 outlyer
-# Removed an extraneous 'print'
-#
-# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2003 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
@@ -363,7 +349,7 @@
self.vinput = vinput
self.adev = adev
self.desc = desc
- self.inuse = FALSE
+ self.inuse = False
'''
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog