40 #define KJpegCh1ScanDataLen 32
41 #define KJpegCh2ScanDataLen 56
45 0xf8, 0xbe, 0x8a, 0x28, 0xaf, 0xe5, 0x33, 0xfd,
46 0xfc, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
47 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
48 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
49 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
50 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
51 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x3f, 0xff, 0xd9
54 0xf5, 0x8a, 0x28, 0xa2, 0xbf, 0xca, 0xf3, 0xfc,
55 0x53, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
56 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
57 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
58 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
59 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x0a, 0x28, 0xa2,
60 0x80, 0x0a, 0x28, 0xa2, 0x80, 0x3f, 0xff, 0xd9
78 rtp_packet_send(udp,
JpegScanDataCh2A,
KJpegCh2ScanDataLen, framecounter, timecounter, 0, 1, 64, 48, format_code,
81 rtp_packet_send(udp,
JpegScanDataCh2B,
KJpegCh2ScanDataLen, framecounter, timecounter, 0, 1, 64, 48, format_code,
105 #define MAX_PACKET_SIZE 1400
107 if (frame_time <= 0) {
109 gettimeofday(&tv, 0);
110 frame_time = (tv.tv_sec % (256 * 256)) + tv.tv_usec;
114 for (; jpeg_size > 0;) {
118 if (jpeg_size <= len) {
123 rtp_packet_send(udp, jpeg_ptr, len, (*packet_number)++, frame_time, offset, lastpacket, img->
w, img->
h, format_code,
124 quality_code, has_dri_header);
164 #define KRtpHeaderSize 12 // size of the RTP header
165 #define KJpegHeaderSize 8 // size of the special JPEG payload header
170 memset(RtpBuf, 0x00,
sizeof(RtpBuf));
189 m_Timestamp *= 9 / 100;
192 RtpBuf[1] = 0x1a + (marker_bit << 7);
193 RtpBuf[2] = m_SequenceNumber >> 8;
194 RtpBuf[3] = m_SequenceNumber & 0x0FF;
195 RtpBuf[4] = (m_Timestamp & 0xFF000000) >> 24;
196 RtpBuf[5] = (m_Timestamp & 0x00FF0000) >> 16;
197 RtpBuf[6] = (m_Timestamp & 0x0000FF00) >> 8;
198 RtpBuf[7] = (m_Timestamp & 0x000000FF);
219 RtpBuf[13] = (m_offset & 0x00FF0000) >> 16;
220 RtpBuf[14] = (m_offset & 0x0000FF00) >> 8;
221 RtpBuf[15] = (m_offset & 0x000000FF);
224 RtpBuf[16] = format_code;
225 if (has_dri_header) {
228 RtpBuf[17] = quality_code;
232 memcpy(&RtpBuf[20], Jpeg, JpegLen);
int udp_socket_send_dontwait(struct UdpSocket *sock, uint8_t *buffer, uint32_t len)
Send a packet from buffer, non-blocking.
uint32_t buf_size
The buffer size.
static void rtp_packet_send(struct UdpSocket *udp, uint8_t *Jpeg, int JpegLen, uint32_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)
#define KJpegCh2ScanDataLen
static const float offset[]
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 frame_time, uint32_t *packet_number)
Send an RTP frame.
void * buf
Image buffer (depending on the image_type)
uint8_t JpegScanDataCh2A[KJpegCh2ScanDataLen]
static void h(const real32_T x[7], const real32_T q[4], real32_T y[6])
uint8_t JpegScanDataCh2B[KJpegCh2ScanDataLen]
Encodes a vide stream with RTP (JPEG)
void rtp_frame_test(struct UdpSocket *udp)
Send a test RTP frame.