FFmpeg  4.0
Data Structures | Functions | Variables
rtpdec_qdm2.c File Reference

RTP support for the QDM2 payload (todo: wiki) More...

#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/avcodec.h"
#include "internal.h"
#include "rtp.h"
#include "rtpdec.h"
#include "rtpdec_formats.h"

Go to the source code of this file.

Data Structures

struct  PayloadContext
 RTP/JPEG specific private data. More...
 

Functions

static int qdm2_parse_config (PayloadContext *qdm, AVStream *st, const uint8_t *buf, const uint8_t *end)
 Parse configuration (basically the codec-specific extradata) from an RTP config subpacket (starts with 0xff). More...
 
static int qdm2_parse_subpacket (PayloadContext *qdm, AVStream *st, const uint8_t *buf, const uint8_t *end)
 Parse a single subpacket. More...
 
static int qdm2_restore_block (PayloadContext *qdm, AVStream *st, AVPacket *pkt)
 Add a superblock header around a set of subpackets. More...
 
static int qdm2_parse_packet (AVFormatContext *s, PayloadContext *qdm, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
 return 0 on packet, no more left, 1 on packet, -1 on partial packet... More...
 

Variables

const RTPDynamicProtocolHandler ff_qdm2_dynamic_handler
 

Detailed Description

RTP support for the QDM2 payload (todo: wiki)

Author
Ronald S. Bultje rbult.nosp@m.je@r.nosp@m.onald.nosp@m..bit.nosp@m.freak.nosp@m..net

Definition in file rtpdec_qdm2.c.

Function Documentation

◆ qdm2_parse_config()

static int qdm2_parse_config ( PayloadContext qdm,
AVStream st,
const uint8_t buf,
const uint8_t end 
)
static

Parse configuration (basically the codec-specific extradata) from an RTP config subpacket (starts with 0xff).

Layout of the config subpacket (in bytes): 1: 0xFF <- config ID then an array { 1: size <- of the current item 1: item type <- 0 .. 4 size-2: data <- data depends on the item type }

Item 0 implies the end of the config subpacket, and has no data. Item 1 implies a stream configuration without extradata. Item 2 max. nr. of subpackets per superblock Item 3 superblock type for the stream Item 4 implies a stream configuration with extradata (size >= 0x1c).

Returns
<0 on error, otherwise the number of bytes parsed from the input buffer.

< subpackets per block

Definition at line 77 of file rtpdec_qdm2.c.

Referenced by qdm2_parse_packet().

◆ qdm2_parse_subpacket()

static int qdm2_parse_subpacket ( PayloadContext qdm,
AVStream st,
const uint8_t buf,
const uint8_t end 
)
static

Parse a single subpacket.

We store this subpacket in an intermediate buffer (position depends on the ID (byte[0]). When called, at least 4 bytes are available for reading (see qdm2_parse_packet()).

Layout of a single subpacket (RTP packets commonly contain multiple such subpackets) - length in bytes: 1: ordering ID <- 0 .. 0x7F 1: subpacket type <- 0 .. 0x7F; value & 0x80 means subpacket length = 2 bytes, else 1 byte 1/2: subpacket length <- length of the data following the flags/length fields if (subpacket type & 0x7F) == 0x7F 1: subpacket type, higher bits size: subpacket data

The subpackets come in randomly, and should be encapsulated into 1 or more superblocks (containing qdm->subpkts_per_block subpackets each) per RTP packet, in order of ascending "ordering ID", see qdm2_restore_block().

Returns
<0 on error, otherwise the number of bytes parsed from the input buffer.

Definition at line 152 of file rtpdec_qdm2.c.

Referenced by qdm2_parse_packet().

◆ qdm2_restore_block()

static int qdm2_restore_block ( PayloadContext qdm,
AVStream st,
AVPacket pkt 
)
static

Add a superblock header around a set of subpackets.

Returns
<0 on error, else 0.

Definition at line 186 of file rtpdec_qdm2.c.

Referenced by qdm2_parse_packet().

◆ qdm2_parse_packet()

static int qdm2_parse_packet ( AVFormatContext s,
PayloadContext qdm,
AVStream st,
AVPacket pkt,
uint32_t *  timestamp,
const uint8_t buf,
int  len,
uint16_t  seq,
int  flags 
)
static

return 0 on packet, no more left, 1 on packet, -1 on partial packet...

Definition at line 237 of file rtpdec_qdm2.c.

Variable Documentation

◆ ff_qdm2_dynamic_handler

const RTPDynamicProtocolHandler ff_qdm2_dynamic_handler
Initial value:
= {
.enc_name = "X-QDM",
.codec_type = AVMEDIA_TYPE_AUDIO,
.codec_id = AV_CODEC_ID_NONE,
.priv_data_size = sizeof(PayloadContext),
}
RTP/JPEG specific private data.
Definition: rdt.c:83
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
return 0 on packet, no more left, 1 on packet, -1 on partial packet...
Definition: rtpdec_qdm2.c:237
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
Parse a packet, add all split parts to parse_queue.
Definition: utils.c:1437

Definition at line 301 of file rtpdec_qdm2.c.