30 #define MAX_TRUNC_PICTURE_SIZE (500 * 1024 * 1024) 42 uint32_t
len, left, trunclen = 0;
54 type = bytestream2_get_be32u(&g);
64 len = bytestream2_get_be32u(&g);
65 if (len <= 0 || len >=
sizeof(mimetype)) {
82 if (!strncmp(mime->
str, mimetype,
sizeof(mimetype))) {
97 len = bytestream2_get_be32u(&g);
114 width = bytestream2_get_be32u(&g);
115 height = bytestream2_get_be32u(&g);
119 len = bytestream2_get_be32u(&g);
122 if (len <= 0 || len > left) {
133 if (truncate_workaround &&
135 len > left && (len & 0xffffff) == left) {
136 av_log(s,
AV_LOG_INFO,
"Correcting truncated metadata picture size from %u to %u\n", left, len);
137 trunclen = len - left;
155 if (
avio_read(s->
pb, data->
data + len - trunclen, trunclen) < trunclen)
#define MAX_TRUNC_PICTURE_SIZE
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int index
stream index in AVFormatContext
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
int strict_std_compliance
Allow non-standard and experimental extension.
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
enum AVMediaType codec_type
General type of the encoded data.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
int flags
A combination of AV_PKT_FLAG values.
const CodecMime ff_id3v2_mime_tags[]
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
#define AV_EF_EXPLODE
abort decoding on minor error detection
#define FF_ARRAY_ELEMS(a)
#define AV_LOG_INFO
Standard information.
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
AVIOContext * pb
I/O context.
uint8_t * data
The data buffer.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define FF_COMPLIANCE_NORMAL
#define RETURN_ERROR(code)
A reference to a data buffer.
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
int disposition
AV_DISPOSITION_* bit field.
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int truncate_workaround)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
const char *const ff_id3v2_picture_types[21]
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...