Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
video_thread.c File Reference
#include "modules/computer_vision/video_thread.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include "lib/v4l/v4l2.h"
#include "lib/vision/image.h"
#include "lib/vision/bayer.h"
#include "mcu_periph/sys_time.h"
#include <BOARD_CONFIG>
#include <pthread.h>
#include "rt_priority.h"
+ Include dependency graph for video_thread.c:

Go to the source code of this file.

Macros

#define VIDEO_THREAD_NICE_LEVEL   5
 
#define VIDEO_THREAD_MAX_CAMERAS   4
 
#define IMG_FLT_SIZE   272
 

Functions

static void * video_thread_function (void *data)
 Handles all the video streaming and saving of the image shots This is a separate thread, so it needs to be thread safe! More...
 
static bool initialize_camera (struct video_config_t *camera)
 
static void start_video_thread (struct video_config_t *camera)
 
static void stop_video_thread (struct video_config_t *device)
 
void video_thread_periodic (void)
 A dummy for now. More...
 
bool add_video_device (struct video_config_t *device)
 
void video_thread_init (void)
 Initialize the view video. More...
 
void video_thread_start ()
 Starts the streaming of a all cameras. More...
 
void video_thread_stop ()
 Stops the streaming of all cameras This could take some time, because the thread is stopped asynchronous. More...
 

Variables

static struct video_config_tcameras [VIDEO_THREAD_MAX_CAMERAS] = {NULL}
 

Macro Definition Documentation

#define IMG_FLT_SIZE   272

Referenced by video_thread_function().

#define VIDEO_THREAD_MAX_CAMERAS   4

Definition at line 63 of file video_thread.c.

Referenced by add_video_device(), video_thread_start(), and video_thread_stop().

#define VIDEO_THREAD_NICE_LEVEL   5

Definition at line 57 of file video_thread.c.

Referenced by video_thread_function().

Function Documentation

bool add_video_device ( struct video_config_t device)

Definition at line 189 of file video_thread.c.

References cameras, video_config_t::dev_name, initialize_camera(), and VIDEO_THREAD_MAX_CAMERAS.

+ Here is the call graph for this function:

static bool initialize_camera ( struct video_config_t camera)
static
static void start_video_thread ( struct video_config_t camera)
static

Definition at line 225 of file video_thread.c.

References video_config_t::dev_name, video_thread_t::is_running, video_config_t::thread, and video_thread_function().

Referenced by video_thread_start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void stop_video_thread ( struct video_config_t device)
static

Definition at line 243 of file video_thread.c.

References video_thread_t::dev, video_thread_t::is_running, v4l2_device::name, video_config_t::thread, and v4l2_stop_capture().

Referenced by video_thread_stop().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void * video_thread_function ( void *  data)
static

Handles all the video streaming and saving of the image shots This is a separate thread, so it needs to be thread safe!

Definition at line 84 of file video_thread.c.

References BayerToYUV(), configure_isp(), cv_run_device(), video_thread_t::dev, video_config_t::dev_name, video_config_t::filters, video_config_t::fps, get_sys_time_usec(), image_create(), image_free(), IMAGE_YUV422, IMG_FLT_SIZE, video_thread_t::is_running, set_nice_level(), sys_time_usleep(), video_config_t::thread, v4l2_image_free(), v4l2_image_get(), v4l2_start_capture(), VIDEO_FILTER_DEBAYER, VIDEO_FILTER_ISP, and VIDEO_THREAD_NICE_LEVEL.

Referenced by start_video_thread().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void video_thread_init ( void  )

Initialize the view video.

Definition at line 261 of file video_thread.c.

void video_thread_periodic ( void  )

A dummy for now.

Definition at line 75 of file video_thread.c.

void video_thread_start ( void  )

Starts the streaming of a all cameras.

Definition at line 268 of file video_thread.c.

void video_thread_stop ( void  )

Stops the streaming of all cameras This could take some time, because the thread is stopped asynchronous.

Definition at line 282 of file video_thread.c.

Variable Documentation

struct video_config_t* cameras[VIDEO_THREAD_MAX_CAMERAS] = {NULL}
static

Definition at line 67 of file video_thread.c.

Referenced by add_video_device(), video_thread_start(), and video_thread_stop().