50 #ifndef VIEWVIDEO_DOWNSIZE_FACTOR
51 #define VIEWVIDEO_DOWNSIZE_FACTOR 4
56 #ifndef VIEWVIDEO_QUALITY_FACTOR
57 #define VIEWVIDEO_QUALITY_FACTOR 50
62 #ifndef VIEWVIDEO_RTP_TIME_INC
63 #define VIEWVIDEO_RTP_TIME_INC 0
68 #ifndef VIEWVIDEO_SHOT_PATH
69 #ifdef VIDEO_THREAD_SHOT_PATH
70 #define VIEWVIDEO_SHOT_PATH VIDEO_THREAD_SHOT_PATH
72 #define VIEWVIDEO_SHOT_PATH /data/video/images
78 #ifndef VIEWVIDEO_USE_NETCAT
79 #define VIEWVIDEO_USE_NETCAT FALSE
82 #if !VIEWVIDEO_USE_NETCAT && !(defined VIEWVIDEO_USE_RTP)
83 #define VIEWVIDEO_USE_RTP TRUE
86 #if VIEWVIDEO_USE_NETCAT
96 PRINT_CONFIG_VAR(VIEWVIDEO_HOST)
97 PRINT_CONFIG_VAR(VIEWVIDEO_PORT_OUT)
104 #if !VIEWVIDEO_USE_NETCAT
127 #if VIEWVIDEO_USE_NETCAT
129 sprintf(nc_cmd,
"nc %s %d 2>/dev/null", STRINGIFY(VIEWVIDEO_HOST), VIEWVIDEO_PORT_OUT);
142 #if VIEWVIDEO_USE_NETCAT
147 printf(
"[viewvideo] Could not create netcat fork.\n");
148 }
else if (pid == 0) {
150 FILE *netcat = popen(nc_cmd,
"w");
151 if (netcat != NULL) {
155 printf(
"[viewvideo] Failed to open netcat process.\n");
206 #if VIEWVIDEO_USE_NETCAT
209 FILE *fp = fopen(save_name,
"w");
211 fprintf(fp,
"i=0\n");
212 fprintf(fp,
"while true\n");
214 fprintf(fp,
"\tn=$(printf \"%%04d\" $i)\n");
215 fprintf(fp,
"\tnc -l 0.0.0.0 %d > img_${n}.jpg\n", (
int)(VIEWVIDEO_PORT_OUT));
216 fprintf(fp,
"\ti=$((i+1))\n");
217 fprintf(fp,
"done\n");
220 printf(
"[viewvideo] Failed to create netcat receiver file.\n");
228 FILE *fp = fopen(save_name,
"w");
230 fprintf(fp,
"v=0\n");
231 fprintf(fp,
"m=video %d RTP/AVP 26\n", (
int)(VIEWVIDEO_PORT_OUT));
232 fprintf(fp,
"c=IN IP4 0.0.0.0\n");
235 printf(
"[viewvideo] Failed to create SDP file.\n");
uint32_t buf_size
The buffer size.
struct viewvideo_t viewvideo
void image_yuv422_downsample(struct image_t *input, struct image_t *output, uint16_t downsample)
Simplified high-speed low CPU downsample function without averaging downsample factor must be 1...
#define VIEWVIDEO_RTP_TIME_INC
#define VIEWVIDEO_QUALITY_FACTOR
#define VIEWVIDEO_DOWNSIZE_FACTOR
void image_free(struct image_t *img)
Free the image.
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
Easily create and use UDP sockets.
#define VIEWVIDEO_SHOT_PATH
volatile bool_t is_streaming
When the device is streaming.
#define VIEWVIDEO_USE_NETCAT
void rtp_frame_send(struct UdpSocket *udp, struct image_t *img, uint8_t format_code, uint8_t quality_code, uint8_t has_dri_header, uint32_t delta_t)
Send an RTP frame.
void jpeg_encode_image(struct image_t *in, struct image_t *out, uint32_t quality_factor, bool_t add_dri_header)
Encode an YUV422 image.
Image helper functions like resizing, color filter, converters...
Computer vision framework for onboard processing.
struct UdpSocket video_sock
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
void * buf
Image buffer (depending on the image_type)
#define VIEWVIDEO_USE_RTP
bool_t viewvideo_function(struct image_t *img)
Handles all the video streaming and saving of the image shots This is a sepereate thread...
void cv_add(cvFunction func)
Encode images with the use of the JPEG encoding.
void viewvideo_init(void)
Initialize the view video.
Get live images from a RTP/UDP stream and save pictures on internal memory.
int udp_socket_create(struct UdpSocket *sock, char *host, int port_out, int port_in, bool_t broadcast)
Create UDP socket and bind it.
UYVY format (uint16 per pixel)
uint8_t downsize_factor
Downsize factor during the stream.
Encodes a vide stream with RTP (JPEG)
bool_t use_rtp
Stream over RTP.
An JPEG encoded image (not per pixel encoded)