45#define ID_8SVX MKTAG('8','S','V','X')
46#define ID_16SV MKTAG('1','6','S','V')
47#define ID_MAUD MKTAG('M','A','U','D')
48#define ID_MHDR MKTAG('M','H','D','R')
49#define ID_MDAT MKTAG('M','D','A','T')
50#define ID_VHDR MKTAG('V','H','D','R')
51#define ID_ATAK MKTAG('A','T','A','K')
52#define ID_RLSE MKTAG('R','L','S','E')
53#define ID_CHAN MKTAG('C','H','A','N')
54#define ID_PBM MKTAG('P','B','M',' ')
55#define ID_ILBM MKTAG('I','L','B','M')
56#define ID_BMHD MKTAG('B','M','H','D')
57#define ID_DGBL MKTAG('D','G','B','L')
58#define ID_CAMG MKTAG('C','A','M','G')
59#define ID_CMAP MKTAG('C','M','A','P')
60#define ID_ACBM MKTAG('A','C','B','M')
61#define ID_DEEP MKTAG('D','E','E','P')
62#define ID_RGB8 MKTAG('R','G','B','8')
63#define ID_RGBN MKTAG('R','G','B','N')
64#define ID_DSD MKTAG('D','S','D',' ')
65#define ID_DST MKTAG('D','S','T',' ')
66#define ID_DSTC MKTAG('D','S','T','C')
67#define ID_DSTF MKTAG('D','S','T','F')
68#define ID_FRTE MKTAG('F','R','T','E')
69#define ID_ANIM MKTAG('A','N','I','M')
70#define ID_ANHD MKTAG('A','N','H','D')
71#define ID_DLTA MKTAG('D','L','T','A')
72#define ID_DPAN MKTAG('D','P','A','N')
74#define ID_FORM MKTAG('F','O','R','M')
75#define ID_FRM8 MKTAG('F','R','M','8')
76#define ID_ANNO MKTAG('A','N','N','O')
77#define ID_AUTH MKTAG('A','U','T','H')
78#define ID_CHRS MKTAG('C','H','R','S')
79#define ID_COPYRIGHT MKTAG('(','c',')',' ')
80#define ID_CSET MKTAG('C','S','E','T')
81#define ID_FVER MKTAG('F','V','E','R')
82#define ID_NAME MKTAG('N','A','M','E')
83#define ID_TEXT MKTAG('T','E','X','T')
84#define ID_ABIT MKTAG('A','B','I','T')
85#define ID_BODY MKTAG('B','O','D','Y')
86#define ID_DBOD MKTAG('D','B','O','D')
87#define ID_DPEL MKTAG('D','P','E','L')
88#define ID_DLOC MKTAG('D','L','O','C')
89#define ID_TVDC MKTAG('T','V','D','C')
103#define IFF_EXTRA_VIDEO_SIZE 41
135 const char *
const tag,
136 const unsigned data_size)
138 uint8_t *buf = ((data_size + 1) == 0) ?
NULL :
av_malloc(data_size + 1);
155 const uint8_t *d = p->buf;
180#define DSD_SLFT MKTAG('S','L','F','T')
181#define DSD_SRGT MKTAG('S','R','G','T')
182#define DSD_MLFT MKTAG('M','L','F','T')
183#define DSD_MRGT MKTAG('M','R','G','T')
184#define DSD_C MKTAG('C',' ',' ',' ')
185#define DSD_LS MKTAG('L','S',' ',' ')
186#define DSD_RS MKTAG('R','S',' ',' ')
187#define DSD_LFE MKTAG('L','F','E',' ')
211 "dsd_source_comment",
212 "analogue_source_comment",
213 "pcm_source_comment",
232 const char * metadata_tag =
NULL;
234 if (
size >= INT64_MAX)
238 case MKTAG(
'D',
'I',
'A',
'R'): metadata_tag =
"artist";
break;
239 case MKTAG(
'D',
'I',
'T',
'I'): metadata_tag =
"title";
break;
242 if (metadata_tag &&
size > 4) {
261 int hour,
min, sec,
i, ret, config;
270 if (
size >= INT64_MAX)
274 case MKTAG(
'A',
'B',
'S',
'S'):
284 case MKTAG(
'C',
'H',
'N',
'L'):
307 case MKTAG(
'C',
'M',
'P',
'R'):
319 case MKTAG(
'F',
'S',
' ',
' '):
325 case MKTAG(
'I',
'D',
'3',
' '):
327 if (id3v2_extra_meta) {
342 case MKTAG(
'L',
'S',
'C',
'O'):
346 if (config != 0xFFFF) {
368 uint64_t chunk_pos, data_pos, data_size;
371 if (
s->nb_streams < 1)
383 if (data_size < 1 || data_size >= INT64_MAX)
400 pkt->duration =
s->streams[0]->codecpar->sample_rate / 75;
401 pkt->pos = chunk_pos;
413 s->streams[0]->duration =
avio_rb32(pb) * (uint64_t)
s->streams[0]->codecpar->sample_rate / 75;
424static const uint8_t
deep_rgb24[] = {0, 0, 0, 3, 0, 1, 0, 8, 0, 2, 0, 8, 0, 3, 0, 8};
425static const uint8_t
deep_rgba[] = {0, 0, 0, 4, 0, 1, 0, 8, 0, 2, 0, 8, 0, 3, 0, 8};
426static const uint8_t
deep_bgra[] = {0, 0, 0, 4, 0, 3, 0, 8, 0, 2, 0, 8, 0, 1, 0, 8};
427static const uint8_t
deep_argb[] = {0, 0, 0, 4, 0,17, 0, 8, 0, 1, 0, 8, 0, 2, 0, 8};
428static const uint8_t
deep_abgr[] = {0, 0, 0, 4, 0,17, 0, 8, 0, 3, 0, 8, 0, 2, 0, 8};
437 (*index_ptr) = (*st_ptr)->index;
450 uint32_t screenmode = 0, num, den;
451 unsigned transparency = 0;
452 unsigned masking = 0;
472 const char *metadata_tag =
NULL;
478 if (data_size >= INT64_MAX)
489 if (data_size >= 16) {
559 if (data_size < 3 || data_size > 768 || data_size % 3) {
571 av_freep(&stv->codecpar->extradata);
572 stv->codecpar->extradata_size = 0;
585 stv->codecpar->bits_per_coded_sample =
avio_r8(pb);
590 if (data_size >= 14) {
594 if (data_size >= 16) {
595 stv->sample_aspect_ratio.num =
avio_r8(pb);
596 stv->sample_aspect_ratio.den =
avio_r8(pb);
611 if (data_size < 4 || (data_size & 3))
615 if ((fmt_size =
avio_read(pb, fmt,
sizeof(fmt))) < 0)
641 stv->sample_aspect_ratio.num =
avio_r8(pb);
642 stv->sample_aspect_ratio.den =
avio_r8(pb);
643 stv->codecpar->bits_per_coded_sample = 24;
656 if (data_size <
sizeof(iff->
tvdc))
663 case MKTAG(
'S',
'X',
'H',
'D'):
696 case ID_TEXT: metadata_tag =
"comment";
break;
697 case ID_AUTH: metadata_tag =
"artist";
break;
699 case ID_NAME: metadata_tag =
"title";
break;
703 case MKTAG(
'F',
'V',
'E',
'R'):
715 case MKTAG(
'D',
'I',
'I',
'N'):
723 case MKTAG(
'P',
'R',
'O',
'P'):
737 case MKTAG(
'C',
'O',
'M',
'T'):
743 for (
i = 0;
i < nb_comments;
i++) {
754 snprintf(
tmp,
sizeof(
tmp),
"%04d-%02d-%02d %02d:%02d", year, mon, day, hour,
min);
762 tag =
"channel_comment";
784 if (metadata_size & 1)
799 if ((!sta && !stv) ||
858 iff->
bpp = stv->codecpar->bits_per_coded_sample;
861 if ((screenmode & 0x800 ) && iff->
bpp <= 8) {
862 iff->
ham = iff->
bpp > 6 ? 6 : 4;
863 stv->codecpar->bits_per_coded_sample = 24;
865 iff->
flags = (screenmode & 0x80 ) && iff->
bpp <= 8;
869 if (!stv->codecpar->extradata) {
875 buf = stv->codecpar->extradata;
878 bytestream_put_byte(&buf, iff->
bpp);
879 bytestream_put_byte(&buf, iff->
ham);
880 bytestream_put_byte(&buf, iff->
flags);
882 bytestream_put_byte(&buf, iff->
masking);
885 stv->codecpar->codec_tag = iff->
form_tag;
898 unsigned chunk = bytestream2_get_le32(&gb);
899 unsigned size = bytestream2_get_be32(&gb);
905 return bytestream2_get_be32(&gb);
920 unsigned chunk = bytestream2_get_le32(&gb);
921 unsigned size = bytestream2_get_be32(&gb);
923 if (chunk ==
MKTAG(
'S',
'B',
'D',
'Y'))
972 uint64_t data_size, orig_pos;
973 uint32_t chunk_id, chunk_id2;
985 }
else if (chunk_id ==
ID_FORM &&
995 if (!data_size || data_size > INT_MAX)
1001 pkt->pos = orig_pos;
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
uint64_t avio_rb64(AVIOContext *s)
unsigned int avio_rb16(AVIOContext *s)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int avio_rl32(AVIOContext *s)
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static av_always_inline int bytestream2_tell(const GetByteContext *g)
#define i(width, name, range_min, range_max)
static int read_probe(const AVProbeData *p)
Public libavutil channel layout APIs header.
static int read_header(FFV1Context *f, RangeCoder *c)
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
@ AV_CODEC_ID_PCM_S16BE_PLANAR
@ AV_CODEC_ID_PCM_S8_PLANAR
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_MONO
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
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 AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define av_fourcc2str(fourcc)
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta, unsigned int max_search_size)
Read an ID3v2 tag, including supported extra metadata.
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata.
int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta *extra_meta)
Create a stream for each APIC (attached picture) extracted from the ID3v2 header.
int ff_id3v2_parse_chapters(AVFormatContext *s, ID3v2ExtraMeta *cur)
Create chapters for all CHAP tags found in the ID3v2 header.
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define MKTAG(a, b, c, d)
Memory handling functions.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
enum AVMediaType codec_type
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVChannelLayout ch_layout
The channel layout and number of channels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
int block_align
The number of bytes per coded audio frame, required by some formats.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
int eof_reached
true if was unable to read due to error or eof
This structure stores compressed data.
This structure contains the data a format has to probe a file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
const uint32_t * dsd_layout
unsigned transparency
transparency color index in palette
unsigned bitmap_compression
delta compression method used
unsigned flags
1 for EHB, 0 is no extra half darkening
unsigned maud_compression
uint8_t tvdc[32]
TVDC lookup table.
unsigned bpp
bits per plane to decode (differs from bits_per_coded_sample if HAM)
unsigned masking
masking method used
int is_64bit
chunk size is 64-bit
unsigned ham
0 if non-HAM or number of hold bits (6 for bpp > 6, 4 otherwise)
svx8_compression_type svx8_compression
#define avpriv_request_sample(...)
static int ref[MAX_W *MAX_W]