v4l2.c File Reference

Include dependency graph for v4l2.c:


Data Structures

struct  buffer_t
struct  demux_sys_t

Defines

#define DEV_TEXT   N_("Device name")
#define DEV_LONGTEXT
#define STANDARD_TEXT   N_( "Standard" )
#define STANDARD_LONGTEXT
#define CHROMA_TEXT   N_("Video input chroma format")
#define CHROMA_LONGTEXT
#define INPUT_TEXT   N_( "Input" )
#define INPUT_LONGTEXT
#define AUDIO_INPUT_TEXT   N_( "Audio input" )
#define AUDIO_INPUT_LONGTEXT
#define IOMETHOD_TEXT   N_( "IO Method" )
#define IOMETHOD_LONGTEXT
#define WIDTH_TEXT   N_( "Width" )
#define WIDTH_LONGTEXT
#define HEIGHT_TEXT   N_( "Height" )
#define HEIGHT_LONGTEXT
#define FPS_TEXT   N_( "Framerate" )
#define FPS_LONGTEXT
#define CTRL_RESET_TEXT   N_( "Reset v4l2 controls" )
#define CTRL_RESET_LONGTEXT
#define BRIGHTNESS_TEXT   N_( "Brightness" )
#define BRIGHTNESS_LONGTEXT
#define CONTRAST_TEXT   N_( "Contrast" )
#define CONTRAST_LONGTEXT
#define SATURATION_TEXT   N_( "Saturation" )
#define SATURATION_LONGTEXT
#define HUE_TEXT   N_( "Hue" )
#define HUE_LONGTEXT
#define BLACKLEVEL_TEXT   N_( "Black level" )
#define BLACKLEVEL_LONGTEXT
#define AUTOWHITEBALANCE_TEXT   N_( "Auto white balance" )
#define AUTOWHITEBALANCE_LONGTEXT
#define DOWHITEBALANCE_TEXT   N_( "Do white balance" )
#define DOWHITEBALANCE_LONGTEXT
#define REDBALANCE_TEXT   N_( "Red balance" )
#define REDBALANCE_LONGTEXT
#define BLUEBALANCE_TEXT   N_( "Blue balance" )
#define BLUEBALANCE_LONGTEXT
#define GAMMA_TEXT   N_( "Gamma" )
#define GAMMA_LONGTEXT
#define EXPOSURE_TEXT   N_( "Exposure" )
#define EXPOSURE_LONGTEXT
#define AUTOGAIN_TEXT   N_( "Auto gain" )
#define AUTOGAIN_LONGTEXT
#define GAIN_TEXT   N_( "Gain" )
#define GAIN_LONGTEXT
#define HFLIP_TEXT   N_( "Horizontal flip" )
#define HFLIP_LONGTEXT
#define VFLIP_TEXT   N_( "Vertical flip" )
#define VFLIP_LONGTEXT
#define HCENTER_TEXT   N_( "Horizontal centering" )
#define HCENTER_LONGTEXT
#define VCENTER_TEXT   N_( "Vertical centering" )
#define VCENTER_LONGTEXT
#define ADEV_TEXT   N_("Audio device name")
#define ADEV_LONGTEXT
#define AUDIO_METHOD_TEXT   N_( "Audio method" )
#define AUDIO_METHOD_LONGTEXT
#define AUDIO_VOLUME_TEXT   N_( "Volume" )
#define AUDIO_VOLUME_LONGTEXT
#define AUDIO_BALANCE_TEXT   N_( "Balance" )
#define AUDIO_BALANCE_LONGTEXT
#define AUDIO_MUTE_TEXT   N_( "Mute" )
#define AUDIO_MUTE_LONGTEXT
#define AUDIO_BASS_TEXT   N_( "Bass" )
#define AUDIO_BASS_LONGTEXT
#define AUDIO_TREBLE_TEXT   N_( "Treble" )
#define AUDIO_TREBLE_LONGTEXT
#define AUDIO_LOUDNESS_TEXT   N_( "Loudness" )
#define AUDIO_LOUDNESS_LONGTEXT
#define STEREO_TEXT   N_( "Stereo" )
#define STEREO_LONGTEXT
#define SAMPLERATE_TEXT   N_( "Samplerate" )
#define SAMPLERATE_LONGTEXT
#define CACHING_TEXT   N_("Caching value in ms")
#define CACHING_LONGTEXT
#define S_CTRLS_TEXT   N_("v4l2 driver controls")
#define S_CTRLS_LONGTEXT
#define TUNER_TEXT   N_("Tuner id")
#define TUNER_LONGTEXT
#define FREQUENCY_TEXT   N_("Frequency")
#define FREQUENCY_LONGTEXT
#define TUNER_AUDIO_MODE_TEXT   N_("Audio mode")
#define TUNER_AUDIO_MODE_LONGTEXT
#define FIND_VIDEO   1
#define FIND_AUDIO   2
#define AUDIO_METHOD_OSS   1
#define OSS_DEFAULT   "/dev/dsp"
#define AUDIO_METHOD_ALSA   2
#define ALSA_DEFAULT   "hw"
#define CFG_PREFIX   "v4l2-"

Enumerations

enum  io_method { IO_METHOD_READ, IO_METHOD_MMAP, IO_METHOD_USERPTR }

Functions

static int DemuxOpen (vlc_object_t *)
static void DemuxClose (vlc_object_t *)
static int AccessOpen (vlc_object_t *)
static void AccessClose (vlc_object_t *)
int vlc_entry__main (module_t *p_module)
const char * vlc_entry_license__main (void)
static void CommonClose (vlc_object_t *, demux_sys_t *)
static void ParseMRL (demux_sys_t *, char *, vlc_object_t *)
static void GetV4L2Params (demux_sys_t *, vlc_object_t *)
static void SetAvailControlsByString (vlc_object_t *, demux_sys_t *, int)
static int DemuxControl (demux_t *, int, va_list)
static int AccessControl (access_t *, int, va_list)
static int Demux (demux_t *)
static ssize_t AccessRead (access_t *, uint8_t *, size_t)
static block_tGrabVideo (demux_t *p_demux)
static block_tProcessVideoFrame (demux_t *p_demux, uint8_t *p_frame, size_t)
static block_tGrabAudio (demux_t *p_demux)
static bool IsPixelFormatSupported (demux_t *p_demux, unsigned int i_pixelformat)
static int OpenVideoDev (vlc_object_t *, demux_sys_t *, bool)
static int OpenAudioDev (vlc_object_t *, demux_sys_t *, bool)
static bool ProbeVideoDev (vlc_object_t *, demux_sys_t *, char *psz_device)
static bool ProbeAudioDev (vlc_object_t *, demux_sys_t *, char *psz_device)
static int ControlList (vlc_object_t *, int, bool, bool)
static int Control (vlc_object_t *, int i_fd, const char *psz_name, int i_cid, int i_value)
static int DemuxControlCallback (vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data)
static int DemuxControlResetCallback (vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data)
static int AccessControlCallback (vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data)
static int AccessControlResetCallback (vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data)
static int FindMainDevice (vlc_object_t *p_this, demux_sys_t *p_sys, int i_flags, bool b_demux, bool b_forced)
static int InitRead (demux_t *p_demux, int i_fd, unsigned int i_buffer_size)
static int InitMmap (demux_t *p_demux, int i_fd)
static int InitUserP (demux_t *p_demux, int i_fd, unsigned int i_buffer_size)
static int OpenAudioDevOss (vlc_object_t *p_this, demux_sys_t *p_sys, bool b_demux)
static bool ProbeAudioDevOss (vlc_object_t *p_this, demux_sys_t *p_sys, char *psz_device)
static void name2var (unsigned char *name)
static void ControlListPrint (vlc_object_t *p_obj, int i_fd, struct v4l2_queryctrl queryctrl, bool b_reset, bool b_demux)
static int ControlReset (vlc_object_t *p_obj, int i_fd)

Variables

static const int i_standards_list []
static const char *const psz_standards_list_text []
static const int i_iomethod_list []
static const char *const psz_iomethod_list_text []
static const int i_tuner_audio_modes_list []
static const char *const psz_tuner_audio_modes_list_text []
struct {
   unsigned int   i_v4l2
   int   i_fourcc
v4l2chroma_to_fourcc []
static const __u32 p_chroma_fallbacks []
 List of V4L2 chromas were confident enough to use as fallbacks if the user hasn't provided a --v4l2-chroma value.
struct {
   const char *   psz_name
   unsigned int   i_cid
controls []

Define Documentation

#define ADEV_LONGTEXT

Value:

N_( \
    "Name of the audio device to use. " \
    "If you don't specify anything, \"/dev/dsp\" will be used for OSS.")

#define ADEV_TEXT   N_("Audio device name")

#define ALSA_DEFAULT   "hw"

#define AUDIO_BALANCE_LONGTEXT

Value:

N_( \
    "Balance of the audio input (if supported by the v4l2 driver)." )

#define AUDIO_BALANCE_TEXT   N_( "Balance" )

#define AUDIO_BASS_LONGTEXT

Value:

N_( \
    "Bass level of the audio input (if supported by the v4l2 driver)." )

#define AUDIO_BASS_TEXT   N_( "Bass" )

#define AUDIO_INPUT_LONGTEXT

Value:

N_( \
    "Audio input of the card to use (see debug)." )

#define AUDIO_INPUT_TEXT   N_( "Audio input" )

#define AUDIO_LOUDNESS_LONGTEXT

Value:

N_( \
    "Loudness of the audio input (if supported by the v4l2 driver)." )

#define AUDIO_LOUDNESS_TEXT   N_( "Loudness" )

#define AUDIO_METHOD_ALSA   2

#define AUDIO_METHOD_LONGTEXT

Value:

N_( \
    "Audio method to use: 0 to disable audio, 1 for OSS." )

#define AUDIO_METHOD_OSS   1

#define AUDIO_METHOD_TEXT   N_( "Audio method" )

#define AUDIO_MUTE_LONGTEXT

Value:

N_( \
    "Mute audio input (if supported by the v4l2 driver)." )

#define AUDIO_MUTE_TEXT   N_( "Mute" )

#define AUDIO_TREBLE_LONGTEXT

Value:

N_( \
    "Treble level of the audio input (if supported by the v4l2 driver)." )

#define AUDIO_TREBLE_TEXT   N_( "Treble" )

#define AUDIO_VOLUME_LONGTEXT

Value:

N_( \
    "Volume of the audio input (if supported by the v4l2 driver)." )

#define AUDIO_VOLUME_TEXT   N_( "Volume" )

#define AUTOGAIN_LONGTEXT

Value:

N_( \
    "Automatically set the video input's gain (if supported by the " \
    "v4l2 driver)." )

#define AUTOGAIN_TEXT   N_( "Auto gain" )

#define AUTOWHITEBALANCE_LONGTEXT

Value:

N_( \
    "Automatically set the white balance of the video input " \
    "(if supported by the v4l2 driver)." )

#define AUTOWHITEBALANCE_TEXT   N_( "Auto white balance" )

#define BLACKLEVEL_LONGTEXT

Value:

N_( \
    "Black level of the video input (if supported by the v4l2 driver)." )

#define BLACKLEVEL_TEXT   N_( "Black level" )

#define BLUEBALANCE_LONGTEXT

Value:

N_( \
    "Blue balance of the video input (if supported by the v4l2 driver)." )

#define BLUEBALANCE_TEXT   N_( "Blue balance" )

#define BRIGHTNESS_LONGTEXT

Value:

N_( \
    "Brightness of the video input (if supported by the v4l2 driver)." )

#define BRIGHTNESS_TEXT   N_( "Brightness" )

#define CACHING_LONGTEXT

Value:

N_( \
    "Caching value for V4L2 captures. This " \
    "value should be set in milliseconds." )

#define CACHING_TEXT   N_("Caching value in ms")

#define CFG_PREFIX   "v4l2-"

#define CHROMA_LONGTEXT

Value:

N_( \
    "Force the Video4Linux2 video device to use a specific chroma format " \
    "(eg. I420 or I422 for raw images, MJPG for M-JPEG compressed input) " \
    "(Complete list: GREY, I240, RV16, RV15, RV24, RV32, YUY2, YUYV, UYVY, " \
    "I41N, I422, I420, I411, I410, MJPG)")

#define CHROMA_TEXT   N_("Video input chroma format")

#define CONTRAST_LONGTEXT

Value:

N_( \
    "Contrast of the video input (if supported by the v4l2 driver)." )

#define CONTRAST_TEXT   N_( "Contrast" )

#define CTRL_RESET_LONGTEXT

Value:

N_( \
    "Reset controls to defaults provided by the v4l2 driver." )

#define CTRL_RESET_TEXT   N_( "Reset v4l2 controls" )

#define DEV_LONGTEXT

Value:

N_( \
    "Name of the device to use. " \
    "If you don't specify anything, /dev/video0 will be used.")

#define DEV_TEXT   N_("Device name")

#define DOWHITEBALANCE_LONGTEXT

Value:

N_( \
    "Trigger a white balancing action, useless if auto white balance is " \
    "activated (if supported by the v4l2 driver)." )

#define DOWHITEBALANCE_TEXT   N_( "Do white balance" )

#define EXPOSURE_LONGTEXT

Value:

N_( \
    "Exposure of the video input (if supported by the v4L2 driver)." )

#define EXPOSURE_TEXT   N_( "Exposure" )

#define FIND_AUDIO   2

#define FIND_VIDEO   1

#define FPS_LONGTEXT

Value:

N_( "Framerate to capture, if applicable " \
    "(-1 for autodetect)." )

#define FPS_TEXT   N_( "Framerate" )

#define FREQUENCY_LONGTEXT

Value:

N_( \
    "Tuner frequency in Hz or kHz (see debug output)" )

#define FREQUENCY_TEXT   N_("Frequency")

#define GAIN_LONGTEXT

Value:

N_( \
    "Video input's gain (if supported by the v4l2 driver)." )

#define GAIN_TEXT   N_( "Gain" )

#define GAMMA_LONGTEXT

Value:

N_( \
    "Gamma of the video input (if supported by the v4l2 driver)." )

#define GAMMA_TEXT   N_( "Gamma" )

#define HCENTER_LONGTEXT

Value:

N_( \
    "Set the camera's horizontal centering (if supported by the v4l2 driver)." )

#define HCENTER_TEXT   N_( "Horizontal centering" )

#define HEIGHT_LONGTEXT

Value:

N_( \
    "Force height (-1 for autodetect)." )

#define HEIGHT_TEXT   N_( "Height" )

#define HFLIP_LONGTEXT

Value:

N_( \
    "Flip the video horizontally (if supported by the v4l2 driver)." )

#define HFLIP_TEXT   N_( "Horizontal flip" )

#define HUE_LONGTEXT

Value:

N_( \
    "Hue of the video input (if supported by the v4l2 driver)." )

#define HUE_TEXT   N_( "Hue" )

#define INPUT_LONGTEXT

Value:

N_( \
    "Input of the card to use (see debug)." )

#define INPUT_TEXT   N_( "Input" )

#define IOMETHOD_LONGTEXT

Value:

N_( \
    "IO Method (READ, MMAP, USERPTR)." )

#define IOMETHOD_TEXT   N_( "IO Method" )

#define OSS_DEFAULT   "/dev/dsp"

#define REDBALANCE_LONGTEXT

Value:

N_( \
    "Red balance of the video input (if supported by the v4l2 driver)." )

#define REDBALANCE_TEXT   N_( "Red balance" )

#define S_CTRLS_LONGTEXT

Value:

N_( \
    "Set the v4l2 driver controls to the values specified using a comma " \
    "separated list optionally encapsulated by curly braces " \
    "(e.g.: {video_bitrate=6000000,audio_crc=0,stream_type=3} ). " \
    "To list available controls, increase verbosity (-vvv) " \
    "or use the v4l2-ctl application." )

#define S_CTRLS_TEXT   N_("v4l2 driver controls")

#define SAMPLERATE_LONGTEXT

Value:

N_( \
    "Samplerate of the captured audio stream, in Hz (eg: 11025, 22050, 44100, 48000)" )

#define SAMPLERATE_TEXT   N_( "Samplerate" )

#define SATURATION_LONGTEXT

Value:

N_( \
    "Saturation of the video input (if supported by the v4l2 driver)." )

#define SATURATION_TEXT   N_( "Saturation" )

#define STANDARD_LONGTEXT

Value:

N_( \
    "Video standard (Default, SECAM, PAL, or NTSC)." )

#define STANDARD_TEXT   N_( "Standard" )

#define STEREO_LONGTEXT

Value:

N_( \
    "Capture the audio stream in stereo." )

#define STEREO_TEXT   N_( "Stereo" )

#define TUNER_AUDIO_MODE_LONGTEXT

Value:

N_( \
    "Tuner audio mono/stereo and track selection." )

#define TUNER_AUDIO_MODE_TEXT   N_("Audio mode")

#define TUNER_LONGTEXT

Value:

N_( \
    "Tuner id (see debug output)." )

#define TUNER_TEXT   N_("Tuner id")

#define VCENTER_LONGTEXT

Value:

N_( \
    "Set the camera's vertical centering (if supported by the v4l2 driver)." )

#define VCENTER_TEXT   N_( "Vertical centering" )

#define VFLIP_LONGTEXT

Value:

N_( \
    "Flip the video vertically (if supported by the v4l2 driver)." )

#define VFLIP_TEXT   N_( "Vertical flip" )

#define WIDTH_LONGTEXT

Value:

N_( \
    "Force width (-1 for autodetect)." )

#define WIDTH_TEXT   N_( "Width" )


Enumeration Type Documentation

enum io_method

Enumerator:
IO_METHOD_READ 
IO_METHOD_MMAP 
IO_METHOD_USERPTR 


Function Documentation

static void AccessClose ( vlc_object_t  )  [static]

static int AccessControl ( access_t ,
int  ,
va_list   
) [static]

static int AccessControlCallback ( vlc_object_t p_this,
const char *  psz_var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  p_data 
) [static]

static int AccessControlResetCallback ( vlc_object_t p_this,
const char *  psz_var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  p_data 
) [static]

static int AccessOpen ( vlc_object_t  )  [static]

static ssize_t AccessRead ( access_t ,
uint8_t *  ,
size_t   
) [static]

static void CommonClose ( vlc_object_t ,
demux_sys_t  
) [static]

static int Control ( vlc_object_t ,
int  i_fd,
const char *  psz_name,
int  i_cid,
int  i_value 
) [static]

static int ControlList ( vlc_object_t ,
int  ,
bool  ,
bool   
) [static]

static void ControlListPrint ( vlc_object_t p_obj,
int  i_fd,
struct v4l2_queryctrl  queryctrl,
bool  b_reset,
bool  b_demux 
) [static]

static int ControlReset ( vlc_object_t p_obj,
int  i_fd 
) [static]

static int Demux ( demux_t  )  [static]

static void DemuxClose ( vlc_object_t  )  [static]

static int DemuxControl ( demux_t ,
int  ,
va_list   
) [static]

static int DemuxControlCallback ( vlc_object_t p_this,
const char *  psz_var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  p_data 
) [static]

static int DemuxControlResetCallback ( vlc_object_t p_this,
const char *  psz_var,
vlc_value_t  oldval,
vlc_value_t  newval,
void *  p_data 
) [static]

static int DemuxOpen ( vlc_object_t  )  [static]

static int FindMainDevice ( vlc_object_t p_this,
demux_sys_t p_sys,
int  i_flags,
bool  b_demux,
bool  b_forced 
) [static]

static void GetV4L2Params ( demux_sys_t ,
vlc_object_t  
) [static]

static block_t * GrabAudio ( demux_t p_demux  )  [static]

static block_t * GrabVideo ( demux_t p_demux  )  [static]

static int InitMmap ( demux_t p_demux,
int  i_fd 
) [static]

static int InitRead ( demux_t p_demux,
int  i_fd,
unsigned int  i_buffer_size 
) [static]

static int InitUserP ( demux_t p_demux,
int  i_fd,
unsigned int  i_buffer_size 
) [static]

static bool IsPixelFormatSupported ( demux_t p_demux,
unsigned int  i_pixelformat 
) [static]

static void name2var ( unsigned char *  name  )  [static]

static int OpenAudioDev ( vlc_object_t ,
demux_sys_t ,
bool   
) [static]

static int OpenAudioDevOss ( vlc_object_t p_this,
demux_sys_t p_sys,
bool  b_demux 
) [static]

static int OpenVideoDev ( vlc_object_t ,
demux_sys_t ,
bool   
) [static]

static void ParseMRL ( demux_sys_t ,
char *  ,
vlc_object_t  
) [static]

static bool ProbeAudioDev ( vlc_object_t ,
demux_sys_t ,
char *  psz_device 
) [static]

static bool ProbeAudioDevOss ( vlc_object_t p_this,
demux_sys_t p_sys,
char *  psz_device 
) [static]

static bool ProbeVideoDev ( vlc_object_t ,