libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
RtpPayloadJpeg Class Reference

RTP payload handler for RFC 2435 JPEG (Motion JPEG). More...

#include <rtppayload.h>

Inheritance diagram for RtpPayloadJpeg:
Collaboration diagram for RtpPayloadJpeg:

Public Member Functions

 RtpPayloadJpeg (int width, int height, int quality=85)
 Constructs a JPEG payload handler.
 
uint8_t payloadType () const override
 Returns the RTP payload type number.
 
uint32_t clockRate () const override
 Returns the RTP timestamp clock rate in Hz.
 
RtpPacket::List pack (const void *mediaData, size_t size) override
 Fragments media data into RTP payload packets.
 
Buffer unpack (const RtpPacket::List &packets) override
 Reassembles RTP payload packets into media data.
 
int width () const
 Returns the image width.
 
int height () const
 Returns the image height.
 
int quality () const
 Returns the quality parameter.
 
void setQuality (int q)
 Sets the quality parameter.
 
- Public Member Functions inherited from RtpPayload
virtual ~RtpPayload ()=default
 Destructor.
 
virtual size_t maxPayloadSize () const
 Returns the maximum payload size per packet.
 

Additional Inherited Members

- Protected Member Functions inherited from RtpPayload
 RtpPayload ()=default
 Default constructor (protected; use a concrete subclass).
 

Detailed Description

RTP payload handler for RFC 2435 JPEG (Motion JPEG).

Implements packing/unpacking of JPEG-compressed video frames as defined by RFC 2435. Each packet carries an 8-byte JPEG header followed by a fragment of the JPEG data.

RFC 2435 JPEG Header (8 bytes)
+---------+---------+---------+---------+
| Type- | Fragment Offset | Type |
| specific| (24 bits) | |
+---------+---------+---------+---------+
| Q | Width/8 | Height/8| |
+---------+---------+---------+---------+
Dynamic array container wrapping std::vector.
Definition list.h:40
Example
RtpPayloadJpeg payload(1920, 1080);
auto packets = payload.pack(jpegData, jpegSize);
RTP payload handler for RFC 2435 JPEG (Motion JPEG).
Definition rtppayload.h:264

Constructor & Destructor Documentation

◆ RtpPayloadJpeg()

RtpPayloadJpeg::RtpPayloadJpeg ( int  width,
int  height,
int  quality = 85 
)

Constructs a JPEG payload handler.

Parameters
widthImage width in pixels.
heightImage height in pixels.
qualityJPEG quality parameter for RTP header (1-99, default 85).

Member Function Documentation

◆ clockRate()

uint32_t RtpPayloadJpeg::clockRate ( ) const
inlineoverridevirtual

Returns the RTP timestamp clock rate in Hz.

Implements RtpPayload.

◆ pack()

RtpPacket::List RtpPayloadJpeg::pack ( const void mediaData,
size_t  size 
)
overridevirtual

Fragments media data into RTP payload packets.

Each returned RtpPacket includes space for the 12-byte RTP header at the start, followed by any payload-specific header, followed by the media data fragment. All returned packets share a single Buffer::Ptr.

Parameters
mediaDataPointer to the media data.
sizeSize of the media data in bytes.
Returns
List of RtpPackets sharing one buffer.

Implements RtpPayload.

◆ payloadType()

uint8_t RtpPayloadJpeg::payloadType ( ) const
inlineoverridevirtual

Returns the RTP payload type number.

Implements RtpPayload.

◆ unpack()

Buffer RtpPayloadJpeg::unpack ( const RtpPacket::List packets)
overridevirtual

Reassembles RTP payload packets into media data.

Parameters
packetsThe list of packets to reassemble.
Returns
Buffer containing the reassembled media data.

Implements RtpPayload.


The documentation for this class was generated from the following file: