Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 2015 06:45:44 -0300
From:      =?UTF-8?B?T3RhY8OtbGlv?= <otacilio.neto@bsd.com.br>
To:        Hans Petter Selasky <hps@selasky.org>, freebsd-multimedia@freebsd.org
Cc:        otaciliodearaujo@gmail.com
Subject:   Re: linux/uvcvideo.h
Message-ID:  <565431C8.10309@bsd.com.br>
In-Reply-To: <56541D9A.3090703@selasky.org>
References:  <5653D36B.5040906@bsd.com.br> <56541D9A.3090703@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Em 24/11/2015 05:19, Hans Petter Selasky escreveu:
> On 11/24/15 04:03, Otacílio wrote:
>> Dears
>>
>> I'm compiling a program that uses the header file linux/uvcvideo.h
>>
>> I think that this file must be on v4l_compat but this file is not in
>> v4l_compat-1.6.3*. This file must be add to v4l_compat or this file is
>> not necessary on FreeBSD?
>>
>
> Hi,
>
> Currently the v4l_compat only contains V4L1/2 IOCTLs only.
>
> What API's do you need?
>
> --HPS
>
Hello Sr. Selasky

I'm using a Qualitech C920 camera to get a video stream codified using 
the hardware of the camera (H264). The default bitrate of the camera is 
about 3500Mbps, so I need change this value to a smaller. Googling I 
found a example for Linux that changes the bitrate and I'm using the 
example on my software on FreeBSD. The code that I need is this below:

static void setBitrate(int bmin, int bmax){
   int res;
   struct uvc_xu_control_query ctrl;
   uvcx_bitrate_layers_t  conf;
   ctrl.unit = 12;
   ctrl.size = 10;
   ctrl.selector = UVCX_BITRATE_LAYERS;
   ctrl.data = &conf;
   ctrl.query = UVC_GET_CUR;
   conf.wLayerID = 0;
   conf.dwPeakBitrate = conf.dwAverageBitrate = 0;
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
   if (res)
     {
       perror("ctrl_query");
       return;
     }
   fprintf(stderr, "Bitrate was %d [%d]\n", conf.dwPeakBitrate * 8, 
conf.dwAverageBitrate * 8);
   conf.dwPeakBitrate = bmax;
   conf.dwAverageBitrate = bmin;
   ctrl.query = UVC_SET_CUR;
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
   if (res)
     {
       perror("ctrl_query");
       return;
     }
   fprintf(stderr, "Bitrate request %d [%d]\n", conf.dwPeakBitrate * 8, 
conf.dwAverageBitrate * 8);
   ctrl.query = UVC_GET_CUR;
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
   if (res)
     {
       perror("ctrl_query");
       return;
     }
   fprintf(stderr, "Bitrate now %d [%d]\n", conf.dwPeakBitrate * 8, 
conf.dwAverageBitrate * 8);
}

static void setRCMode(int mode){
   int res;
   struct uvc_xu_control_query ctrl;
   uvcx_rate_control_mode_t conf;
   ctrl.selector = UVCX_RATE_CONTROL_MODE;
   ctrl.size = 3;
   ctrl.unit = 12;
   ctrl.data = &conf;
   ctrl.query = UVC_GET_CUR;
   conf.wLayerID = 0;
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
   if (res) { perror("query"); return;}
   fprintf(stderr, "RC mode was %d\n", (int)conf.bRateControlMode);
   conf.bRateControlMode = mode;
   ctrl.query = UVC_SET_CUR;
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
   if (res) { perror("query"); return;}
   fprintf(stderr, "RC mode request %d\n", (int)conf.bRateControlMode);
   ctrl.query = UVC_GET_CUR;
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
   if (res) { perror("query"); return;}
   fprintf(stderr, "RC mode now %d\n", (int)conf.bRateControlMode);
}

So, when I try compile this software I got  this errors:

cc  -I/usr/local/include -I../Capture\ H264 -I../lib -c -o capture.o 
capture.c
capture.c:463:31: error: variable has incomplete type 'struct 
uvc_xu_control_query'
   struct uvc_xu_control_query ctrl;
                               ^
capture.c:463:10: note: forward declaration of 'struct 
uvc_xu_control_query'
   struct uvc_xu_control_query ctrl;
          ^
capture.c:472:20: error: use of undeclared identifier 'UVCIOC_CTRL_QUERY'
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
                    ^
capture.c:482:20: error: use of undeclared identifier 'UVCIOC_CTRL_QUERY'
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
                    ^
capture.c:490:20: error: use of undeclared identifier 'UVCIOC_CTRL_QUERY'
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
                    ^
capture.c:501:31: error: variable has incomplete type 'struct 
uvc_xu_control_query'
   struct uvc_xu_control_query ctrl;
                               ^
capture.c:501:10: note: forward declaration of 'struct 
uvc_xu_control_query'
   struct uvc_xu_control_query ctrl;
          ^
capture.c:509:20: error: use of undeclared identifier 'UVCIOC_CTRL_QUERY'
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
                    ^
capture.c:514:20: error: use of undeclared identifier 'UVCIOC_CTRL_QUERY'
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
                    ^
capture.c:518:20: error: use of undeclared identifier 'UVCIOC_CTRL_QUERY'
   res = xioctl(fd, UVCIOC_CTRL_QUERY, &ctrl);
                    ^
8 errors generated.
Makefile:6: recipe for target 'capture.o' failed
gmake: *** [capture.o] Error 1


What is the best solution to this problem? I need add the header file 
#include <linux/uvcvideo.h> ?

Thanks a lot!
-Otacílio



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?565431C8.10309>