66 int ident, fragmented, tdt, num_pkts, pkt_len;
91 if (len < 6 || len > INT_MAX/2) {
98 fragmented = buf[3] >> 6;
99 tdt = (buf[3] >> 4) & 3;
100 num_pkts = buf[3] & 0xf;
103 if (pkt_len > len - 6) {
105 "Invalid packet length %d in %d byte packet\n", pkt_len,
110 if (ident != data->
ident) {
117 "RTP Xiph packet settings (%d,%d,%d)",
118 fragmented, tdt, num_pkts);
125 if (fragmented == 0) {
131 memcpy(pkt->
data, buf, pkt_len);
156 }
else if (fragmented == 1) {
180 "Received packet without a start fragment; dropping.\n");
187 if (fragmented == 3) {
192 "Error occurred when getting fragment buffer.");
209 for (; *buf < buf_end; ++*
buf) {
212 if (!(**buf & 0x80)) {
225 const uint8_t * packed_headers,
226 const uint8_t * packed_headers_end,
230 unsigned num_packed, num_headers,
length, length1, length2, extradata_alloc;
233 if (packed_headers_end - packed_headers < 9) {
236 packed_headers_end - packed_headers);
240 num_packed = bytestream_get_be32(&packed_headers);
241 xiph_data->
ident = bytestream_get_be24(&packed_headers);
242 length = bytestream_get_be16(&packed_headers);
243 num_headers =
get_base128(&packed_headers, packed_headers_end);
244 length1 =
get_base128(&packed_headers, packed_headers_end);
245 length2 =
get_base128(&packed_headers, packed_headers_end);
247 if (num_packed != 1 || num_headers > 3) {
249 num_packed, num_headers);
253 if (packed_headers_end - packed_headers != length ||
254 length1 > length || length2 > length - length1) {
257 length2, packed_headers_end - packed_headers, length);
275 memcpy(ptr, packed_headers, length);
287 const char *attr,
const char *
value)
292 if (!strcmp(attr,
"sampling")) {
293 if (!strcmp(value,
"YCbCr-4:2:0")) {
295 }
else if (!strcmp(value,
"YCbCr-4:4:2")) {
297 }
else if (!strcmp(value,
"YCbCr-4:4:4")) {
301 "Unsupported pixel format %s\n", attr);
304 }
else if (!strcmp(attr,
"width")) {
307 par->
width = atoi(value);
309 }
else if (!strcmp(attr,
"height")) {
312 par->
height = atoi(value);
314 }
else if (!strcmp(attr,
"delivery-method")) {
317 }
else if (!strcmp(attr,
"configuration-uri")) {
322 }
else if (!strcmp(attr,
"configuration")) {
327 size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
329 if (decoded_alloc <= INT_MAX) {
330 decoded_packet =
av_malloc(decoded_alloc);
331 if (decoded_packet) {
336 (s, decoded_packet, decoded_packet + packet_size, par,
340 "Out of memory while decoding SDP configuration.\n");
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
ptrdiff_t const GLvoid * data
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
#define AV_LOG_WARNING
Something somehow does not look correct.
RTP/JPEG specific private data.
int index
stream index in AVFormatContext
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
This struct describes the properties of an encoded stream.
Macro definitions for various function/variable attributes.
static int xiph_parse_sdp_line(AVFormatContext *s, int st_index, PayloadContext *data, const char *line)
static int xiph_parse_fmtp_pair(AVFormatContext *s, AVStream *stream, PayloadContext *xiph_data, const char *attr, const char *value)
AVStream ** streams
A list of all streams in the file.
static void xiph_close_context(PayloadContext *data)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
unsigned ident
24-bit stream configuration identifier
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
uint32_t timestamp
current frame timestamp
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define PTRDIFF_SPECIFIER
simple assert() macros that are a bit more flexible than ISO C assert().
int extradata_size
Size of the extradata content in bytes.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
GLsizei GLboolean const GLfloat * value
static int get_base128(const uint8_t **buf, const uint8_t *buf_end)
Length encoding described in RFC5215 section 3.1.1.
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
AVIOContext * fragment
buffer for split payloads
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
int ff_parse_fmtp(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *p, int(*parse_fmtp)(AVFormatContext *s, AVStream *stream, PayloadContext *data, const char *attr, const char *value))
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define flags(name, subs,...)
const RTPDynamicProtocolHandler ff_theora_dynamic_handler
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static int xiph_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
int ff_rtp_finalize_packet(AVPacket *pkt, AVIOContext **dyn_buf, int stream_idx)
Close the dynamic buffer and make a packet from it.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
const RTPDynamicProtocolHandler ff_vorbis_dynamic_handler
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int parse_packed_headers(AVFormatContext *s, const uint8_t *packed_headers, const uint8_t *packed_headers_end, AVCodecParameters *par, PayloadContext *xiph_data)
Based off parse_packed_headers in Vorbis RTP.
This structure stores compressed data.