350 {
"IART",
"artist" },
351 {
"ICMT",
"comment" },
352 {
"ICOP",
"copyright" },
355 {
"ILNG",
"language" },
359 {
"ISFT",
"encoder" },
360 {
"ITCH",
"encoded_by"},
388 int waveformatextensible;
391 uint8_t *riff_extradata_start= temp;
407 if (waveformatextensible) {
454 bytestream_put_le16(&riff_extradata, 1);
455 bytestream_put_le32(&riff_extradata, 2);
456 bytestream_put_le16(&riff_extradata, 1152);
457 bytestream_put_le16(&riff_extradata, 1);
458 bytestream_put_le16(&riff_extradata, 1393);
461 bytestream_put_le16(&riff_extradata, 2);
462 bytestream_put_le32(&riff_extradata, enc->
bit_rate);
463 bytestream_put_le16(&riff_extradata, enc->
channels == 2 ? 1 : 8);
464 bytestream_put_le16(&riff_extradata, 0);
465 bytestream_put_le16(&riff_extradata, 1);
466 bytestream_put_le16(&riff_extradata, 16);
467 bytestream_put_le32(&riff_extradata, 0);
468 bytestream_put_le32(&riff_extradata, 0);
471 bytestream_put_le16(&riff_extradata, frame_size);
477 if(waveformatextensible) {
479 avio_wl16(pb, riff_extradata - riff_extradata_start + 22);
487 avio_wl16(pb, riff_extradata - riff_extradata_start);
489 avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
525 int audio_frame_size;
531 if (!audio_frame_size)
536 *au_scale = audio_frame_size;
547 gcd=
av_gcd(*au_scale, *au_rate);
554 int len = strlen(str);
565 static const char riff_tags[][5] = {
566 "IARL",
"IART",
"ICMS",
"ICMT",
"ICOP",
"ICRD",
"ICRP",
"IDIM",
"IDPI",
567 "IENG",
"IGNR",
"IKEY",
"ILGT",
"ILNG",
"IMED",
"INAM",
"IPLT",
"IPRD",
568 "IPRT",
"ISBJ",
"ISFT",
"ISHP",
"ISRC",
"ISRF",
"ITCH",
576 for (i = 0; *riff_tags[i]; i++) {
594 if (!riff_has_valid_tags(s))
599 for (i = 0; *riff_tags[i]; i++) {
605 #endif //CONFIG_MUXERS
633 cbSize =
FFMIN(size, cbSize);
634 if (cbSize >= 22 &&
id == 0xfffe) {
711 int64_t start, end, cur;
717 while ((cur =
avio_tell(pb)) >= 0 && cur <= end - 8 ) {
726 if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) {
731 chunk_size += (chunk_size & 1);
751 if (
avio_read(pb, value, chunk_size) != chunk_size) {
757 value[chunk_size] = 0;
764 #endif // CONFIG_DEMUXERS
int ff_read_riff_info(AVFormatContext *s, int64_t size)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void avio_wl16(AVIOContext *s, unsigned int val)
#define AV_DICT_MATCH_CASE
void ff_end_tag(AVIOContext *pb, int64_t start)
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void avio_wl32(AVIOContext *s, unsigned int val)
Opaque data information usually continuous.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define MKTAG(a, b, c, d)
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).
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
#define AV_DICT_DONT_STRDUP_VAL
static const uint8_t frame_size[4]
AVCodecID
Identify the syntax and semantics of the bitstream.
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(). ...
unsigned int avio_rl32(AVIOContext *s)
int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
Write a single RIFF info tag.
preferred ID for decoding MPEG audio layer 1, 2 or 3
int64_t av_gcd(int64_t a, int64_t b)
Return the greatest common divisor of a and b.
void av_log(void *avcl, int level, const char *fmt,...)
const AVCodecTag ff_codec_wav_tags[]
uint64_t channel_layout
Audio channel layout.
AVCodecContext * codec
Codec context associated with this stream.
int bit_rate
the average bitrate
const AVCodecTag ff_codec_bmp_tags[]
int width
picture width / height.
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
preferred ID for MPEG-1/2 video decoding
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
int frame_size
Number of samples per channel in an audio frame.
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
void avio_w8(AVIOContext *s, int b)
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.
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
#define FF_INPUT_BUFFER_PADDING_SIZE
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf)
const AVMetadataConv ff_riff_info_conv[]
unsigned int avio_rl16(AVIOContext *s)
enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps)
#define AVERROR_INVALIDDATA
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
int eof_reached
true if eof reached
int channels
number of audio channels
int ff_get_bmp_header(AVIOContext *pb, AVStream *st)
Read BITMAPINFOHEADER structure and set AVStream codec width, height and bits_per_encoded_sample fiel...
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...