Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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
#define VIEWVIDEO_AUTO_HOST   0
#define VIEWVIDEO_SOCKET_HOST   STRINGIFY(VIEWVIDEO_HOST)
#define VIEWVIDEO_SOCKET_BROADCAST   VIEWVIDEO_BROADCAST

Functions

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)
 Handles all the video streaming and saving of the image shots This is a separate thread, so it needs to be thread safe!
void viewvideo_init (void)
 Initialize the view video.

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_AUTO_HOST

#define VIEWVIDEO_AUTO_HOST   0

Definition at line 100 of file viewvideo.c.

◆ 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.

Referenced by viewvideo_function(), and viewvideo_init().

◆ VIEWVIDEO_NICE_LEVEL

#define VIEWVIDEO_NICE_LEVEL   5

Definition at line 71 of file viewvideo.c.

Referenced by viewvideo_init().

◆ VIEWVIDEO_QUALITY_FACTOR

#define VIEWVIDEO_QUALITY_FACTOR   50

Definition at line 59 of file viewvideo.c.

Referenced by viewvideo_function().

◆ VIEWVIDEO_SOCKET_BROADCAST

#define VIEWVIDEO_SOCKET_BROADCAST   VIEWVIDEO_BROADCAST

Definition at line 111 of file viewvideo.c.

Referenced by viewvideo_init().

◆ VIEWVIDEO_SOCKET_HOST

#define VIEWVIDEO_SOCKET_HOST   STRINGIFY(VIEWVIDEO_HOST)

Definition at line 110 of file viewvideo.c.

Referenced by viewvideo_init().

◆ VIEWVIDEO_USE_NETCAT

#define VIEWVIDEO_USE_NETCAT   FALSE

Definition at line 77 of file viewvideo.c.

Referenced by viewvideo_function().

◆ VIEWVIDEO_USE_RTP

#define VIEWVIDEO_USE_RTP   TRUE

Definition at line 81 of file viewvideo.c.

Function Documentation

◆ viewvideo_function()

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 130 of file viewvideo.c.

References UdpSocket::addr_out, image_t::buf, image_t::buf_size, image_t::h, image_create(), image_free(), IMAGE_JPEG, IMAGE_YUV422, image_yuv422_downsample(), jpeg_encode_image(), rtp_frame_send(), udp_arch_auto_gcs(), 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 251 of file viewvideo.c.

References cv_add_to_device_async(), udp_socket_create(), video_sock1, video_sock2, viewvideo, VIEWVIDEO_FPS, VIEWVIDEO_NICE_LEVEL, VIEWVIDEO_SOCKET_BROADCAST, and VIEWVIDEO_SOCKET_HOST.

Here is the call graph for this function:

Variable Documentation

◆ video_sock1

struct UdpSocket video_sock1

Definition at line 88 of file viewvideo.c.

Referenced by viewvideo_init().

◆ video_sock2

struct UdpSocket video_sock2

Definition at line 89 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 117 of file viewvideo.c.

Referenced by viewvideo_function(), and viewvideo_init().