59 int waveformatextensible;
77 if (waveformatextensible)
100 "requested bits_per_coded_sample (%d) "
101 "and actually stored (%d) differ\n",
108 blkalign = 576 * (enc->
sample_rate <= (24000 + 32000)/2 ? 1 : 2);
135 bytestream_put_le16(&riff_extradata, 1);
136 bytestream_put_le32(&riff_extradata, 2);
137 bytestream_put_le16(&riff_extradata, 1152);
138 bytestream_put_le16(&riff_extradata, 1);
139 bytestream_put_le16(&riff_extradata, 1393);
142 bytestream_put_le16(&riff_extradata, 2);
144 bytestream_put_le32(&riff_extradata, enc->
bit_rate);
146 bytestream_put_le16(&riff_extradata, enc->
channels == 2 ? 1 : 8);
148 bytestream_put_le16(&riff_extradata, 0);
150 bytestream_put_le16(&riff_extradata, 1);
152 bytestream_put_le16(&riff_extradata, 16);
154 bytestream_put_le32(&riff_extradata, 0);
156 bytestream_put_le32(&riff_extradata, 0);
158 bytestream_put_le32(&riff_extradata, 0x9ace0002);
159 bytestream_put_le32(&riff_extradata, 0xaea2f732);
160 bytestream_put_le16(&riff_extradata, 0xacde);
164 bytestream_put_le16(&riff_extradata, frame_size);
170 if (waveformatextensible) {
174 avio_wl16(pb, riff_extradata - riff_extradata_start + 22);
190 riff_extradata - riff_extradata_start) {
192 avio_wl16(pb, riff_extradata - riff_extradata_start);
194 avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
206 const AVCodecTag *tags,
int for_asf,
int ignore_extradata)
213 avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size));
229 if (!ignore_extradata) {
232 if (!for_asf && extradata_size & 1)
238 int *au_ssize,
int *au_scale)
242 int audio_frame_size;
248 if (!audio_frame_size)
253 *au_scale = audio_frame_size;
265 gcd =
av_gcd(*au_scale, *au_rate);
272 size_t len = strlen(str);
273 if (len > 0 && len < UINT32_MAX) {
284 "IARL",
"IART",
"ICMS",
"ICMT",
"ICOP",
"ICRD",
"ICRP",
"IDIM",
"IDPI",
285 "IENG",
"IGNR",
"IKEY",
"ILGT",
"ILNG",
"IMED",
"INAM",
"IPLT",
"IPRD",
286 "IPRT",
"ITRK",
"ISBJ",
"ISFT",
"ISHP",
"ISMP",
"ISRC",
"ISRF",
"ITCH",
333 if (
id == av_guid[i].
id)
334 return &(av_guid[i].
guid);
void avio_wl16(AVIOContext *s, unsigned int val)
#define AV_LOG_WARNING
Something somehow does not look correct.
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags)
Write WAVEFORMAT header structure.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale)
const AVCodecGuid ff_codec_wav_guids[]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g)
void avio_wl32(AVIOContext *s, unsigned int val)
Opaque data information usually continuous.
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf, int ignore_extradata)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
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.
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)
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
const ff_asf_guid * ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
AVDictionary * metadata
Metadata that applies to the whole file.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
#define FF_COMPLIANCE_NORMAL
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.
Libavcodec external API header.
uint64_t channel_layout
Audio channel layout.
AVCodecContext * codec
Codec context associated with this stream.
int bit_rate
the average bitrate
int width
picture width / height.
void ff_end_tag(AVIOContext *pb, int64_t start)
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
Write a single RIFF info tag.
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
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
int sample_rate
samples per second
AVIOContext * pb
I/O context.
static const char riff_tags[][5]
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').
static int riff_has_valid_tags(AVFormatContext *s)
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
const AVMetadataConv ff_riff_info_conv[]
int channels
number of audio channels
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int strict_std_compliance
strictly follow the standard (MPEG4, ...).
#define FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX
Tell ff_put_wav_header() to use WAVEFORMATEX even for PCM codecs.