34 #define AIFF_C_VERSION1 0xA2805140
103 unsigned int num_frames;
114 if (exp <-63 || exp >63) {
119 sample_rate = val <<
exp;
121 sample_rate = (val + (1ULL<<(-exp-1))) >> -exp;
198 if (p->
buf[0] ==
'F' && p->
buf[1] ==
'O' &&
199 p->
buf[2] ==
'R' && p->
buf[3] ==
'M' &&
200 p->
buf[8] ==
'A' && p->
buf[9] ==
'I' &&
201 p->
buf[10] ==
'F' && (p->
buf[11] ==
'F' || p->
buf[11] ==
'C'))
210 int ret,
size, filesize;
211 int64_t
offset = 0, position;
221 if (filesize < 0 || tag !=
MKTAG(
'F',
'O',
'R',
'M'))
226 if (tag ==
MKTAG(
'A',
'I',
'F',
'F'))
228 else if (tag !=
MKTAG(
'A',
'I',
'F',
'C'))
237 while (filesize > 0) {
248 filesize -= size + 8;
251 case MKTAG(
'C',
'O',
'M',
'M'):
259 case MKTAG(
'I',
'D',
'3',
' '):
262 if (id3v2_extra_meta)
271 case MKTAG(
'F',
'V',
'E',
'R'):
274 case MKTAG(
'N',
'A',
'M',
'E'):
277 case MKTAG(
'A',
'U',
'T',
'H'):
280 case MKTAG(
'(',
'c',
')',
' '):
283 case MKTAG(
'A',
'N',
'N',
'O'):
286 case MKTAG(
'S',
'S',
'N',
'D'):
299 case MKTAG(
'w',
'a',
'v',
'e'):
300 if ((uint64_t)size > (1<<30))
324 case MKTAG(
'C',
'H',
'A',
'N'):
355 #define MAX_SIZE 4096
381 size =
FFMIN(max_size, size);
const char const char void * val
static int get_aiff_header(AVFormatContext *s, int size, unsigned version)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t bit_rate
the average bitrate
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
static int aiff_read_header(AVFormatContext *s)
unsigned int avio_rb16(AVIOContext *s)
int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
Create a stream for each APIC (attached picture) extracted from the ID3v2 header. ...
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
unsigned int avio_rb32(AVIOContext *s)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static int aiff_read_packet(AVFormatContext *s, AVPacket *pkt)
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
AVStream ** streams
A list of all streams in the file.
#define AVERROR_EOF
End of file.
uint64_t avio_rb64(AVIOContext *s)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
AVDictionary * metadata
Metadata that applies to the whole file.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata.
static void get_meta(AVFormatContext *s, const char *key, int size)
static enum AVCodecID aiff_codec_get_id(int bps)
static const uint8_t offset[127][2]
int flags
A combination of AV_PKT_FLAG values.
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
static int aiff_probe(AVProbeData *p)
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size)
Read 'chan' tag from the input stream.
static int read_header(FFV1Context *f)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int get_tag(AVIOContext *pb, uint32_t *tag)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
This structure contains the data a format has to probe a file.
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
int64_t duration
Decoding: duration of the stream, in stream time base.
AVInputFormat ff_aiff_demuxer
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
static const AVCodecTag ff_codec_aiff_tags[]
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 and chapters.
int64_t nb_frames
number of frames in this stream if known or 0
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
as in Berlin toast format
int channels
number of audio channels
void * priv_data
Format private data.
common header for AIFF muxer and demuxer
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
#define MKTAG(a, b, c, d)
This structure stores compressed data.