Go to the documentation of this file.
63 const uint8_t *buf,
int len, uint16_t seq,
67 int ident, fragmented, tdt, num_pkts, pkt_len,
ret;
70 if (!
data->split_buf ||
data->split_pos + 2 >
data->split_buf_len ||
71 data->split_pkts <= 0) {
77 if (pkt_len >
data->split_buf_len -
data->split_pos) {
87 data->split_pos += pkt_len;
89 return data->split_pkts > 0;
92 if (len < 6 || len > INT_MAX/2) {
99 fragmented = buf[3] >> 6;
100 tdt = (buf[3] >> 4) & 3;
101 num_pkts = buf[3] & 0xf;
104 if (pkt_len >
len - 6) {
106 "Invalid packet length %d in %d byte packet\n", pkt_len,
111 if (ident !=
data->ident) {
118 "RTP Xiph packet settings (%d,%d,%d)",
119 fragmented, tdt, num_pkts);
126 if (fragmented == 0) {
132 memcpy(
pkt->
data, buf, pkt_len);
138 if (
len >
data->split_buf_size || !
data->split_buf) {
140 data->split_buf_size = 2 *
len;
142 if (!
data->split_buf) {
148 memcpy(
data->split_buf, buf,
len);
151 data->split_pkts = num_pkts;
157 }
else if (fragmented == 1) {
168 data->timestamp = *timestamp;
172 if (
data->timestamp != *timestamp) {
179 if (!
data->fragment) {
181 "Received packet without a start fragment; dropping.\n");
188 if (fragmented == 3) {
193 "Error occurred when getting fragment buffer.");
207 static int get_base128(
const uint8_t ** buf,
const uint8_t * buf_end)
210 for (; *buf < buf_end; ++*buf) {
213 if (!(**buf & 0x80)) {
226 const uint8_t * packed_headers,
227 const uint8_t * packed_headers_end,
231 unsigned num_packed, num_headers, length, length1, length2, extradata_alloc;
235 if (packed_headers_end - packed_headers < 9) {
238 packed_headers_end - packed_headers);
242 num_packed = bytestream_get_be32(&packed_headers);
243 xiph_data->
ident = bytestream_get_be24(&packed_headers);
244 length = bytestream_get_be16(&packed_headers);
245 num_headers =
get_base128(&packed_headers, packed_headers_end);
246 length1 =
get_base128(&packed_headers, packed_headers_end);
247 length2 =
get_base128(&packed_headers, packed_headers_end);
249 if (num_packed != 1 || num_headers > 3) {
251 num_packed, num_headers);
255 if (packed_headers_end - packed_headers != length ||
256 length1 > length || length2 > length - length1) {
259 length2, packed_headers_end - packed_headers, length);
277 memcpy(ptr, packed_headers, length);
289 const char *attr,
const char *
value)
294 if (!strcmp(attr,
"sampling")) {
295 if (!strcmp(
value,
"YCbCr-4:2:0")) {
297 }
else if (!strcmp(
value,
"YCbCr-4:4:2")) {
299 }
else if (!strcmp(
value,
"YCbCr-4:4:4")) {
303 "Unsupported pixel format %s\n", attr);
306 }
else if (!strcmp(attr,
"width")) {
311 }
else if (!strcmp(attr,
"height")) {
316 }
else if (!strcmp(attr,
"delivery-method")) {
319 }
else if (!strcmp(attr,
"configuration-uri")) {
324 }
else if (!strcmp(attr,
"configuration")) {
327 uint8_t *decoded_packet =
NULL;
329 size_t decoded_alloc = strlen(
value) / 4 * 3 + 4;
331 if (decoded_alloc <= INT_MAX) {
332 decoded_packet =
av_malloc(decoded_alloc);
333 if (decoded_packet) {
338 (
s, decoded_packet, decoded_packet + packet_size, par,
342 "Out of memory while decoding SDP configuration.\n");
static int get_base128(const uint8_t **buf, const uint8_t *buf_end)
Length encoding described in RFC5215 section 3.1.1.
const RTPDynamicProtocolHandler ff_theora_dynamic_handler
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
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 xiph_parse_sdp_line(AVFormatContext *s, int st_index, PayloadContext *data, const char *line)
This struct describes the properties of an encoded stream.
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))
int ff_rtp_finalize_packet(AVPacket *pkt, AVIOContext **dyn_buf, int stream_idx)
Close the dynamic buffer and make a packet from it.
uint32_t timestamp
current frame timestamp
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
AVIOContext * fragment
buffer for split payloads
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
and forward the result(frame or status change) to the corresponding input. If nothing is possible
unsigned ident
24-bit stream configuration identifier
#define PTRDIFF_SPECIFIER
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
int extradata_size
Size of the extradata content in bytes.
static void xiph_close_context(PayloadContext *data)
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
const RTPDynamicProtocolHandler ff_vorbis_dynamic_handler
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
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)
#define AV_INPUT_BUFFER_PADDING_SIZE
int index
stream index in AVFormatContext
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index, int flush)
Parse a packet, add all split parts to parse_queue.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
This structure stores compressed data.
#define flags(name, subs,...)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
RTP/JPEG specific private data.
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
static int xiph_parse_fmtp_pair(AVFormatContext *s, AVStream *stream, PayloadContext *xiph_data, const char *attr, const char *value)
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