Esempio n. 1
0
 def GetCurrentFormat(self):
   form = v4l2.v4l2_format()
   form.type = v4l2.V4L2_BUF_TYPE_VIDEO_CAPTURE
   xioctl(self.vd, v4l2.VIDIOC_G_FMT, form)
   
   self.shape = (form.fmt.pix.height, form.fmt.pix.width) ##### self.shape
   
   stp = v4l2.v4l2_streamparm()
   stp.type = v4l2.V4L2_BUF_TYPE_VIDEO_CAPTURE
   xioctl(self.vd, v4l2.VIDIOC_G_PARM, stp)
   self.fps = stp.parm.capture.timeperframe.denominator/stp.parm.capture.timeperframe.numerator    
   if self.verbose:
     print '--GetCurrentFormat'
     print '  + width:', form.fmt.pix.width
     print '  + height:', form.fmt.pix.height
     print '  + pixelformat:', hex(form.fmt.pix.pixelformat)
     print '  + sizeimage:', form.fmt.pix.sizeimage
   #print 'Get:', self.shape, self.fps
   return form, stp
Esempio n. 2
0
 def set_fps(self, fps):
     setfps = v4l2.v4l2_streamparm()
     setfps.type = v4l2.V4L2_BUF_TYPE_VIDEO_CAPTURE
     setfps.parm.capture.timeperframe.numerator = 1
     setfps.parm.capture.timeperframe.denominator = fps
     fcntl.ioctl(self, v4l2.VIDIOC_S_PARM, setfps)
Esempio n. 3
0
 def update_frame_rate(self):
     c = v4l2.v4l2_streamparm()
     c.type = v4l2.V4L2_BUF_TYPE_VIDEO_CAPTURE
     c.parm.capture.timeperframe.numerator = 1
     c.parm.capture.timeperframe.denominator = 10
     fcntl.ioctl(self.video.fileno(), v4l2.VIDIOC_S_PARM, c)