83 while (end - p >= 2) {
84 unsigned int item_len = p[0], config_item = p[1];
86 if (item_len < 2 || end - p < item_len || config_item > 4)
89 switch (config_item) {
91 return p - buf + item_len;
170 if (end - p < len + (type == 0x7F) ||
id >= 0x80)
176 to_copy =
FFMIN(len + (p - &buf[1]), 0x800 - qdm->
len[
id]);
177 memcpy(&qdm->
buf[
id][qdm->
len[
id]], buf + 1, to_copy);
178 qdm->
len[
id] += to_copy;
180 return p + len -
buf;
190 int to_copy, n, res, include_csum;
195 for (n = 0; n < 0x80; n++)
207 if (qdm->
len[n] > 0xff) {
222 memcpy(p, qdm->
buf[n], to_copy);
227 unsigned int total = 0;
232 AV_WB16(csum_pos, (uint16_t) total);
256 "Out of sequence config - dropping queue\n");
258 memset(qdm->
len, 0,
sizeof(qdm->
len));
276 while (end - p >= 4) {
286 for (n = 0; n < 0x80; n++)
294 if (--qdm->
cache == 0)
300 return (qdm->
cache > 0) ? 1 : 0;
const RTPDynamicProtocolHandler ff_qdm2_dynamic_handler
int block_size
from extradata, used as pkt length
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
unsigned int n_pkts
number of RTP packets received since last packet output / config
#define AV_LOG_WARNING
Something somehow does not look correct.
RTP/JPEG specific private data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int index
stream index in AVFormatContext
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static av_cold int end(AVCodecContext *avctx)
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
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
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...
uint32_t timestamp
current frame timestamp
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
simple assert() macros that are a bit more flexible than ISO C assert().
unsigned int cache
number of data packets that we have cached right now
Libavcodec external API header.
static int qdm2_restore_block(PayloadContext *qdm, AVStream *st, AVPacket *pkt)
Add a superblock header around a set of subpackets.
uint8_t * buf
the temporary storage buffer
#define flags(name, subs,...)
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
This structure stores compressed data.