|
SmolRTSP 0.2.0
A small, portable, extensible RTSP 1.0 implementation in C99
|
An RTP/JPEG (Motion JPEG) data transport. More...
#include <smolrtsp/droppable.h>#include <smolrtsp/jpeg.h>#include <smolrtsp/rtp_transport.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <slice99.h>#include <smolrtsp/priv/compiler_attrs.h>
Go to the source code of this file.
Data Structures | |
| struct | SmolRTSP_JpegTransportConfig |
| The configuration structure for SmolRTSP_JpegTransport. More... | |
| struct | SmolRTSP_JpegFrame |
| One Motion-JPEG frame, ready to packetize per RFC 2435. More... | |
Typedefs | |
| typedef struct SmolRTSP_JpegTransport | SmolRTSP_JpegTransport |
| An RTP/JPEG data transport. | |
Functions | |
| SmolRTSP_JpegTransportConfig | SmolRTSP_JpegTransportConfig_default (void) SMOLRTSP_PRIV_MUST_USE |
| Returns the default SmolRTSP_JpegTransportConfig (SMOLRTSP_MAX_JPEG_PACKET_SIZE). | |
| SmolRTSP_JpegTransport * | SmolRTSP_JpegTransport_new (SmolRTSP_RtpTransport *t) SMOLRTSP_PRIV_MUST_USE |
| Creates a new RTP/JPEG transport with the default configuration. | |
| SmolRTSP_JpegTransport * | SmolRTSP_JpegTransport_new_with_config (SmolRTSP_RtpTransport *t, SmolRTSP_JpegTransportConfig config) SMOLRTSP_PRIV_MUST_USE |
| Creates a new RTP/JPEG transport with a custom configuration. | |
| int | SmolRTSP_JpegTransport_send_frame (SmolRTSP_JpegTransport *self, SmolRTSP_RtpTimestamp ts, SmolRTSP_JpegFrame frame) SMOLRTSP_PRIV_MUST_USE |
| Sends one Motion-JPEG frame as a sequence of RTP packets. | |
| declImplExtern99 (SmolRTSP_Droppable, SmolRTSP_JpegTransport) | |
| Implements SmolRTSP_Droppable_IFACE for SmolRTSP_JpegTransport. | |
| bool | SmolRTSP_JpegTransport_is_full (SmolRTSP_JpegTransport *self) |
An RTP/JPEG (Motion JPEG) data transport.
| declImplExtern99 | ( | SmolRTSP_Droppable | , |
| SmolRTSP_JpegTransport | |||
| ) |
Implements SmolRTSP_Droppable_IFACE for SmolRTSP_JpegTransport.
See Interface99 for the macro usage.
| SmolRTSP_JpegTransport * SmolRTSP_JpegTransport_new | ( | SmolRTSP_RtpTransport * | t | ) |
Creates a new RTP/JPEG transport with the default configuration.
| [in] | t | The underlying RTP transport. |
t != NULL. | SmolRTSP_JpegTransport * SmolRTSP_JpegTransport_new_with_config | ( | SmolRTSP_RtpTransport * | t, |
| SmolRTSP_JpegTransportConfig | config | ||
| ) |
Creates a new RTP/JPEG transport with a custom configuration.
| [in] | t | The underlying RTP transport. |
| [in] | config | The transmission configuration structure. |
t != NULL. config.max_packet_size > SMOLRTSP_JPEG_MAIN_HEADER_SIZE. | int SmolRTSP_JpegTransport_send_frame | ( | SmolRTSP_JpegTransport * | self, |
| SmolRTSP_RtpTimestamp | ts, | ||
| SmolRTSP_JpegFrame | frame | ||
| ) |
Sends one Motion-JPEG frame as a sequence of RTP packets.
The library splits SmolRTSP_JpegFrame::scan_data across as many RTP packets as needed and builds the RFC 2435 ยง3.1 main header per packet, stamping SmolRTSP_JpegPayloadHeader.fragment_offset with the byte offset inside the scan data carried by each packet. The first packet of the frame also carries the quantization-table block (when SmolRTSP_JpegFrame::qt0 / SmolRTSP_JpegFrame::qt1 are non-empty). The RTP marker bit is set on the final packet of the frame.
| [in] | self | The transport. |
| [in] | ts | The RTP timestamp shared by every packet of the frame. |
| [in] | frame | The Motion-JPEG frame to send. |
self != NULL. frame.qt0.len + frame.qt1.len <= 0xFFFF (fits the QT header Length field). config.max_packet_size is large enough to carry one main JPEG header plus the QT block (when present) plus at least one byte of scan data on the first packet – a single-byte first packet is otherwise unrepresentable.errno set by the underlying transport's send).