22 #include "libavutil/dict.h"
23 #include "libavutil/log.h"
24 #include "libavutil/mathematics.h"
25 #include "libavcodec/avcodec.h"
58 int waveformatextensible;
77 if (waveformatextensible)
100 "requested bits_per_coded_sample (%d) "
101 "and actually stored (%d) differ\n",
138 bytestream_put_le16(&riff_extradata, 1);
139 bytestream_put_le32(&riff_extradata, 2);
140 bytestream_put_le16(&riff_extradata, 1152);
141 bytestream_put_le16(&riff_extradata, 1);
142 bytestream_put_le16(&riff_extradata, 1393);
146 bytestream_put_le16(&riff_extradata, 2);
148 bytestream_put_le32(&riff_extradata, enc->
bit_rate);
150 bytestream_put_le16(&riff_extradata, enc->
channels == 2 ? 1 : 8);
152 bytestream_put_le16(&riff_extradata, 0);
154 bytestream_put_le16(&riff_extradata, 1);
156 bytestream_put_le16(&riff_extradata, 16);
158 bytestream_put_le32(&riff_extradata, 0);
160 bytestream_put_le32(&riff_extradata, 0);
163 bytestream_put_le32(&riff_extradata, 0x9ace0002);
164 bytestream_put_le32(&riff_extradata, 0xaea2f732);
165 bytestream_put_le16(&riff_extradata, 0xacde);
170 bytestream_put_le16(&riff_extradata, frame_size);
177 if (waveformatextensible) {
180 avio_wl16(pb, riff_extradata - riff_extradata_start + 22);
191 avio_wl16(pb, riff_extradata - riff_extradata_start);
193 avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
230 int *au_ssize,
int *au_scale)
233 int audio_frame_size;
239 if (!audio_frame_size)
244 *au_scale = audio_frame_size;
256 gcd =
av_gcd(*au_scale, *au_rate);
263 int len = strlen(str);
275 "IARL",
"IART",
"ICMS",
"ICMT",
"ICOP",
"ICRD",
"ICRP",
"IDIM",
"IDPI",
276 "IENG",
"IGNR",
"IKEY",
"ILGT",
"ILNG",
"IMED",
"INAM",
"IPLT",
"IPRD",
277 "IPRT",
"ITRK",
"ISBJ",
"ISFT",
"ISHP",
"ISMP",
"ISRC",
"ISRF",
"ITCH",
void ff_end_tag(AVIOContext *pb, int64_t start)
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
#define AV_LOG_WARNING
Something somehow does not look correct.
void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale)
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
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...
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.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
static const uint8_t frame_size[4]
#define AV_DICT_MATCH_CASE
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
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_const av_gcd(int64_t a, int64_t b)
Return the greatest common divisor of a and b.
uint64_t channel_layout
Audio channel layout.
int bit_rate
the average bitrate
Opaque data information usually continuous.
int width
picture width / height.
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
int frame_size
Number of samples per channel in an audio frame.
enum AVMediaType codec_type
int sample_rate
samples per second
static const char riff_tags[][5]
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static int riff_has_valid_tags(AVFormatContext *s)
AVIOContext * pb
I/O context.
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
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[]
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
int channels
number of audio channels
#define av_assert0(cond)
assert() equivalent, that is always enabled.