Monado OpenXR Runtime
Data Structures | Macros | Functions
v4l2_driver.c File Reference

V4L2 frameserver implementation. More...

#include "os/os_time.h"
#include "util/u_var.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "util/u_format.h"
#include "v4l2_interface.h"
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <pthread.h>
#include <linux/videodev2.h>
#include <linux/v4l2-common.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
Include dependency graph for v4l2_driver.c:

Data Structures

struct  v4l2_frame
 
struct  v4l2_control_state
 
struct  v4l2_fs
 A single open v4l2 capture device, starts it's own thread and waits on it. More...
 

Macros

#define V_SPEW(p, ...)
 
#define V_DEBUG(p, ...)
 
#define V_ERROR(p, ...)
 
#define V_CONTROL_GET(VID, CONTROL)
 
#define V_CONTROL_SET(VID, CONTROL, VALUE)
 
#define NUM_V4L2_BUFFERS   3
 
#define CASE(CONTROL)   case V4L2_CID_##CONTROL: str = "V4L2_CID_" #CONTROL; break
 
#define V_CHECK(FLAG)
 

Functions

struct xrt_fsv4l2_fs_create (struct xrt_frame_context *xfctx, const char *path)
 Create a v4l2 frameserver. More...
 

Detailed Description

V4L2 frameserver implementation.

Author
Pete Black pblac.nosp@m.k@co.nosp@m.llabo.nosp@m.ra.c.nosp@m.om
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Macro Definition Documentation

◆ V_CHECK

#define V_CHECK (   FLAG)
Value:
do { \
if (queryctrl.flags & V4L2_CTRL_FLAG_##FLAG) { \
fprintf(stderr, ", " #FLAG); \
} \
} while (false)

◆ V_CONTROL_GET

#define V_CONTROL_GET (   VID,
  CONTROL 
)
Value:
do { \
int _value = 0; \
if (v4l2_control_get(VID, V4L2_CID_##CONTROL, &_value) != 0) { \
V_ERROR(VID, "failed to get V4L2_CID_" #CONTROL); \
} else { \
V_DEBUG(VID, "V4L2_CID_" #CONTROL " = %i", _value); \
} \
} while (false);

◆ V_CONTROL_SET

#define V_CONTROL_SET (   VID,
  CONTROL,
  VALUE 
)
Value:
do { \
if (v4l2_control_set(VID, V4L2_CID_##CONTROL, VALUE) != 0) { \
V_ERROR(VID, "failed to set V4L2_CID_" #CONTROL); \
} \
} while (false);

◆ V_DEBUG

#define V_DEBUG (   p,
  ... 
)
Value:
do { \
if (p->print_debug) { \
fprintf(stderr, "%s - ", __func__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} \
} while (false)

◆ V_ERROR

#define V_ERROR (   p,
  ... 
)
Value:
do { \
fprintf(stderr, "%s - ", __func__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} while (false)

◆ V_SPEW

#define V_SPEW (   p,
  ... 
)
Value:
do { \
if (p->print_spew) { \
fprintf(stderr, "%s - ", __func__); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
} \
} while (false)