Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
rtp.c File Reference
#include <stdint.h>
#include <string.h>
#include <sys/time.h>
#include "rtp.h"
+ Include dependency graph for rtp.c:

Go to the source code of this file.

Macros

#define KJpegCh1ScanDataLen   32
 
#define KJpegCh2ScanDataLen   56
 
#define MAX_PACKET_SIZE   1400
 
#define KRtpHeaderSize   12
 
#define KJpegHeaderSize   8
 

Functions

static void rtp_packet_send (struct UdpSocket *udp, uint8_t *Jpeg, int JpegLen, uint16_t m_SequenceNumber, uint32_t m_Timestamp, uint32_t m_offset, uint8_t marker_bit, int w, int h, uint8_t format_code, uint8_t quality_code, uint8_t has_dri_header)
 
void rtp_frame_test (struct UdpSocket *udp)
 Send a test RTP frame. More...
 
void rtp_frame_send (struct UdpSocket *udp, struct image_t *img, uint8_t format_code, uint8_t quality_code, uint8_t has_dri_header, float average_frame_rate, uint16_t *packet_number, uint32_t *rtp_time_counter)
 Send an RTP frame. More...
 

Variables

uint8_t JpegScanDataCh2A [KJpegCh2ScanDataLen]
 
uint8_t JpegScanDataCh2B [KJpegCh2ScanDataLen]
 

Detailed Description

Encodes a vide stream with RTP (JPEG)

Definition in file rtp.c.

Macro Definition Documentation

◆ KJpegCh1ScanDataLen

#define KJpegCh1ScanDataLen   32

Definition at line 68 of file rtp.c.

◆ KJpegCh2ScanDataLen

#define KJpegCh2ScanDataLen   56

Definition at line 69 of file rtp.c.

◆ KJpegHeaderSize

#define KJpegHeaderSize   8

◆ KRtpHeaderSize

#define KRtpHeaderSize   12

◆ MAX_PACKET_SIZE

#define MAX_PACKET_SIZE   1400

Function Documentation

◆ rtp_frame_send()

void rtp_frame_send ( struct UdpSocket udp,
struct image_t img,
uint8_t  format_code,
uint8_t  quality_code,
uint8_t  has_dri_header,
float  average_frame_rate,
uint16_t packet_number,
uint32_t rtp_time_counter 
)

Send an RTP frame.

Parameters
[in]*udpThe UDP connection to send the frame over
[in]*imgThe image to send over the RTP connection
[in]format_code0 for YUV422 and 1 for YUV421
[in]quality_codeThe JPEG encoding quality
[in]has_dri_headerWhether we have an DRI header or not
[in]frame_timeTime image was taken in usec (if set to 0 or less it is calculated)
[out]packet_numberThe frame number of the rtp stream
[out]rtp_time_counterThe frame time counter of the rtp stream

Definition at line 127 of file rtp.c.

References image_t::buf, image_t::buf_size, f, image_t::h, MAX_PACKET_SIZE, offset, rtp_packet_send(), and image_t::w.

Referenced by viewvideo_function().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rtp_frame_test()

void rtp_frame_test ( struct UdpSocket udp)

Send a test RTP frame.

Parameters
[in]*udpThe udp connection to send the test frame over

Definition at line 95 of file rtp.c.

References JpegScanDataCh2A, JpegScanDataCh2B, KJpegCh2ScanDataLen, and rtp_packet_send().

+ Here is the call graph for this function:

◆ rtp_packet_send()

static void rtp_packet_send ( struct UdpSocket udp,
uint8_t Jpeg,
int  JpegLen,
uint16_t  m_SequenceNumber,
uint32_t  m_Timestamp,
uint32_t  m_offset,
uint8_t  marker_bit,
int  w,
int  h,
uint8_t  format_code,
uint8_t  quality_code,
uint8_t  has_dri_header 
)
static

Definition at line 177 of file rtp.c.

References h(), KJpegHeaderSize, KRtpHeaderSize, and udp_socket_send_dontwait().

Referenced by rtp_frame_send(), and rtp_frame_test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ JpegScanDataCh2A

uint8_t JpegScanDataCh2A[KJpegCh2ScanDataLen]
Initial value:
= {
0xf8, 0xbe, 0x8a, 0x28, 0xaf, 0xe5, 0x33, 0xfd,
0xfc, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x3f, 0xff, 0xd9
}

Definition at line 72 of file rtp.c.

Referenced by rtp_frame_test().

◆ JpegScanDataCh2B

uint8_t JpegScanDataCh2B[KJpegCh2ScanDataLen]
Initial value:
= {
0xf5, 0x8a, 0x28, 0xa2, 0xbf, 0xca, 0xf3, 0xfc,
0x53, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
0x80, 0x0a, 0x28, 0xa2, 0x80, 0x3f, 0xff, 0xd9
}

Definition at line 81 of file rtp.c.

Referenced by rtp_frame_test().