>
> Okay, fix attached. Cannot find any problems with it, so I think it is ok.
>
> However, the mmap/munmap should be fixed. Depending on the driver
> capabilities, getimage could start and stop the stream for each frame,
> which involves an mmap on starting stream and an munmap on stopping the
> stream. Therefore I use nextframe instead of getimage, and the problem is
> fixed.
>
> The opening and closing of the device for each frame that was reported is
> probably not a real open() and close(), but simply the start/stop stream.
>
> Harry

Karel notified me that my fix was not okay, it could segfault.
Here is a fixed fix ;-)

Harry
*** msn/utils/linux/capture/capture.c	2006-01-28 00:17:40.000000000 +0100
--- msn-camfix/utils/linux/capture/capture.c	2006-04-29 12:16:02.000000000 +0200
***************
*** 480,485 ****
--- 480,487 ----
      captureItem->rgb_buffer = ng_malloc_video_buf(&captureItem->dev, &captureItem->fmt);
    }
    
+   captureItem->dev.v->startvideo(captureItem->dev.handle, 25, 1);
+   
    Tcl_SetObjResult(interp, Tcl_NewStringObj(captureItem->captureName,-1));
    
    return TCL_OK;
***************
*** 506,511 ****
--- 508,515 ----
      return TCL_ERROR;
    }
    
+   capItem->dev.v->stopvideo(capItem->dev.handle);
+   
    // If a converter was used, close it and release the rgb_buffer
    if (capItem->handle) {
      ng_process_fini(capItem->handle);
***************
*** 607,613 ****
    // - High resolution
    // - Low resolution
    for (dim_idx = resolution;;) {
!     if ((capItem->image_data = capItem->dev.v->getimage(capItem->dev.handle)) == NULL) {
  #   ifdef DEBUG
        fprintf(stderr,"Capturing image failed at %d, %d\n", fmt.width, fmt.height);
  #   endif
--- 611,617 ----
    // - High resolution
    // - Low resolution
    for (dim_idx = resolution;;) {
!     if ((capItem->image_data = capItem->dev.v->nextframe(capItem->dev.handle)) == NULL) {
  #   ifdef DEBUG
        fprintf(stderr,"Capturing image failed at %d, %d\n", fmt.width, fmt.height);
  #   endif

Reply via email to