46 uint8_t
buf[0x80][0x800];
76 const uint8_t *buf,
const uint8_t *end)
78 const uint8_t *p = buf;
80 while (end - p >= 2) {
81 unsigned int item_len = p[0], config_item = p[1];
83 if (item_len < 2 || end - p < item_len || config_item > 4)
86 switch (config_item) {
88 return p - buf + item_len;
153 const uint8_t *buf,
const uint8_t *end)
155 const uint8_t *p = buf;
156 unsigned int id,
len, type, to_copy;
168 if (end - p < len + (type == 0x7F) ||
id >= 0x80)
174 to_copy =
FFMIN(len + (p - &buf[1]), 0x800 - qdm->
len[
id]);
175 memcpy(&qdm->
buf[
id][qdm->
len[
id]], buf + 1, to_copy);
176 qdm->
len[
id] += to_copy;
178 return p + len - buf;
188 int to_copy, n, res, include_csum;
189 uint8_t *p, *csum_pos =
NULL;
192 assert(qdm->
cache > 0);
193 for (n = 0; n < 0x80; n++)
205 if (qdm->
len[n] > 0xff) {
220 memcpy(p, qdm->
buf[n], to_copy);
225 unsigned int total = 0;
230 AV_WB16(csum_pos, (uint16_t) total);
240 const uint8_t *buf,
int len,
int flags)
243 const uint8_t *end = buf +
len, *p = buf;
253 "Out of sequence config - dropping queue\n");
255 memset(qdm->
len, 0,
sizeof(qdm->
len));
273 while (end - p >= 4) {
283 for (n = 0; n < 0x80; n++)
291 if (--qdm->
cache == 0)
297 return (qdm->
cache > 0) ? 1 : 0;
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int block_size
from extradata, used as pkt length
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AV_WL32 AV_WL24 AV_WL16 AV_WB32 AV_WB24 AV_RB16
AV_WL32 AV_WL24 AV_WL16 AV_RB32
unsigned int n_pkts
number of RTP packets received since last packet output / config
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_WARNING
Something somehow does not look correct.
RTP/H264 specific private data.
int index
stream index in AVFormatContext
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static PayloadContext * qdm2_extradata_new(void)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int qdm2_parse_subpacket(PayloadContext *qdm, AVStream *st, const uint8_t *buf, const uint8_t *end)
Parse a single subpacket.
int subpkts_per_block
max. nr. of subpackets to add per output buffer
uint32_t timestamp
timestamp of next-to-be-returned packet
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
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 wit...
int block_type
values read from the config header, used as packet headers
static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, int flags)
return 0 on packet, no more left, 1 on packet, -1 on partial packet...
void av_log(void *avcl, int level, const char *fmt,...)
AVCodecContext * codec
codec context
unsigned int cache
number of data packets that we have cached right now
static int qdm2_restore_block(PayloadContext *qdm, AVStream *st, AVPacket *pkt)
Add a superblock header around a set of subpackets.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
RTPDynamicProtocolHandler ff_qdm2_dynamic_handler
static void qdm2_extradata_free(PayloadContext *qdm)