22 #include "libavutil/intreadwrite.h"
23 #include "libavutil/mathematics.h"
24 #include "libavutil/dict.h"
34 #define AIFF_C_VERSION1 0xA2805140
103 unsigned int num_frames;
114 sample_rate = ldexp(val, exp - 16383 - 63);
182 if (p->
buf[0] ==
'F' && p->
buf[1] ==
'O' &&
183 p->
buf[2] ==
'R' && p->
buf[3] ==
'M' &&
184 p->
buf[8] ==
'A' && p->
buf[9] ==
'I' &&
185 p->
buf[10] ==
'F' && (p->
buf[11] ==
'F' || p->
buf[11] ==
'C'))
195 int64_t
offset = 0, position;
205 if (filesize < 0 || tag !=
MKTAG(
'F',
'O',
'R',
'M'))
210 if (tag ==
MKTAG(
'A',
'I',
'F',
'F'))
212 else if (tag !=
MKTAG(
'A',
'I',
'F',
'C'))
221 while (filesize > 0) {
227 filesize -= size + 8;
230 case MKTAG(
'C',
'O',
'M',
'M'):
238 case MKTAG(
'I',
'D',
'3',
' '):
241 if (id3v2_extra_meta)
250 case MKTAG(
'F',
'V',
'E',
'R'):
253 case MKTAG(
'N',
'A',
'M',
'E'):
256 case MKTAG(
'A',
'U',
'T',
'H'):
259 case MKTAG(
'(',
'c',
')',
' '):
262 case MKTAG(
'A',
'N',
'N',
'O'):
265 case MKTAG(
'S',
'S',
'N',
'D'):
278 case MKTAG(
'w',
'a',
'v',
'e'):
279 if ((uint64_t)size > (1<<30))
304 case MKTAG(
'C',
'H',
'A',
'N'):
332 #define MAX_SIZE 4096
352 size =
FFMIN(max_size, size);
const char const char void * val
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
AVCodecContext * codec
Codec context associated with this stream.
#define ID3v2_DEFAULT_MAGIC
Default magic bytes for ID3v2 header: "ID3".
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static int aiff_read_header(AVFormatContext *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...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static const uint8_t offset[511][2]
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
static int aiff_read_packet(AVFormatContext *s, AVPacket *pkt)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
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.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void * priv_data
Format private data.
#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)
int flags
A combination of AV_PKT_FLAG values.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int bit_rate
the average bitrate
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() and chilren.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
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.
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta)
Read an ID3v2 tag, including supported extra metadata.
static int read_header(FFV1Context *f)
static int get_tag(AVIOContext *pb, uint32_t *tag)
enum AVMediaType codec_type
int sample_rate
samples per second
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
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 MKTAG(a, b, c, d)
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[]
int64_t nb_frames
number of frames in this stream if known or 0
static unsigned int get_aiff_header(AVFormatContext *s, int size, unsigned version)
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
#define AVERROR_INVALIDDATA
as in Berlin toast format
int channels
number of audio channels
common header for AIFF muxer and demuxer
This structure stores compressed data.