Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   Linux and software for Linux (http://stream-recorder.com/forum/forumdisplay.php?f=61)
-   -  

zmu -d /dev/video0 -q -v: Error, failed to query crop /dev/video0: Invalid argument

(http://stream-recorder.com/forum/showthread.php?t=6516)

Stream Recorder 05-03-2010 03:15 AM

zmu -d /dev/video0 -q -v: Error, failed to query crop /dev/video0: Invalid argument


 
When I launch
Code:

zmu -d /dev/video0 -q -v
I get the following error:
Code:

Error, failed to query crop /dev/video0: Invalid argument
I've tried to chmod 777 my web cam:
Code:

sudo chmod 777 /dev/video0
but the I was getting the same error.

However
Code:

zmu -d /dev/video0 -V 1 -q -v
is working fine in Ubuntu 10.04 Lucid:
Code:

Video Device: /dev/video0
Video Capabilities
  Name: Slim 1322 AF
  Type: 1
    Can capture
  Video Channels: 1
  Audio Channels: 0
  Maximum Width: 1280
  Maximum Height: 1024
  Minimum Width: 48
  Minimum Height: 32
Window Attributes
  X Offset: 0
  Y Offset: 0
  Width: 640
  Height: 480
Picture Attributes
  Palette: 8 - YUYV
  Colour Depth: 16
  Brightness: 21959
  Hue: 32768
  Colour :44127
  Contrast: 0
  Whiteness: 0
Channel 0 Attributes
  Name: Camera 1
  Channel: 0
  Flags: 0
  Type: 2 - Camera
  Format: 0 - PAL


Stream Recorder 05-03-2010 04:14 AM

Re: zmu -d /dev/video0 -q -v: Error, failed to query crop /dev/video0: Invalid argume


 
A USB camera that doesn't support cropping will produce an error message
Code:

Error, failed to query crop: /dev/video0: Invalid argument
from
Code:

zmu -d /dev/video0 -q -v

Fix for the problem:
Quote:

Failures are exhibited in zmu, and other places that rely on LocalCamera::GetCurrentSettings.

The fault is in LocalCamera::GetCurrentSettings.

The error arises from the fact that ioctl VIDIOC_G_CROP returns -1 and errno = EINVAL to indicate that cropping is not supported. LocalCamera::GetCurrentSettings treats any negative rc from ioctl VIDIOC_G_CROP as grounds for abnormal termination.

The fix is straightforward and short. All changes are in zm_local_camera.cpp as follows:
Code:

911,912c911
<        int crop_rc = vidioctl( vid_fd, VIDIOC_G_CROP, &crop );
<            if ((crop_rc  < 0 ) && (errno != EINVAL))
---
>            if ( vidioctl( vid_fd, VIDIOC_G_CROP, &crop ) < 0 )
921,928c920,921
<            if ( verbose ) {
<      if (crop_rc >= 0) {
<                    sprintf( output+strlen(output), "  Current: %d x %d\n", crop.c.width, crop.c.height );
<      }
<      else {
<          sprintf( output+strlen(output), "  Current: Cropping is not supported\n");
<      }
<        }
---
>            if ( verbose )
>                sprintf( output+strlen(output), "  Current: %d x %d\n", crop.c.width, crop.c.height );




All times are GMT -6. The time now is 02:22 AM.