SmolRTSP 0.2.0
A small, portable, extensible RTSP 1.0 implementation in C99
Loading...
Searching...
No Matches
jpeg.h File Reference

JPEG / Motion JPEG RTP payload-header types and serialization. More...

#include <stdbool.h>
#include <stdint.h>
#include <smolrtsp/priv/compiler_attrs.h>
Include dependency graph for jpeg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SmolRTSP_JpegPayloadHeader
 An RFC 2435 main JPEG header (§3.1). More...
 
struct  SmolRTSP_JpegQtHeader
 An RFC 2435 Quantization Table header (§3.1.8). More...
 
struct  SmolRTSP_JpegRestartHeader
 An RFC 2435 Restart Marker header (§3.1.7). More...
 

Macros

#define SMOLRTSP_JPEG_MAIN_HEADER_SIZE   8
 The size in bytes of an RFC 2435 main JPEG header (§3.1).
 
#define SMOLRTSP_JPEG_QT_HEADER_SIZE   4
 The size in bytes of an RFC 2435 Quantization Table header (§3.1.8).
 
#define SMOLRTSP_JPEG_QT_SIZE   64
 The size in bytes of one 8-bit-precision baseline quantization table.
 
#define SMOLRTSP_JPEG_RESTART_HEADER_SIZE   4
 The size in bytes of an RFC 2435 Restart Marker header (§3.1.7).
 
#define SMOLRTSP_JPEG_TYPE_RESTART   64
 The RFC 2435 Type offset that flags the presence of restart markers.
 
#define SMOLRTSP_MAX_JPEG_PACKET_SIZE   1200
 Default value for SmolRTSP_JpegTransportConfig.max_packet_size: a conservative MTU that leaves room for RTP / UDP / IP headers and one 140-byte first-packet JPEG header (main + QT header + two 64-byte tables).
 
#define SMOLRTSP_JPEG_Q_DYNAMIC   128
 The smallest Q-value that signals an embedded quantization table per RFC 2435 §4.1.
 
#define SMOLRTSP_JPEG_TYPE_SPECIFIC_DEFAULT   0
 The Type-specific field is unused in the baseline RFC 2435 profile.
 

Functions

void SmolRTSP_JpegPayloadHeader_serialize (SmolRTSP_JpegPayloadHeader self, uint8_t buffer[restrict])
 Serializes self into buffer in network byte order.
 
void SmolRTSP_JpegQtHeader_serialize (SmolRTSP_JpegQtHeader self, uint8_t buffer[restrict])
 Serializes self into buffer in network byte order.
 
void SmolRTSP_JpegRestartHeader_serialize (SmolRTSP_JpegRestartHeader self, uint8_t buffer[restrict])
 Serializes self into buffer in network byte order.
 

Detailed Description

JPEG / Motion JPEG RTP payload-header types and serialization.

See also
RTP Payload Format for JPEG-compressed Video: https://datatracker.ietf.org/doc/html/rfc2435

Macro Definition Documentation

◆ SMOLRTSP_JPEG_MAIN_HEADER_SIZE

#define SMOLRTSP_JPEG_MAIN_HEADER_SIZE   8

The size in bytes of an RFC 2435 main JPEG header (§3.1).

Carries Type-Specific, Fragment Offset, Type, Q, Width and Height fields. Present on every JPEG-over-RTP packet of a frame.

◆ SMOLRTSP_JPEG_Q_DYNAMIC

#define SMOLRTSP_JPEG_Q_DYNAMIC   128

The smallest Q-value that signals an embedded quantization table per RFC 2435 §4.1.

Q in [0, 127] references a pre-shared table; Q in [128, 255] is paired with a SmolRTSP_JpegQtHeader and the table bytes themselves.

◆ SMOLRTSP_JPEG_QT_HEADER_SIZE

#define SMOLRTSP_JPEG_QT_HEADER_SIZE   4

The size in bytes of an RFC 2435 Quantization Table header (§3.1.8).

Carries MBZ, Precision and Length fields, prefixing the QT data block itself. Only emitted on the first RTP packet of a frame when an embedded quantization table is sent (Q >= 128).

◆ SMOLRTSP_JPEG_RESTART_HEADER_SIZE

#define SMOLRTSP_JPEG_RESTART_HEADER_SIZE   4

The size in bytes of an RFC 2435 Restart Marker header (§3.1.7).

Carries the Restart Interval, F, L and Restart Count fields. Present immediately after the main JPEG header on every RTP packet of a frame whose Type is in [64, 127] (i.e. the source JPEG uses restart markers).

◆ SMOLRTSP_JPEG_TYPE_RESTART

#define SMOLRTSP_JPEG_TYPE_RESTART   64

The RFC 2435 Type offset that flags the presence of restart markers.

A base Type in [0, 63] (subsampling + interlace) gains this offset, moving it into [64, 127], when the source JPEG carries a DRI marker. The receiver then expects a SmolRTSP_JpegRestartHeader after the main header and knows to honour the inline RSTn markers in the scan data.

Function Documentation

◆ SmolRTSP_JpegPayloadHeader_serialize()

void SmolRTSP_JpegPayloadHeader_serialize ( SmolRTSP_JpegPayloadHeader  self,
uint8_t  buffer[restrict] 
)

Serializes self into buffer in network byte order.

Parameters
[in]selfThe header to write.
[out]bufferThe memory area capable of storing SMOLRTSP_JPEG_MAIN_HEADER_SIZE bytes.

◆ SmolRTSP_JpegQtHeader_serialize()

void SmolRTSP_JpegQtHeader_serialize ( SmolRTSP_JpegQtHeader  self,
uint8_t  buffer[restrict] 
)

Serializes self into buffer in network byte order.

Parameters
[in]selfThe header to write.
[out]bufferThe memory area capable of storing SMOLRTSP_JPEG_QT_HEADER_SIZE bytes.

◆ SmolRTSP_JpegRestartHeader_serialize()

void SmolRTSP_JpegRestartHeader_serialize ( SmolRTSP_JpegRestartHeader  self,
uint8_t  buffer[restrict] 
)

Serializes self into buffer in network byte order.

Parameters
[in]selfThe header to write.
[out]bufferThe memory area capable of storing SMOLRTSP_JPEG_RESTART_HEADER_SIZE bytes.