Paparazzi UAS  v5.15_devel-112-g521f3cf
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 VIDEO_THREAD_VERBOSE   0
 
#define printf_debug   if(VIDEO_THREAD_VERBOSE > 0) printf
 
#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 printf_debug   if(VIDEO_THREAD_VERBOSE > 0) printf

Definition at line 71 of file video_thread.c.

Referenced by add_video_device().

#define VIDEO_THREAD_MAX_CAMERAS   4
#define VIDEO_THREAD_NICE_LEVEL   5

Definition at line 57 of file video_thread.c.

Referenced by video_thread_function().

#define VIDEO_THREAD_VERBOSE   0

Definition at line 68 of file video_thread.c.

Function Documentation

bool add_video_device ( struct video_config_t device)

Definition at line 197 of file video_thread.c.

References video_config_t::dev_name, initialize_camera(), printf_debug, 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 233 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 251 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 90 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 269 of file video_thread.c.

void video_thread_periodic ( void  )

A dummy for now.

Definition at line 81 of file video_thread.c.

void video_thread_start ( void  )

Starts the streaming of a all cameras.

Definition at line 280 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 294 of file video_thread.c.

Variable Documentation

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

Definition at line 73 of file video_thread.c.