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,
106 #define MAX_PACKET_SIZE 1400
110 gettimeofday(&tv, 0);
111 uint32_t t = (tv.tv_sec % (256 * 256)) * 90000 + tv.tv_usec * 9 / 100;
116 for (; jpeg_size > 0;) {
120 if (jpeg_size <= len) {
125 rtp_packet_send(udp, jpeg_ptr, len, packetcounter, timecounter, offset, lastpacket, img->
w, img->
h, format_code,
126 quality_code, has_dri_header);
137 timecounter += delta_t;
168 #define KRtpHeaderSize 12 // size of the RTP header
169 #define KJpegHeaderSize 8 // size of the special JPEG payload header
174 memset(RtpBuf, 0x00,
sizeof(RtpBuf));
195 RtpBuf[1] = 0x1a + (marker_bit << 7);
196 RtpBuf[2] = m_SequenceNumber >> 8;
197 RtpBuf[3] = m_SequenceNumber & 0x0FF;
198 RtpBuf[4] = (m_Timestamp & 0xFF000000) >> 24;
199 RtpBuf[5] = (m_Timestamp & 0x00FF0000) >> 16;
200 RtpBuf[6] = (m_Timestamp & 0x0000FF00) >> 8;
201 RtpBuf[7] = (m_Timestamp & 0x000000FF);
222 RtpBuf[13] = (m_offset & 0x00FF0000) >> 16;
223 RtpBuf[14] = (m_offset & 0x0000FF00) >> 8;
224 RtpBuf[15] = (m_offset & 0x000000FF);
227 RtpBuf[16] = format_code;
228 if (has_dri_header) {
231 RtpBuf[17] = quality_code;
235 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
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 * buf
Image buffer (depending on the image_type)
uint8_t JpegScanDataCh2A[KJpegCh2ScanDataLen]
uint8_t JpegScanDataCh2B[KJpegCh2ScanDataLen]
Encodes a vide stream with RTP (JPEG)
void rtp_frame_test(struct UdpSocket *udp)
Send a test RTP frame.