Go to the documentation of this file.
34 uint8_t *buf, *end, *start;
35 uint8_t *
sps, *
pps, *sps_ext;
36 uint32_t sps_size = 0, pps_size = 0, sps_ext_size = 0;
37 int ret, nb_sps = 0, nb_pps = 0, nb_sps_ext = 0;
66 while (end - buf > 4) {
71 nal_type = buf[0] & 0x1f;
81 }
else if (nal_type == 8) {
89 }
else if (nal_type == 13) {
91 if (
size > UINT16_MAX || nb_sps_ext >= 256) {
105 if (sps_size < 6 || !pps_size) {
121 if (
sps[3] != 66 &&
sps[3] != 77 &&
sps[3] != 88) {
146 uint16_t sps_size, pps_size;
153 if (*
size < 11 || in[0] != 1)
157 if (11 + sps_size > *
size)
159 pps_size =
AV_RB16(&in[9 + sps_size]);
160 if (11 + sps_size + pps_size > *
size)
167 memcpy(
out + 4, &in[8], sps_size);
169 memcpy(
out + 8 + sps_size, &in[11 + sps_size], pps_size);
205 return ((v >> 1) ^ sign) - sign;
210 int i, j,
ret, rbsp_size, aspect_ratio_idc, pic_order_cnt_type;
211 int num_ref_frames_in_pic_order_cnt_cycle;
212 int delta_scale, lastScale = 8, nextScale = 8;
213 int sizeOfScalingList;
225 memset(
sps, 0,
sizeof(*
sps));
238 if (
sps->profile_idc == 100 ||
sps->profile_idc == 110 ||
239 sps->profile_idc == 122 ||
sps->profile_idc == 244 ||
sps->profile_idc == 44 ||
240 sps->profile_idc == 83 ||
sps->profile_idc == 86 ||
sps->profile_idc == 118 ||
241 sps->profile_idc == 128 ||
sps->profile_idc == 138 ||
sps->profile_idc == 139 ||
242 sps->profile_idc == 134) {
244 if (
sps->chroma_format_idc == 3) {
251 for (
i = 0;
i < ((
sps->chroma_format_idc != 3) ? 8 : 12);
i++) {
256 sizeOfScalingList =
i < 6 ? 16 : 64;
257 for (j = 0; j < sizeOfScalingList; j++) {
258 if (nextScale != 0) {
260 nextScale = (lastScale + delta_scale) & 0xff;
262 lastScale = nextScale == 0 ? lastScale : nextScale;
267 sps->chroma_format_idc = 1;
268 sps->bit_depth_luma = 8;
269 sps->bit_depth_chroma = 8;
275 if (pic_order_cnt_type == 0) {
277 }
else if (pic_order_cnt_type == 1) {
282 for (
i = 0;
i < num_ref_frames_in_pic_order_cnt_cycle;
i++)
292 if (!
sps->frame_mbs_only_flag)
306 aspect_ratio_idc =
get_bits(&gb, 8);
307 if (aspect_ratio_idc == 0xff) {
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_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
int ff_avc_decode_sps(H264SPS *sps, const uint8_t *buf, int buf_size)
static int get_se_golomb(GetBitContext *gb)
#define FF_ARRAY_ELEMS(a)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
static const AVRational avc_sample_aspect_ratio[17]
Rational number (pair of numerator and denominator).
uint8_t * ff_nal_unit_extract_rbsp(const uint8_t *src, uint32_t src_len, uint32_t *dst_len, int header_len)
static int get_ue_golomb(GetBitContext *gb)
static unsigned int get_bits1(GetBitContext *s)
void avio_w8(AVIOContext *s, int b)
int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len)
int ff_nal_parse_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
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_RB32
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static void skip_bits1(GetBitContext *s)
#define i(width, name, range_min, range_max)
uint8_t chroma_format_idc
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
#define AV_INPUT_BUFFER_PADDING_SIZE
int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size)
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
void avio_wb16(AVIOContext *s, unsigned int val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
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
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