On Fri, 2005-06-10 at 14:06 +0200, Dirk Meyer wrote:
> I guess we need a 1.5.4 that works on Python 2.4. Can someone help me
> here? I'm very busy with CVS Freevo and would prefer someone else
> sending patches for this.
I had emailed a patch to Rob a couple weeks ago to make Freevo 1.5.x
work with Python 2.4. It doesn't address all areas of code that need
fixing, but it was enough to make it work for me. I've attached it
here.
Jason.
--- freevo.orig/src/tv/v4l2.py 2004-07-10 08:33:42.000000000 -0400
+++ freevo/src/tv/v4l2.py 2005-05-22 21:37:12.000000000 -0400
@@ -48,6 +48,8 @@
DEBUG = config.DEBUG
+def i32(x): return (x&0x80000000L and -2*0x40000000 or 0) + int(x&0x7fffffff)
+
_IOC_NRBITS = 8
_IOC_TYPEBITS = 8
@@ -162,7 +164,7 @@
def getfreq(self):
val = struct.pack( FREQUENCY_ST, 0,0,0 )
- r = fcntl.ioctl(self.device, long(GETFREQ_NO), val)
+ r = fcntl.ioctl(self.device, i32(GETFREQ_NO), val)
(junk,junk, freq, ) = struct.unpack(FREQUENCY_ST, r)
return freq
@@ -196,83 +198,83 @@
def setfreq_old(self, freq):
val = struct.pack( "L", freq)
- r = fcntl.ioctl(self.device, long(SETFREQ_NO_V4L), val)
+ r = fcntl.ioctl(self.device, i32(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)
+ r = fcntl.ioctl(self.device, i32(SETFREQ_NO), val)
def getinput(self):
- r = fcntl.ioctl(self.device, GETINPUT_NO, struct.pack(INPUT_ST,0))
+ r = fcntl.ioctl(self.device, i32(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))
+ r = fcntl.ioctl(self.device, i32(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)
+ r = fcntl.ioctl(self.device, i32(QUERYCAP_NO), val)
return struct.unpack( QUERYCAP_ST, r )
def enumstd(self, no):
val = struct.pack( ENUMSTD_ST, no, 0, "", 0, 0, 0)
- r = fcntl.ioctl(self.device,ENUMSTD_NO,val)
+ r = fcntl.ioctl(self.device, i32(ENUMSTD_NO),val)
return struct.unpack( ENUMSTD_ST, r )
def getstd(self):
val = struct.pack( STANDARD_ST, 0 )
- r = fcntl.ioctl(self.device,GETSTD_NO, val)
+ r = fcntl.ioctl(self.device, i32(GETSTD_NO), val)
return struct.unpack( STANDARD_ST, r )[0]
def setstd(self, value):
val = struct.pack( STANDARD_ST, value )
- r = fcntl.ioctl(self.device,SETSTD_NO, val)
+ r = fcntl.ioctl(self.device, i32(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)
+ r = fcntl.ioctl(self.device, i32(ENUMINPUT_NO),val)
return struct.unpack( ENUMINPUT_ST, r )
def getfmt(self):
val = struct.pack( FMT_ST, 0,0,0,0,0,0,0,0)
- r = fcntl.ioctl(self.device,GET_FMT_NO,val)
+ r = fcntl.ioctl(self.device, i32(GET_FMT_NO),val)
return struct.unpack( FMT_ST, r )
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)
+ r = fcntl.ioctl(self.device, i32(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)
+ r = fcntl.ioctl(self.device, i32(GET_TUNER_NO),val)
return struct.unpack( TUNER_ST, r )
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)
+ r = fcntl.ioctl(self.device, i32(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)
+ r = fcntl.ioctl(self.device, i32(GET_AUDIO_NO),val)
return struct.unpack( AUDIO_ST, r )
def setaudio(self,index,mode):
val = struct.pack( AUDIO_ST, index, "", mode, 0)
- r = fcntl.ioctl(self.device,SET_AUDIO_NO,val)
+ r = fcntl.ioctl(self.device, i32(SET_AUDIO_NO),val)
def init_settings(self):
--- freevo.orig/src/tv/ivtv.py 2004-07-10 08:33:41.000000000 -0400
+++ freevo/src/tv/ivtv.py 2005-05-22 21:37:14.000000000 -0400
@@ -43,6 +43,8 @@
import tv.v4l2, config
+def i32(x): return (x&0x80000000L and -2*0x40000000 or 0) + int(x&0x7fffffff)
+
# ioctls
IVTV_IOC_G_CODEC = 0xFFEE7703
IVTV_IOC_S_CODEC = 0xFFEE7704
@@ -85,12 +87,12 @@
codec.gop_closure,
codec.pulldown,
codec.stream_type)
- r = fcntl.ioctl(self.device, IVTV_IOC_S_CODEC, val)
+ r = fcntl.ioctl(self.device, i32(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)
+ r = fcntl.ioctl(self.device, i32(IVTV_IOC_G_CODEC), val)
codec_list = struct.unpack(CODEC_ST, r)
return IVTVCodec(codec_list)
@@ -100,7 +102,7 @@
if not output: output = 1
val = struct.pack(MSP_MATRIX_ST, input, output)
- r = fcntl.ioctl(self.device, MSP_SET_MATRIX, val)
+ r = fcntl.ioctl(self.device, i32(MSP_SET_MATRIX), val)
def init_settings(self, opts=None):