66 int ident, fragmented, tdt, num_pkts, pkt_len,
ret;
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;
234 if (packed_headers_end - packed_headers < 9) {
237 packed_headers_end - packed_headers);
241 num_packed = bytestream_get_be32(&packed_headers);
242 xiph_data->
ident = bytestream_get_be24(&packed_headers);
243 length = bytestream_get_be16(&packed_headers);
244 num_headers =
get_base128(&packed_headers, packed_headers_end);
245 length1 =
get_base128(&packed_headers, packed_headers_end);
246 length2 =
get_base128(&packed_headers, packed_headers_end);
248 if (num_packed != 1 || num_headers > 3) {
250 num_packed, num_headers);
254 if (packed_headers_end - packed_headers != length ||
255 length1 > length || length2 > length - length1) {
258 length2, packed_headers_end - packed_headers, length);
276 memcpy(ptr, packed_headers, length);
288 const char *attr,
const char *
value)
293 if (!strcmp(attr,
"sampling")) {
294 if (!strcmp(value,
"YCbCr-4:2:0")) {
296 }
else if (!strcmp(value,
"YCbCr-4:4:2")) {
298 }
else if (!strcmp(value,
"YCbCr-4:4:4")) {
302 "Unsupported pixel format %s\n", attr);
305 }
else if (!strcmp(attr,
"width")) {
308 par->
width = atoi(value);
310 }
else if (!strcmp(attr,
"height")) {
313 par->
height = atoi(value);
315 }
else if (!strcmp(attr,
"delivery-method")) {
318 }
else if (!strcmp(attr,
"configuration-uri")) {
323 }
else if (!strcmp(attr,
"configuration")) {
328 size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
330 if (decoded_alloc <= INT_MAX) {
331 decoded_packet =
av_malloc(decoded_alloc);
332 if (decoded_packet) {
337 (s, decoded_packet, decoded_packet + packet_size, par,
341 "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)
GLsizei GLboolean const GLfloat * 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.
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.
uint8_t * buf
the temporary storage 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.
and forward the result(frame or status change) to the corresponding input.If nothing is possible
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
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.