FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 "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).
 
static int qdm2_parse_subpacket (PayloadContext *qdm, AVStream *st, const uint8_t *buf, const uint8_t *end)
 Parse a single subpacket.
 
static int qdm2_restore_block (PayloadContext *qdm, AVStream *st, AVPacket *pkt)
 Add a superblock header around a set of subpackets.
 
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...
 
static PayloadContextqdm2_extradata_new (void)
 
static void qdm2_extradata_free (PayloadContext *qdm)
 

Variables

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

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 76 of file rtpdec_qdm2.c.

Referenced by qdm2_parse_packet().

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 153 of file rtpdec_qdm2.c.

Referenced by qdm2_parse_packet().

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 187 of file rtpdec_qdm2.c.

Referenced by 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 238 of file rtpdec_qdm2.c.

static PayloadContext* qdm2_extradata_new ( void  )
static

Definition at line 302 of file rtpdec_qdm2.c.

static void qdm2_extradata_free ( PayloadContext qdm)
static

Definition at line 307 of file rtpdec_qdm2.c.

Variable Documentation

RTPDynamicProtocolHandler ff_qdm2_dynamic_handler
Initial value:
= {
.enc_name = "X-QDM",
.codec_type = AVMEDIA_TYPE_AUDIO,
.codec_id = AV_CODEC_ID_NONE,
.parse_packet = qdm2_parse_packet,
}

Definition at line 312 of file rtpdec_qdm2.c.

Referenced by av_register_rtp_dynamic_payload_handlers().