Update of /cvsroot/freevo/freevo/src/tv
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25673/src/tv
Modified Files:
ivtv.py v4l2.py
Log Message:
More work on tv settings, configuration of v4l2 devices based on TV_SETTINGS.
Index: v4l2.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/v4l2.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** v4l2.py 12 Aug 2004 16:52:49 -0000 1.17
--- v4l2.py 13 Aug 2004 16:17:33 -0000 1.18
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.18 2004/08/13 16:17:33 rshortt
+ # More work on tv settings, configuration of v4l2 devices based on TV_SETTINGS.
+ #
# Revision 1.17 2004/08/12 16:52:49 rshortt
# Work on autodetecting tv cards.
***************
*** 143,151 ****
class Videodev:
! def __init__(self, device):
! self.chanlist = None
! self.device = os.open (device, os.O_TRUNC)
! if self.device < 0:
! sys.exit("Error: %d\n" %self.device)
else:
if DEBUG: print "Video Opened at %s" % device
--- 146,168 ----
class Videodev:
! def __init__(self, which=None, device=None):
! self.devfd = None
! self.settings = None
!
! if not which:
! if not device:
! device = '/dev/video'
!
! self.basic_info(device)
!
! else:
! self.settings = config.TV_SETTINGS.get(which)
! self.init_settings()
!
!
! def basic_info(self, device):
! self.devfd = os.open(device, os.O_TRUNC)
! if self.devfd < 0:
! sys.exit("Error: %d\n" %self.devfd)
else:
if DEBUG: print "Video Opened at %s" % device
***************
*** 160,164 ****
def close(self):
! os.close(self.device)
--- 177,181 ----
def close(self):
! os.close(self.devfd)
***************
*** 170,174 ****
val = struct.pack( FREQUENCY_ST, 0,0,0 )
try:
! r = fcntl.ioctl(self.device, long(GETFREQ_NO), val)
(junk,junk, freq, ) = struct.unpack(FREQUENCY_ST, r)
return freq
--- 187,191 ----
val = struct.pack( FREQUENCY_ST, 0,0,0 )
try:
! r = fcntl.ioctl(self.devfd, long(GETFREQ_NO), val)
(junk,junk, freq, ) = struct.unpack(FREQUENCY_ST, r)
return freq
***************
*** 207,230 ****
def setfreq_old(self, freq):
val = struct.pack( "L", freq)
! r = fcntl.ioctl(self.device, long(SETFREQ_NO_V4L), val)
def setfreq(self, freq):
val = struct.pack( FREQUENCY_ST, long(0), long(0), freq)
! r = fcntl.ioctl(self.device, long(SETFREQ_NO), val)
def getinput(self):
! r = fcntl.ioctl(self.device, GETINPUT_NO, struct.pack(INPUT_ST,0))
return struct.unpack(INPUT_ST,r)[0]
def setinput(self,value):
! r = fcntl.ioctl(self.device, SETINPUT_NO, struct.pack(INPUT_ST,value))
def querycap(self):
val = struct.pack( QUERYCAP_ST, "", "", "", 0, 0 )
! r = fcntl.ioctl(self.device, long(QUERYCAP_NO), val)
return struct.unpack( QUERYCAP_ST, r )
--- 224,247 ----
def setfreq_old(self, freq):
val = struct.pack( "L", freq)
! r = fcntl.ioctl(self.devfd, long(SETFREQ_NO_V4L), val)
def setfreq(self, freq):
val = struct.pack( FREQUENCY_ST, long(0), long(0), freq)
! r = fcntl.ioctl(self.devfd, long(SETFREQ_NO), val)
def getinput(self):
! r = fcntl.ioctl(self.devfd, GETINPUT_NO, struct.pack(INPUT_ST,0))
return struct.unpack(INPUT_ST,r)[0]
def setinput(self,value):
! r = fcntl.ioctl(self.devfd, SETINPUT_NO, struct.pack(INPUT_ST,value))
def querycap(self):
val = struct.pack( QUERYCAP_ST, "", "", "", 0, 0 )
! r = fcntl.ioctl(self.devfd, long(QUERYCAP_NO), val)
return struct.unpack( QUERYCAP_ST, r )
***************
*** 232,236 ****
def enumstd(self, no):
val = struct.pack( ENUMSTD_ST, no, 0, "", 0, 0, 0)
! r = fcntl.ioctl(self.device,ENUMSTD_NO,val)
return struct.unpack( ENUMSTD_ST, r )
--- 249,253 ----
def enumstd(self, no):
val = struct.pack( ENUMSTD_ST, no, 0, "", 0, 0, 0)
! r = fcntl.ioctl(self.devfd,ENUMSTD_NO,val)
return struct.unpack( ENUMSTD_ST, r )
***************
*** 238,242 ****
def getstd(self):
val = struct.pack( STANDARD_ST, 0 )
! r = fcntl.ioctl(self.device,GETSTD_NO, val)
return struct.unpack( STANDARD_ST, r )[0]
--- 255,259 ----
def getstd(self):
val = struct.pack( STANDARD_ST, 0 )
! r = fcntl.ioctl(self.devfd,GETSTD_NO, val)
return struct.unpack( STANDARD_ST, r )[0]
***************
*** 244,253 ****
def setstd(self, value):
val = struct.pack( STANDARD_ST, value )
! r = fcntl.ioctl(self.device,SETSTD_NO, val)
def enuminput(self,index):
val = struct.pack( ENUMINPUT_ST, index, "", 0,0,0,0,0)
! r = fcntl.ioctl(self.device,ENUMINPUT_NO,val)
return struct.unpack( ENUMINPUT_ST, r )
--- 261,270 ----
def setstd(self, value):
val = struct.pack( STANDARD_ST, value )
! r = fcntl.ioctl(self.devfd,SETSTD_NO, val)
def enuminput(self,index):
val = struct.pack( ENUMINPUT_ST, index, "", 0,0,0,0,0)
! r = fcntl.ioctl(self.devfd,ENUMINPUT_NO,val)
return struct.unpack( ENUMINPUT_ST, r )
***************
*** 256,260 ****
val = struct.pack( FMT_ST, 0,0,0,0,0,0,0,0)
try:
! r = fcntl.ioctl(self.device,GET_FMT_NO,val)
return struct.unpack( FMT_ST, r )
except IOError:
--- 273,277 ----
val = struct.pack( FMT_ST, 0,0,0,0,0,0,0,0)
try:
! r = fcntl.ioctl(self.devfd,GET_FMT_NO,val)
return struct.unpack( FMT_ST, r )
except IOError:
***************
*** 265,274 ****
def setfmt(self, width, height):
val = struct.pack( FMT_ST, 1L, width, height, 0L, 4L, 0L, 131072L, 0L)
! r = fcntl.ioctl(self.device,SET_FMT_NO,val)
def gettuner(self,index):
val = struct.pack( TUNER_ST, index, "", 0,0,0,0,0,0,0,0)
! r = fcntl.ioctl(self.device,GET_TUNER_NO,val)
return struct.unpack( TUNER_ST, r )
--- 282,291 ----
def setfmt(self, width, height):
val = struct.pack( FMT_ST, 1L, width, height, 0L, 4L, 0L, 131072L, 0L)
! r = fcntl.ioctl(self.devfd,SET_FMT_NO,val)
def gettuner(self,index):
val = struct.pack( TUNER_ST, index, "", 0,0,0,0,0,0,0,0)
! r = fcntl.ioctl(self.devfd,GET_TUNER_NO,val)
return struct.unpack( TUNER_ST, r )
***************
*** 276,285 ****
def settuner(self,index,audmode):
val = struct.pack( TUNER_ST, index, "", 0,0,0,0,0,audmode,0,0)
! r = fcntl.ioctl(self.device,SET_TUNER_NO,val)
def getaudio(self,index):
val = struct.pack( AUDIO_ST, index, "", 0,0)
! r = fcntl.ioctl(self.device,GET_AUDIO_NO,val)
return struct.unpack( AUDIO_ST, r )
--- 293,302 ----
def settuner(self,index,audmode):
val = struct.pack( TUNER_ST, index, "", 0,0,0,0,0,audmode,0,0)
! r = fcntl.ioctl(self.devfd,SET_TUNER_NO,val)
def getaudio(self,index):
val = struct.pack( AUDIO_ST, index, "", 0,0)
! r = fcntl.ioctl(self.devfd,GET_AUDIO_NO,val)
return struct.unpack( AUDIO_ST, r )
***************
*** 287,301 ****
def setaudio(self,index,mode):
val = struct.pack( AUDIO_ST, index, "", mode, 0)
! r = fcntl.ioctl(self.device,SET_AUDIO_NO,val)
! def init_settings(self, which):
! card = config.TV_SETTINGS.get(which)
! if not card:
! # XXX: print a clever error
return
! self.setstd(NORMS.get(card.norm))
! self.setchanlist(card.chanlist)
# XXX TODO: make a good way of setting the input
--- 304,319 ----
def setaudio(self,index,mode):
val = struct.pack( AUDIO_ST, index, "", mode, 0)
! r = fcntl.ioctl(self.devfd,SET_AUDIO_NO,val)
! def init_settings(self):
! if not self.settings:
! # XXX: clever error here
return
! self.basic_info(self.settings.vdev)
!
! self.setstd(NORMS.get(self.settings.norm))
! self.setchanlist(self.settings.chanlist)
# XXX TODO: make a good way of setting the input
Index: ivtv.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/tv/ivtv.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ivtv.py 13 Aug 2004 15:25:28 -0000 1.15
--- ivtv.py 13 Aug 2004 16:17:33 -0000 1.16
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.16 2004/08/13 16:17:33 rshortt
+ # More work on tv settings, configuration of v4l2 devices based on TV_SETTINGS.
+ #
# Revision 1.15 2004/08/13 15:25:28 rshortt
# Remove TV_IVTV_OPTIONS in favour of new TV_SETTINGS.
***************
*** 71,76 ****
class IVTV(tv.v4l2.Videodev):
! def __init__(self, device):
! tv.v4l2.Videodev.__init__(self, device)
--- 74,79 ----
class IVTV(tv.v4l2.Videodev):
! def __init__(self, which=None, device=None):
! tv.v4l2.Videodev.__init__(self, which, device)
***************
*** 92,101 ****
codec.pulldown,
codec.stream_type)
! r = fcntl.ioctl(self.device, IVTV_IOC_S_CODEC, val)
def getCodecInfo(self):
val = struct.pack( CODEC_ST, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 )
! r = fcntl.ioctl(self.device, IVTV_IOC_G_CODEC, val)
codec_list = struct.unpack(CODEC_ST, r)
return IVTVCodec(codec_list)
--- 95,104 ----
codec.pulldown,
codec.stream_type)
! r = fcntl.ioctl(self.devfd, IVTV_IOC_S_CODEC, val)
def getCodecInfo(self):
val = struct.pack( CODEC_ST, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 )
! r = fcntl.ioctl(self.devfd, IVTV_IOC_G_CODEC, val)
codec_list = struct.unpack(CODEC_ST, r)
return IVTVCodec(codec_list)
***************
*** 107,141 ****
val = struct.pack(MSP_MATRIX_ST, input, output)
! r = fcntl.ioctl(self.device, MSP_SET_MATRIX, val)
! def init_settings(self, which):
! tv.v4l2.Videodev.init_settings(self, which)
! settings = config.TV_SETTINGS.get(which)
! if not settings:
return
! (width, height) = string.split(settings.resolution, 'x')
self.setfmt(int(width), int(height))
codec = self.getCodecInfo()
! codec.aspect = settings.aspect
! codec.audio_bitmask = settings.audio_bitmask
! codec.bframes = settings.bframes
! codec.bitrate_mode = settings.bitrate_mode
! codec.bitrate = settings.bitrate
! codec.bitrate_peak = settings.bitrate_peak
! codec.dnr_mode = settings.dnr_mode
! codec.dnr_spatial = settings.dnr_spatial
! codec.dnr_temporal = settings.dnr_temporal
! codec.dnr_type = settings.dnr_type
! codec.framerate = settings.framerate
! codec.framespergop = settings.framespergop
! codec.gop_closure = settings.gop_closure
! codec.pulldown = settings.pulldown
! codec.stream_type = settings.stream_type
self.setCodecInfo(codec)
--- 110,143 ----
val = struct.pack(MSP_MATRIX_ST, input, output)
! r = fcntl.ioctl(self.devfd, MSP_SET_MATRIX, val)
! def init_settings(self):
! tv.v4l2.Videodev.init_settings(self)
! if not self.settings:
return
! (width, height) = string.split(self.settings.resolution, 'x')
self.setfmt(int(width), int(height))
codec = self.getCodecInfo()
! codec.aspect = self.settings.aspect
! codec.audio_bitmask = self.settings.audio_bitmask
! codec.bframes = self.settings.bframes
! codec.bitrate_mode = self.settings.bitrate_mode
! codec.bitrate = self.settings.bitrate
! codec.bitrate_peak = self.settings.bitrate_peak
! codec.dnr_mode = self.settings.dnr_mode
! codec.dnr_spatial = self.settings.dnr_spatial
! codec.dnr_temporal = self.settings.dnr_temporal
! codec.dnr_type = self.settings.dnr_type
! codec.framerate = self.settings.framerate
! codec.framespergop = self.settings.framespergop
! codec.gop_closure = self.settings.gop_closure
! codec.pulldown = self.settings.pulldown
! codec.stream_type = self.settings.stream_type
self.setCodecInfo(codec)
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog