Go to the documentation of this file.
66 int ident, fragmented, tdt, num_pkts, pkt_len,
ret;
69 if (!
data->split_buf ||
data->split_pos + 2 >
data->split_buf_len ||
70 data->split_pkts <= 0) {
76 if (pkt_len >
data->split_buf_len -
data->split_pos) {
86 data->split_pos += pkt_len;
88 return data->split_pkts > 0;
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);
137 if (
len >
data->split_buf_size || !
data->split_buf) {
139 data->split_buf_size = 2 *
len;
141 if (!
data->split_buf) {
147 memcpy(
data->split_buf, buf,
len);
150 data->split_pkts = num_pkts;
156 }
else if (fragmented == 1) {
167 data->timestamp = *timestamp;
171 if (
data->timestamp != *timestamp) {
178 if (!
data->fragment) {
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")) {
310 }
else if (!strcmp(attr,
"height")) {
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");
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
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
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.
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)
@ 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