TwiceAsNice  2019-02-18
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
INDI::V4L2_Base Class Reference

#include <v4l2_base.h>

Collaboration diagram for INDI::V4L2_Base:
Collaboration graph

Classes

struct  buffer
 

Public Types

enum  io_method { IO_METHOD_READ, IO_METHOD_MMAP, IO_METHOD_USERPTR }
 

Public Member Functions

 V4L2_Base ()
 
virtual ~V4L2_Base ()
 
virtual int connectCam (const char *devpath, char *errmsg, int pixelFormat=-1, int width=-1, int height=-1)
 
virtual void disconnectCam (bool stopcapture)
 
char * getDeviceName ()
 
void setDeviceName (const char *name)
 
bool isLXmodCapable ()
 
void callFrame (void *p)
 
int getFormat ()
 
int getWidth ()
 
int getHeight ()
 
int getBpp ()
 
virtual int setSize (int x, int y)
 
virtual void getMaxMinSize (int &x_max, int &y_max, int &x_min, int &y_min)
 
unsigned char * getY ()
 
unsigned char * getU ()
 
unsigned char * getV ()
 
unsigned char * getRGBBuffer ()
 
float * getLinearY ()
 
void registerCallback (WPF *fp, void *ud)
 
int start_capturing (char *errmsg)
 
int stop_capturing (char *errmsg)
 
void enumerate_ctrl ()
 
void enumerate_menu ()
 
bool enumerate_ext_ctrl ()
 
int queryINTControls (INumberVectorProperty *nvp)
 
bool queryExtControls (INumberVectorProperty *nvp, unsigned int *nnumber, ISwitchVectorProperty **options, unsigned int *noptions, const char *dev, const char *group)
 
void queryControls (INumberVectorProperty *nvp, unsigned int *nnumber, ISwitchVectorProperty **options, unsigned int *noptions, const char *dev, const char *group)
 
int getControl (unsigned int ctrl_id, double *value, char *errmsg)
 
int setINTControl (unsigned int ctrl_id, double new_value, char *errmsg)
 
int setOPTControl (unsigned int ctrl_id, unsigned int new_value, char *errmsg)
 
int query_ctrl (unsigned int ctrl_id, double &ctrl_min, double &ctrl_max, double &ctrl_step, double &ctrl_value, char *errmsg)
 
void getinputs (ISwitchVectorProperty *inputssp)
 
int setinput (unsigned int inputindex, char *errmsg)
 
void getcaptureformats (ISwitchVectorProperty *captureformatssp)
 
int setcaptureformat (unsigned int captureformatindex, char *errmsg)
 
void getcapturesizes (ISwitchVectorProperty *capturesizessp, INumberVectorProperty *capturesizenp)
 
int setcapturesize (unsigned int w, unsigned int h, char *errmsg)
 
void getframerates (ISwitchVectorProperty *frameratessp, INumberVectorProperty *frameratenp)
 
int setcroprect (int x, int y, int w, int h, char *errmsg)
 
struct v4l2_rect getcroprect ()
 
void setColorProcessing (bool quantization, bool colorconvert, bool linearization)
 
void setlxstate (short s)
 
short getlxstate ()
 
bool isstreamactive ()
 
void doDecode (bool)
 

Static Public Member Functions

static void newFrame (int fd, void *p)
 

Public Attributes

int(V4L2_Base::* setframerate )(struct v4l2_fract frate, char *errmsg)
 
struct v4l2_fract(V4L2_Base::* getframerate )()
 

Protected Member Functions

int xioctl (int fd, int request, void *arg, char const *const request_str)
 
int ioctl_set_format (struct v4l2_format new_fmt, char *errmsg)
 
int read_frame (char *errsg)
 
int uninit_device (char *errmsg)
 
int open_device (const char *devpath, char *errmsg)
 
int check_device (char *errmsg)
 
int init_device (char *errmsg)
 
int init_mmap (char *errmsg)
 
int errno_exit (const char *s, char *errmsg)
 
void close_device ()
 
void init_userp (unsigned int buffer_size)
 
void init_read (unsigned int buffer_size)
 
void findMinMax ()
 
int stdsetframerate (struct v4l2_fract frate, char *errmsg)
 
int pwcsetframerate (struct v4l2_fract frate, char *errmsg)
 
struct v4l2_fract stdgetframerate ()
 
bool is_compressed () const
 Helper indicating whether current pixel format is compressed or not. More...
 

Protected Attributes

int enumeratedInputs
 
int enumeratedCaptureFormats
 
struct v4l2_capability cap
 
struct v4l2_cropcap cropcap
 
struct v4l2_crop crop
 
struct v4l2_format fmt
 
struct v4l2_input input
 
struct v4l2_buffer buf
 
bool cancrop
 
bool cropset
 
bool cansetrate
 
bool streamedonce
 
bool streamactive
 
short lxstate
 
struct v4l2_queryctrl queryctrl
 
struct v4l2_querymenu querymenu
 
bool has_ext_pix_format
 
WPFcallback
 
void * uptr
 
char dev_name [64]
 
const char * path
 
io_method io
 
int fd
 
struct bufferbuffers
 
unsigned int n_buffers
 
bool reallocate_buffers
 
struct v4l2_fract frameRate
 
int xmax
 
int xmin
 
int ymax
 
int ymin
 
int selectCallBackID
 
V4L2_Decodev4l2_decode
 
V4L2_Decoderdecoder
 
bool dodecode
 
int bpp
 
char deviceName [MAXINDIDEVICE]
 

Friends

class ::V4L2_Driver
 

Member Enumeration Documentation

◆ io_method

Enumerator
IO_METHOD_READ 
IO_METHOD_MMAP 
IO_METHOD_USERPTR 

Constructor & Destructor Documentation

◆ V4L2_Base()

INDI::V4L2_Base::V4L2_Base ( )

◆ ~V4L2_Base()

INDI::V4L2_Base::~V4L2_Base ( )
virtual

Member Function Documentation

◆ callFrame()

void INDI::V4L2_Base::callFrame ( void *  p)

◆ check_device()

int INDI::V4L2_Base::check_device ( char *  errmsg)
protected

◆ close_device()

void INDI::V4L2_Base::close_device ( )
protected

◆ connectCam()

int INDI::V4L2_Base::connectCam ( const char *  devpath,
char *  errmsg,
int  pixelFormat = -1,
int  width = -1,
int  height = -1 
)
virtual

◆ disconnectCam()

void INDI::V4L2_Base::disconnectCam ( bool  stopcapture)
virtual

◆ doDecode()

void INDI::V4L2_Base::doDecode ( bool  d)

◆ enumerate_ctrl()

void INDI::V4L2_Base::enumerate_ctrl ( )

◆ enumerate_ext_ctrl()

bool INDI::V4L2_Base::enumerate_ext_ctrl ( )

◆ enumerate_menu()

void INDI::V4L2_Base::enumerate_menu ( )

◆ errno_exit()

int INDI::V4L2_Base::errno_exit ( const char *  s,
char *  errmsg 
)
protected

◆ findMinMax()

void INDI::V4L2_Base::findMinMax ( )
protected

◆ getBpp()

int INDI::V4L2_Base::getBpp ( )

◆ getcaptureformats()

void INDI::V4L2_Base::getcaptureformats ( ISwitchVectorProperty captureformatssp)

◆ getcapturesizes()

void INDI::V4L2_Base::getcapturesizes ( ISwitchVectorProperty capturesizessp,
INumberVectorProperty capturesizenp 
)

◆ getControl()

int INDI::V4L2_Base::getControl ( unsigned int  ctrl_id,
double *  value,
char *  errmsg 
)

◆ getcroprect()

struct v4l2_rect INDI::V4L2_Base::getcroprect ( )

◆ getDeviceName()

char * INDI::V4L2_Base::getDeviceName ( )

◆ getFormat()

int INDI::V4L2_Base::getFormat ( )

◆ getframerates()

void INDI::V4L2_Base::getframerates ( ISwitchVectorProperty frameratessp,
INumberVectorProperty frameratenp 
)

◆ getHeight()

int INDI::V4L2_Base::getHeight ( )

◆ getinputs()

void INDI::V4L2_Base::getinputs ( ISwitchVectorProperty inputssp)

◆ getLinearY()

float * INDI::V4L2_Base::getLinearY ( )

◆ getlxstate()

short INDI::V4L2_Base::getlxstate ( )
inline

◆ getMaxMinSize()

void INDI::V4L2_Base::getMaxMinSize ( int &  x_max,
int &  y_max,
int &  x_min,
int &  y_min 
)
virtual

◆ getRGBBuffer()

unsigned char * INDI::V4L2_Base::getRGBBuffer ( )

◆ getU()

unsigned char * INDI::V4L2_Base::getU ( )

◆ getV()

unsigned char * INDI::V4L2_Base::getV ( )

◆ getWidth()

int INDI::V4L2_Base::getWidth ( )

◆ getY()

unsigned char * INDI::V4L2_Base::getY ( )

◆ init_device()

int INDI::V4L2_Base::init_device ( char *  errmsg)
protected

◆ init_mmap()

int INDI::V4L2_Base::init_mmap ( char *  errmsg)
protected

◆ init_read()

void INDI::V4L2_Base::init_read ( unsigned int  buffer_size)
protected

◆ init_userp()

void INDI::V4L2_Base::init_userp ( unsigned int  buffer_size)
protected

◆ ioctl_set_format()

int INDI::V4L2_Base::ioctl_set_format ( struct v4l2_format  new_fmt,
char *  errmsg 
)
protected

◆ is_compressed()

bool INDI::V4L2_Base::is_compressed ( ) const
protected

Helper indicating whether current pixel format is compressed or not.

This function is used in read_frame to check for corrupted frames.

Returns
true if pixel format is considered compressed by the driver, else false.
Warning
If kernel headers 3.17 or later are available, this function will rely on field 'flags', else will compare the current pixel format against an arbitrary list of known format codes.

◆ isLXmodCapable()

bool INDI::V4L2_Base::isLXmodCapable ( )

◆ isstreamactive()

bool INDI::V4L2_Base::isstreamactive ( )
inline

◆ newFrame()

void INDI::V4L2_Base::newFrame ( int  fd,
void *  p 
)
static

◆ open_device()

int INDI::V4L2_Base::open_device ( const char *  devpath,
char *  errmsg 
)
protected

◆ pwcsetframerate()

int INDI::V4L2_Base::pwcsetframerate ( struct v4l2_fract  frate,
char *  errmsg 
)
protected

◆ query_ctrl()

int INDI::V4L2_Base::query_ctrl ( unsigned int  ctrl_id,
double &  ctrl_min,
double &  ctrl_max,
double &  ctrl_step,
double &  ctrl_value,
char *  errmsg 
)

◆ queryControls()

void INDI::V4L2_Base::queryControls ( INumberVectorProperty nvp,
unsigned int *  nnumber,
ISwitchVectorProperty **  options,
unsigned int *  noptions,
const char *  dev,
const char *  group 
)

◆ queryExtControls()

bool INDI::V4L2_Base::queryExtControls ( INumberVectorProperty nvp,
unsigned int *  nnumber,
ISwitchVectorProperty **  options,
unsigned int *  noptions,
const char *  dev,
const char *  group 
)

◆ queryINTControls()

int INDI::V4L2_Base::queryINTControls ( INumberVectorProperty nvp)

◆ read_frame()

int INDI::V4L2_Base::read_frame ( char *  errsg)
protected

◆ registerCallback()

void INDI::V4L2_Base::registerCallback ( WPF fp,
void *  ud 
)

◆ setcaptureformat()

int INDI::V4L2_Base::setcaptureformat ( unsigned int  captureformatindex,
char *  errmsg 
)

◆ setcapturesize()

int INDI::V4L2_Base::setcapturesize ( unsigned int  w,
unsigned int  h,
char *  errmsg 
)

◆ setColorProcessing()

void INDI::V4L2_Base::setColorProcessing ( bool  quantization,
bool  colorconvert,
bool  linearization 
)

◆ setcroprect()

int INDI::V4L2_Base::setcroprect ( int  x,
int  y,
int  w,
int  h,
char *  errmsg 
)

◆ setDeviceName()

void INDI::V4L2_Base::setDeviceName ( const char *  name)

◆ setinput()

int INDI::V4L2_Base::setinput ( unsigned int  inputindex,
char *  errmsg 
)

◆ setINTControl()

int INDI::V4L2_Base::setINTControl ( unsigned int  ctrl_id,
double  new_value,
char *  errmsg 
)

◆ setlxstate()

void INDI::V4L2_Base::setlxstate ( short  s)
inline

◆ setOPTControl()

int INDI::V4L2_Base::setOPTControl ( unsigned int  ctrl_id,
unsigned int  new_value,
char *  errmsg 
)

◆ setSize()

int INDI::V4L2_Base::setSize ( int  x,
int  y 
)
virtual

◆ start_capturing()

int INDI::V4L2_Base::start_capturing ( char *  errmsg)

◆ stdgetframerate()

struct v4l2_fract INDI::V4L2_Base::stdgetframerate ( )
protected

◆ stdsetframerate()

int INDI::V4L2_Base::stdsetframerate ( struct v4l2_fract  frate,
char *  errmsg 
)
protected

◆ stop_capturing()

int INDI::V4L2_Base::stop_capturing ( char *  errmsg)

◆ uninit_device()

int INDI::V4L2_Base::uninit_device ( char *  errmsg)
protected

◆ xioctl()

int INDI::V4L2_Base::xioctl ( int  fd,
int  request,
void *  arg,
char const *const  request_str 
)
protected

Friends And Related Function Documentation

◆ ::V4L2_Driver

friend class ::V4L2_Driver
friend

Member Data Documentation

◆ bpp

int INDI::V4L2_Base::bpp
protected

◆ buf

struct v4l2_buffer INDI::V4L2_Base::buf
protected

◆ buffers

struct buffer* INDI::V4L2_Base::buffers
protected

◆ callback

WPF* INDI::V4L2_Base::callback
protected

◆ cancrop

bool INDI::V4L2_Base::cancrop
protected

◆ cansetrate

bool INDI::V4L2_Base::cansetrate
protected

◆ cap

struct v4l2_capability INDI::V4L2_Base::cap
protected

◆ crop

struct v4l2_crop INDI::V4L2_Base::crop
protected

◆ cropcap

struct v4l2_cropcap INDI::V4L2_Base::cropcap
protected

◆ cropset

bool INDI::V4L2_Base::cropset
protected

◆ decoder

V4L2_Decoder* INDI::V4L2_Base::decoder
protected

◆ dev_name

char INDI::V4L2_Base::dev_name[64]
protected

◆ deviceName

char INDI::V4L2_Base::deviceName[MAXINDIDEVICE]
protected

◆ dodecode

bool INDI::V4L2_Base::dodecode
protected

◆ enumeratedCaptureFormats

int INDI::V4L2_Base::enumeratedCaptureFormats
protected

◆ enumeratedInputs

int INDI::V4L2_Base::enumeratedInputs
protected

◆ fd

int INDI::V4L2_Base::fd
protected

◆ fmt

struct v4l2_format INDI::V4L2_Base::fmt
protected

◆ frameRate

struct v4l2_fract INDI::V4L2_Base::frameRate
protected

◆ getframerate

struct v4l2_fract(V4L2_Base::* INDI::V4L2_Base::getframerate) ()

◆ has_ext_pix_format

bool INDI::V4L2_Base::has_ext_pix_format
protected

◆ input

struct v4l2_input INDI::V4L2_Base::input
protected

◆ io

io_method INDI::V4L2_Base::io
protected

◆ lxstate

short INDI::V4L2_Base::lxstate
protected

◆ n_buffers

unsigned int INDI::V4L2_Base::n_buffers
protected

◆ path

const char* INDI::V4L2_Base::path
protected

◆ queryctrl

struct v4l2_queryctrl INDI::V4L2_Base::queryctrl
protected

◆ querymenu

struct v4l2_querymenu INDI::V4L2_Base::querymenu
protected

◆ reallocate_buffers

bool INDI::V4L2_Base::reallocate_buffers
protected

◆ selectCallBackID

int INDI::V4L2_Base::selectCallBackID
protected

◆ setframerate

int(V4L2_Base::* INDI::V4L2_Base::setframerate) (struct v4l2_fract frate, char *errmsg)

◆ streamactive

bool INDI::V4L2_Base::streamactive
protected

◆ streamedonce

bool INDI::V4L2_Base::streamedonce
protected

◆ uptr

void* INDI::V4L2_Base::uptr
protected

◆ v4l2_decode

V4L2_Decode* INDI::V4L2_Base::v4l2_decode
protected

◆ xmax

int INDI::V4L2_Base::xmax
protected

◆ xmin

int INDI::V4L2_Base::xmin
protected

◆ ymax

int INDI::V4L2_Base::ymax
protected

◆ ymin

int INDI::V4L2_Base::ymin
protected

The documentation for this class was generated from the following files: