Yes, your last modifications made it work after about 2 or 3 seconds. (I moved the gst initialisation and implemented the try/catch loop) Thanks
2011/12/7 James Cameron <qu...@laptop.org> > On Wed, Dec 07, 2011 at 01:07:46AM +0100, laurent bernabe wrote: > > 2011/12/7 James Cameron <qu...@laptop.org> wrote: > > > You might also try moving the setup of the gst stream to after the > > > initialisation of pygame. Experiment, and let us know your results. > > > > Sorry but I did not understand this sentence > > Sorry. Try moving the "setup of the gst stream" to after the > "initialisation of pygame". > > The "setup of the gst stream" are the lines: > > # grab a frame from camera to file > pipeline = gst.parse_launch('v4l2src ! ffmpegcolorspace ! jpegenc ! > filesink location=/tmp/pippypic.jpg') > pipeline.set_state(gst.STATE_PLAYING) > > The "initialisation of pygame" is the line: > > # start using pygame > pygame.init() > > Moving one beyond the other means to change the order in which these > operations occur. I expect the result will be certain failure, which is > a useful result because it proves the timing is important. > > -- > > Given your test results of success if more time is wasted, perhaps the > program should retry the read of the file until it works, like this: > > # start using pygame > pygame.init() > > # turn off cursor > pygame.mouse.set_visible(False) > > # create the pygame window and return a Surface object for > # drawing in that window. > screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) > > # grab a frame from camera to file > pipeline = gst.parse_launch('v4l2src ! ffmpegcolorspace ! jpegenc ! > filesink location=/tmp/pippypic.jpg') > pipeline.set_state(gst.STATE_PLAYING) > > while True: > try: > # load in the grabbed camera frame > image = pygame.image.load('/tmp/pippypic.jpg') > break > except pygame.error: > # pause to allow more time for the camera frame to be grabbed > time.sleep(1) > > ... > > -- > James Cameron > http://quozl.linux.org.au/ >
_______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel