Update of /cvsroot/freevo/freevo/WIP/RobShortt
In directory sc8-pr-cvs1:/tmp/cvs-serv15818

Added Files:
        v4l2-test.py 
Log Message:
To test v4l code.


--- NEW FILE: v4l2-test.py ---
import time, string

import v4l2, config, ivtv

NORMS = { 'NTSC'  : 0,
          'PAL  ' : 1,
          'SECAM' : 2  }

if __name__ == '__main__':
    # TV_SETTINGS  = 'NORM INPUT CHANLIST DEVICE'
    (v_norm, v_input, v_clist, v_dev) = config.TV_SETTINGS.split()
    v_norm = string.upper(v_norm)

    # v = v4l2.Videodev(v_dev)
    v = ivtv.IVTV(v_dev)
    v.setchanlist(v_clist)
    print "Setting Channel to 17"
    v.setchannel("17")
    print "Enumerating supported Standards."
    try: 
        for i in range(0,255):
            (index,id,name,junk,junk,junk) = v.enumstd(i)
            print "  %i: 0x%x %s" % (index, id, name)
    except:
        pass
    print 'Setting Standard to %s' % v_norm
    v.setinput(NORMS.get(v_norm))
    print "Current Standard is: 0x%x" % v.getstd()
    print "Enumerating supported Inputs."
    try:
        for i in range(0,255):
            (index,name,type,audioset,tuner,std,status) = v.enuminput(i)
            print "  %i: %s" % (index, name)
    except:
        pass
    print "Input: %i" % v.getinput()
    print "Setting Input to 4"
    v.setinput(4)
    (driver,card,bus_info,version,capabilities) = v.querycap()
    print "Driver: %s, Card: %s, Ver: %i, Cap: 0x%x" % 
(driver,card,version,capabilities)
    v.setfmt(720,480)
    (buf_type,width,height,pixelformat,field,bytesperline,sizeimage,colorspace) = 
v.getfmt()
    print "Width: %i, Height: %i" % (width,height)
    print "Read Frequency: %i" % v.getfreq()
    # print v.gettuner(0)

    #now = time.time()
    #stop = now + 10

    #v_in  = open('/dev/video0', 'r')
    #v_out = open('/tmp/vtest.mpeg', 'w')
    #while time.time() < stop:
    #    buf = v_in.read(65536)
    #    v_out.write(buf)

    #v_in.close()
    #v_out.close()
    codec = v.getCodecInfo()
    print 'CODEC: %s' % dir(codec)
    print 'CODEC::bitrate: %s' % codec.bitrate
    codec.bitrate = 3000000
    v.setCodecInfo(codec)
    codec = v.getCodecInfo()
    print 'CODEC: %s' % dir(codec)
    print 'CODEC::bitrate: %s' % codec.bitrate
    v.close()
    





-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to