Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
viewvideo.c File Reference

Get live images from a RTP/UDP stream and save pictures on internal memory. More...

#include "modules/computer_vision/viewvideo.h"
#include "modules/computer_vision/cv.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <math.h>
#include "lib/vision/image.h"
#include "lib/encoding/jpeg.h"
#include "lib/encoding/rtp.h"
#include "udp_socket.h"
#include <BOARD_CONFIG>
+ Include dependency graph for viewvideo.c:

Go to the source code of this file.

Macros

#define VIEWVIDEO_DOWNSIZE_FACTOR   4
 
#define VIEWVIDEO_QUALITY_FACTOR   50
 
#define VIEWVIDEO_FPS   5
 
#define VIEWVIDEO_NICE_LEVEL   5
 
#define VIEWVIDEO_USE_NETCAT   FALSE
 
#define VIEWVIDEO_USE_RTP   TRUE
 

Functions

static struct image_tviewvideo_function (struct UdpSocket *viewvideo_socket, struct image_t *img, uint16_t *rtp_packet_nr, uint32_t *rtp_frame_time, struct image_t *img_small, struct image_t *img_jpeg)
 Handles all the video streaming and saving of the image shots This is a separate thread, so it needs to be thread safe! More...
 
void viewvideo_init (void)
 Initialize the view video. More...
 

Variables

struct UdpSocket video_sock1
 
struct UdpSocket video_sock2
 
struct viewvideo_t viewvideo
 

Detailed Description

Get live images from a RTP/UDP stream and save pictures on internal memory.

Works on Linux platforms

Definition in file viewvideo.c.

Macro Definition Documentation

◆ VIEWVIDEO_DOWNSIZE_FACTOR

#define VIEWVIDEO_DOWNSIZE_FACTOR   4

Definition at line 53 of file viewvideo.c.

◆ VIEWVIDEO_FPS

#define VIEWVIDEO_FPS   5

Definition at line 65 of file viewvideo.c.

◆ VIEWVIDEO_NICE_LEVEL

#define VIEWVIDEO_NICE_LEVEL   5

Definition at line 71 of file viewvideo.c.

◆ VIEWVIDEO_QUALITY_FACTOR

#define VIEWVIDEO_QUALITY_FACTOR   50

Definition at line 59 of file viewvideo.c.

◆ VIEWVIDEO_USE_NETCAT

#define VIEWVIDEO_USE_NETCAT   FALSE

Definition at line 77 of file viewvideo.c.

◆ VIEWVIDEO_USE_RTP

#define VIEWVIDEO_USE_RTP   TRUE

Definition at line 81 of file viewvideo.c.

Function Documentation

◆ viewvideo_function()

static struct image_t* viewvideo_function ( struct UdpSocket viewvideo_socket,
struct image_t img,
uint16_t rtp_packet_nr,
uint32_t rtp_frame_time,
struct image_t img_small,
struct image_t img_jpeg 
)
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 113 of file viewvideo.c.

References image_t::buf, image_t::buf_size, viewvideo_t::downsize_factor, image_t::h, image_create(), image_free(), IMAGE_JPEG, IMAGE_YUV422, image_yuv422_downsample(), viewvideo_t::is_streaming, jpeg_encode_image(), rtp_frame_send(), viewvideo_t::use_rtp, viewvideo, VIEWVIDEO_FPS, VIEWVIDEO_QUALITY_FACTOR, VIEWVIDEO_USE_NETCAT, and image_t::w.

+ Here is the call graph for this function:

◆ viewvideo_init()

void viewvideo_init ( void  )

Initialize the view video.

Definition at line 218 of file viewvideo.c.

References cv_add_to_device_async(), viewvideo_t::downsize_factor, viewvideo_t::is_streaming, viewvideo_t::quality_factor, udp_socket_create(), video_sock1, video_sock2, viewvideo, VIEWVIDEO_FPS, and VIEWVIDEO_NICE_LEVEL.

+ Here is the call graph for this function:

Variable Documentation

◆ video_sock1

struct UdpSocket video_sock1

Definition at line 1 of file viewvideo.c.

Referenced by viewvideo_init().

◆ video_sock2

struct UdpSocket video_sock2

Definition at line 1 of file viewvideo.c.

Referenced by viewvideo_init().

◆ viewvideo

struct viewvideo_t viewvideo
Initial value:
= {
.is_streaming = FALSE,
.downsize_factor = VIEWVIDEO_DOWNSIZE_FACTOR,
.quality_factor = VIEWVIDEO_QUALITY_FACTOR,
.use_rtp = VIEWVIDEO_USE_RTP,
}
#define FALSE
Definition: std.h:5
#define VIEWVIDEO_USE_RTP
Definition: viewvideo.c:81
#define VIEWVIDEO_DOWNSIZE_FACTOR
Definition: viewvideo.c:53
#define VIEWVIDEO_QUALITY_FACTOR
Definition: viewvideo.c:59

Definition at line 1 of file viewvideo.c.

Referenced by viewvideo_function(), and viewvideo_init().