Go to the documentation of this file.
33 const uint8_t *
a = p + 4 - ((intptr_t)p & 3);
35 for (end -= 3; p <
a && p < end; p++) {
36 if (p[0] == 0 && p[1] == 0 && p[2] == 1)
40 for (end -= 3; p < end; p += 4) {
41 uint32_t x = *(
const uint32_t*)p;
44 if ((x - 0x01010101) & (~x) & 0x80808080) {
46 if (p[0] == 0 && p[2] == 1)
48 if (p[2] == 0 && p[3] == 1)
52 if (p[2] == 0 && p[4] == 1)
54 if (p[4] == 0 && p[5] == 1)
60 for (end += 3; p < end; p++) {
61 if (p[0] == 0 && p[1] == 0 && p[2] == 1)
75 const uint8_t *buf_in,
int size)
77 const uint8_t *p = buf_in;
78 const uint8_t *end = p +
size;
79 const uint8_t *nal_start, *nal_end;
84 const size_t nalu_limit = SIZE_MAX /
sizeof(*
list->nalus);
85 while (nal_start < end && !*(nal_start++));
92 avio_write(pb, nal_start, nal_end - nal_start);
93 }
else if (
list->nb_nalus >= nalu_limit) {
97 (
list->nb_nalus + 1) *
sizeof(*
list->nalus));
101 tmp[
list->nb_nalus++] = (
NALU){ .offset = nal_start - p,
102 .size = nal_end - nal_start };
104 size += 4 + nal_end - nal_start;
124 for (
unsigned i = 0;
i <
list->nb_nalus;
i++) {
147 unsigned int res = 0;
149 if (end - start < nal_length_size)
151 while (nal_length_size--)
152 res = (res << 8) | *start++;
154 if (res > end - start)
161 uint32_t *dst_len,
int header_len)
172 while (
i < header_len &&
i < src_len)
175 while (
i + 2 < src_len)
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
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
const uint8_t * ff_nal_mp4_find_startcode(const uint8_t *start, const uint8_t *end, int nal_length_size)
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
static const uint8_t * nal_find_startcode_internal(const uint8_t *p, const uint8_t *end)
int ff_nal_parse_units(AVIOContext *pb, const uint8_t *buf_in, int size)
uint8_t * ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, uint32_t *dst_len, int header_len)
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 list
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
int ff_nal_parse_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wb32(AVIOContext *s, unsigned int val)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
void ff_nal_units_write_list(const NALUList *list, AVIOContext *pb, const uint8_t *buf)
#define i(width, name, range_min, range_max)
#define AV_INPUT_BUFFER_PADDING_SIZE
static int nal_parse_units(AVIOContext *pb, NALUList *list, const uint8_t *buf_in, int size)
const uint8_t * ff_nal_find_startcode(const uint8_t *p, const uint8_t *end)
int ff_nal_units_create_list(NALUList *list, const uint8_t *buf, int size)