37 #define AU_UNKNOWN_SIZE ((uint32_t)(~0))
39 #define AU_DEFAULT_HEADER_SIZE (24+8)
62 if (p->
buf[0] ==
'.' && p->
buf[1] ==
's' &&
63 p->
buf[2] ==
'n' && p->
buf[3] ==
'd')
71 static const char * keys[] = {
79 enum { PARSE_KEY, PARSE_VALUE, PARSE_FINISHED }
state = PARSE_KEY;
93 state = PARSE_FINISHED;
94 }
else if (c ==
'=') {
103 if (c ==
'\0' || c ==
'\n') {
108 for (i = 0; keys[i] !=
NULL && key !=
NULL; i++) {
118 state = (c ==
'\0') ? PARSE_FINISHED : PARSE_KEY;
135 #define BLOCK_SIZE 1024
139 int size, data_size = 0;
142 unsigned int id, channels, rate;
148 if (tag !=
MKTAG(
'.',
's',
'n',
'd'))
164 au_read_annotation(s, size - 24);
176 if (
id ==
MKBETAG(
'7',
'2',
'6',
'2')) {
179 const uint8_t bpcss[] = {4, 0, 3, 5};
181 bps = bpcss[
id - 23];
188 if (channels == 0 || channels >= INT_MAX / (
BLOCK_SIZE * bps >> 3)) {
193 if (rate == 0 || rate > INT_MAX) {
221 .read_probe = au_probe,
222 .read_header = au_read_header,
232 typedef struct AUContext {
233 uint32_t header_size;
240 static const char * keys[] = {
255 for (i = 0; keys[i] !=
NULL; i++) {
276 char *annotations =
NULL;
292 ret = au_get_annotations(s, &annotations);
295 if (annotations !=
NULL) {
296 au->header_size = (24 + strlen(annotations) + 8) & ~7;
307 if (annotations !=
NULL) {
308 avio_write(pb, annotations, au->header_size - 24);
324 if (s->
pb->
seekable && file_size < INT32_MAX) {
327 avio_wb32(pb, (uint32_t)(file_size - au->header_size));
338 .mime_type =
"audio/basic",
340 .priv_data_size =
sizeof(AUContext),
void avio_wb64(AVIOContext *s, uint64_t val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
This struct describes the properties of an encoded stream.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
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.
#define AV_BPRINT_SIZE_UNLIMITED
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 av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
enum AVMediaType codec_type
General type of the encoded data.
simple assert() macros that are a bit more flexible than ISO C assert().
int avio_r8(AVIOContext *s)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int block_align
Audio only.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
GLsizei GLboolean const GLfloat * value
static int write_trailer(AVFormatContext *s1)
static const AVCodecTag codec_au_tags[]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AU_DEFAULT_HEADER_SIZE
AVIOContext * pb
I/O context.
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.
int64_t duration
Decoding: duration of the stream, in stream time base.
int sample_rate
Audio only.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
#define MKBETAG(a, b, c, d)
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
void avio_wb32(AVIOContext *s, unsigned int val)
AVCodecParameters * codecpar
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
#define MKTAG(a, b, c, d)
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.