RetroArch
Classes | Macros | Functions | Variables
video_processor_v4l2.c File Reference
#include <libretro.h>
#include <clamping.h>
#include <sys/mman.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <linux/videodev2.h>
#include <libv4l2.h>
#include <string/stdstring.h>
Include dependency graph for video_processor_v4l2.c:

Classes

struct  v4l2_capbuf
 

Macros

#define LIBRARY_NAME   "V4L2"
 
#define LIBRARY_VERSION   "0.0.2"
 
#define VIDEO_BUFFERS_MAX   2
 
#define AUDIO_SAMPLE_RATE   48000
 
#define AUDIO_BUFSIZE   64
 
#define ENVVAR_BUFLEN   1024
 
#define VIDEOPROC_CORE_PREFIX(s)   s
 

Functions

static retro_environment_t VIDEOPROC_CORE_PREFIX (environment_cb)
 
static retro_video_refresh_t VIDEOPROC_CORE_PREFIX (video_refresh_cb)
 
static retro_audio_sample_t VIDEOPROC_CORE_PREFIX (audio_sample_cb)
 
static retro_audio_sample_batch_t VIDEOPROC_CORE_PREFIX (audio_sample_batch_cb)
 
static retro_input_poll_t VIDEOPROC_CORE_PREFIX (input_poll_cb)
 
static retro_input_state_t VIDEOPROC_CORE_PREFIX (input_state_cb)
 
static void appendstr (char *dst, const char *src, size_t dstsize)
 
static void enumerate_video_devices (char *buf, size_t buflen)
 
static void enumerate_audio_devices (char *buf, size_t buflen)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_environment (retro_environment_t cb)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_video_refresh (retro_video_refresh_t cb)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_audio_sample (retro_audio_sample_t cb)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_audio_sample_batch (retro_audio_sample_batch_t cb)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_input_poll (retro_input_poll_t cb)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_input_state (retro_input_state_t cb)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_init (void)
 
static bool open_devices (void)
 
static void close_devices (void)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_deinit (void)
 
RETRO_API unsigned VIDEOPROC_CORE_PREFIX() retro_api_version (void)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_get_system_info (struct retro_system_info *info)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_get_system_av_info (struct retro_system_av_info *info)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_controller_port_device (unsigned port, unsigned device)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_reset (void)
 
void v4l2_frame_times (struct v4l2_buffer buf)
 
void source_dummy (int width, int height)
 
void source_v4l2_normal (int width, int height)
 
void source_v4l2_alternate_hack (int width, int height)
 
void processing_heal (uint8_t *src, int width, int height)
 
void processing_deinterlacing_crap (uint32_t *src, uint32_t *dst, int width, int height, enum v4l2_field field, int skip_lines_src)
 
void processing_bgr_xrgb (uint8_t *src, uint32_t *dst, int width, int height)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_run (void)
 
RETRO_API size_t VIDEOPROC_CORE_PREFIX() retro_serialize_size (void)
 
RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_serialize (void *data, size_t size)
 
RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_unserialize (const void *data, size_t size)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_cheat_reset (void)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_cheat_set (unsigned index, bool enabled, const char *code)
 
static void videoinput_set_control_v4l2 (uint32_t id, double val)
 
RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_load_game (const struct retro_game_info *game)
 
RETRO_API void VIDEOPROC_CORE_PREFIX() retro_unload_game (void)
 
RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_load_game_special (unsigned game_type, const struct retro_game_info *info, size_t num_info)
 
RETRO_API unsigned VIDEOPROC_CORE_PREFIX() retro_get_region (void)
 
RETRO_API void *VIDEOPROC_CORE_PREFIX() retro_get_memory_data (unsigned id)
 
RETRO_API size_t VIDEOPROC_CORE_PREFIX() retro_get_memory_size (unsigned id)
 

Variables

static int video_device_fd = -1
 
static char video_device [ENVVAR_BUFLEN]
 
static char audio_device [ENVVAR_BUFLEN]
 
static struct v4l2_format video_format
 
static struct v4l2_standard video_standard
 
static struct v4l2_buffer video_buf
 
static uint8_t v4l2_ncapbuf_target
 
static size_t v4l2_ncapbuf
 
static struct v4l2_capbuf v4l2_capbuf [VIDEO_BUFFERS_MAX]
 
static float dummy_pos =0
 
static int video_half_feed_rate =0
 
static uint32_t video_cap_width
 
static uint32_t video_cap_height
 
static uint32_t video_out_height
 
static char video_capture_mode [ENVVAR_BUFLEN]
 
static char video_output_mode [ENVVAR_BUFLEN]
 
static char video_frame_times [ENVVAR_BUFLEN]
 
static uint8_tframe_cap
 
static uint32_tframe_out
 
static uint32_tframes [4]
 
static uint32_tframe_prev1
 
static uint32_tframe_prev2
 
static uint32_tframe_prev3
 
static uint32_tframe_curr
 
struct timeval ft_prevtime = { 0 }
 
struct timeval ft_prevtime2 = { 0 }
 
char * ft_info = NULL
 
char * ft_info2 = NULL
 
double ft_favg
 
double ft_ftime
 
int ft_fcount
 

Macro Definition Documentation

◆ AUDIO_BUFSIZE

#define AUDIO_BUFSIZE   64

◆ AUDIO_SAMPLE_RATE

#define AUDIO_SAMPLE_RATE   48000

◆ ENVVAR_BUFLEN

#define ENVVAR_BUFLEN   1024

◆ LIBRARY_NAME

#define LIBRARY_NAME   "V4L2"

◆ LIBRARY_VERSION

#define LIBRARY_VERSION   "0.0.2"

◆ VIDEO_BUFFERS_MAX

#define VIDEO_BUFFERS_MAX   2

◆ VIDEOPROC_CORE_PREFIX

#define VIDEOPROC_CORE_PREFIX (   s)    s

Function Documentation

◆ appendstr()

static void appendstr ( char *  dst,
const char *  src,
size_t  dstsize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ close_devices()

static void close_devices ( void  )
static
Here is the caller graph for this function:

◆ enumerate_audio_devices()

static void enumerate_audio_devices ( char *  buf,
size_t  buflen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enumerate_video_devices()

static void enumerate_video_devices ( char *  buf,
size_t  buflen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_devices()

static bool open_devices ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processing_bgr_xrgb()

void processing_bgr_xrgb ( uint8_t src,
uint32_t dst,
int  width,
int  height 
)
Here is the caller graph for this function:

◆ processing_deinterlacing_crap()

void processing_deinterlacing_crap ( uint32_t src,
uint32_t dst,
int  width,
int  height,
enum v4l2_field  field,
int  skip_lines_src 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processing_heal()

void processing_heal ( uint8_t src,
int  width,
int  height 
)
Here is the caller graph for this function:

◆ retro_api_version()

RETRO_API unsigned VIDEOPROC_CORE_PREFIX() retro_api_version ( void  )

◆ retro_cheat_reset()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_cheat_reset ( void  )

◆ retro_cheat_set()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_cheat_set ( unsigned  index,
bool  enabled,
const char *  code 
)
Here is the call graph for this function:

◆ retro_deinit()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_deinit ( void  )
Here is the call graph for this function:

◆ retro_get_memory_data()

RETRO_API void* VIDEOPROC_CORE_PREFIX() retro_get_memory_data ( unsigned  id)
Here is the call graph for this function:

◆ retro_get_memory_size()

RETRO_API size_t VIDEOPROC_CORE_PREFIX() retro_get_memory_size ( unsigned  id)
Here is the call graph for this function:

◆ retro_get_region()

RETRO_API unsigned VIDEOPROC_CORE_PREFIX() retro_get_region ( void  )

◆ retro_get_system_av_info()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_get_system_av_info ( struct retro_system_av_info info)
Here is the call graph for this function:

◆ retro_get_system_info()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_get_system_info ( struct retro_system_info info)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retro_init()

◆ retro_load_game()

RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_load_game ( const struct retro_game_info game)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retro_load_game_special()

RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_load_game_special ( unsigned  game_type,
const struct retro_game_info info,
size_t  num_info 
)
Here is the call graph for this function:

◆ retro_reset()

Here is the call graph for this function:

◆ retro_run()

Here is the call graph for this function:

◆ retro_serialize()

RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_serialize ( void data,
size_t  size 
)
Here is the call graph for this function:

◆ retro_serialize_size()

RETRO_API size_t VIDEOPROC_CORE_PREFIX() retro_serialize_size ( void  )

◆ retro_set_audio_sample()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_audio_sample ( retro_audio_sample_t  cb)

◆ retro_set_audio_sample_batch()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_audio_sample_batch ( retro_audio_sample_batch_t  cb)

◆ retro_set_controller_port_device()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_controller_port_device ( unsigned  port,
unsigned  device 
)
Here is the call graph for this function:

◆ retro_set_environment()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_environment ( retro_environment_t  cb)
Here is the call graph for this function:

◆ retro_set_input_poll()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_input_poll ( retro_input_poll_t  cb)

◆ retro_set_input_state()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_input_state ( retro_input_state_t  cb)

◆ retro_set_video_refresh()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_set_video_refresh ( retro_video_refresh_t  cb)

◆ retro_unload_game()

RETRO_API void VIDEOPROC_CORE_PREFIX() retro_unload_game ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retro_unserialize()

RETRO_API bool VIDEOPROC_CORE_PREFIX() retro_unserialize ( const void data,
size_t  size 
)
Here is the call graph for this function:

◆ source_dummy()

void source_dummy ( int  width,
int  height 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ source_v4l2_alternate_hack()

void source_v4l2_alternate_hack ( int  width,
int  height 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ source_v4l2_normal()

void source_v4l2_normal ( int  width,
int  height 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ v4l2_frame_times()

void v4l2_frame_times ( struct v4l2_buffer  buf)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ videoinput_set_control_v4l2()

static void videoinput_set_control_v4l2 ( uint32_t  id,
double  val 
)
static

◆ VIDEOPROC_CORE_PREFIX() [1/6]

static retro_environment_t VIDEOPROC_CORE_PREFIX ( environment_cb  )
static

◆ VIDEOPROC_CORE_PREFIX() [2/6]

static retro_video_refresh_t VIDEOPROC_CORE_PREFIX ( video_refresh_cb  )
static

◆ VIDEOPROC_CORE_PREFIX() [3/6]

static retro_audio_sample_t VIDEOPROC_CORE_PREFIX ( audio_sample_cb  )
static

◆ VIDEOPROC_CORE_PREFIX() [4/6]

static retro_audio_sample_batch_t VIDEOPROC_CORE_PREFIX ( audio_sample_batch_cb  )
static

◆ VIDEOPROC_CORE_PREFIX() [5/6]

static retro_input_poll_t VIDEOPROC_CORE_PREFIX ( input_poll_cb  )
static

◆ VIDEOPROC_CORE_PREFIX() [6/6]

static retro_input_state_t VIDEOPROC_CORE_PREFIX ( input_state_cb  )
static

Variable Documentation

◆ audio_device

char audio_device[ENVVAR_BUFLEN]
static

◆ dummy_pos

float dummy_pos =0
static

◆ frame_cap

uint8_t* frame_cap
static

◆ frame_curr

uint32_t* frame_curr
static

◆ frame_out

uint32_t* frame_out
static

◆ frame_prev1

uint32_t* frame_prev1
static

◆ frame_prev2

uint32_t* frame_prev2
static

◆ frame_prev3

uint32_t* frame_prev3
static

◆ frames

uint32_t* frames[4]
static

◆ ft_favg

double ft_favg

◆ ft_fcount

int ft_fcount

◆ ft_ftime

double ft_ftime

◆ ft_info

char* ft_info = NULL

◆ ft_info2

char * ft_info2 = NULL

◆ ft_prevtime

struct timeval ft_prevtime = { 0 }

◆ ft_prevtime2

struct timeval ft_prevtime2 = { 0 }

◆ v4l2_capbuf

◆ v4l2_ncapbuf

size_t v4l2_ncapbuf
static

◆ v4l2_ncapbuf_target

uint8_t v4l2_ncapbuf_target
static

◆ video_buf

struct v4l2_buffer video_buf
static

◆ video_cap_height

uint32_t video_cap_height
static

◆ video_cap_width

uint32_t video_cap_width
static

◆ video_capture_mode

char video_capture_mode[ENVVAR_BUFLEN]
static

◆ video_device

char video_device[ENVVAR_BUFLEN]
static

◆ video_device_fd

int video_device_fd = -1
static

◆ video_format

struct v4l2_format video_format
static

◆ video_frame_times

char video_frame_times[ENVVAR_BUFLEN]
static

◆ video_half_feed_rate

int video_half_feed_rate =0
static

◆ video_out_height

uint32_t video_out_height
static

◆ video_output_mode

char video_output_mode[ENVVAR_BUFLEN]
static

◆ video_standard

struct v4l2_standard video_standard
static