60 int waveformatextensible;
62 uint8_t *riff_extradata =
temp;
63 uint8_t *riff_extradata_start =
temp;
86 if (waveformatextensible)
110 "requested bits_per_coded_sample (%d) "
111 "and actually stored (%d) differ\n",
118 blkalign = 576 * (par->
sample_rate <= (24000 + 32000)/2 ? 1 : 2);
153 bytestream_put_le16(&riff_extradata, 1);
154 bytestream_put_le32(&riff_extradata, 2);
155 bytestream_put_le16(&riff_extradata, 1152);
156 bytestream_put_le16(&riff_extradata, 1);
157 bytestream_put_le16(&riff_extradata, 1393);
160 bytestream_put_le16(&riff_extradata, 2);
162 bytestream_put_le32(&riff_extradata, par->
bit_rate);
166 bytestream_put_le16(&riff_extradata, 0);
168 bytestream_put_le16(&riff_extradata, 1);
170 bytestream_put_le16(&riff_extradata, 16);
172 bytestream_put_le32(&riff_extradata, 0);
174 bytestream_put_le32(&riff_extradata, 0);
176 bytestream_put_le32(&riff_extradata, 0x9ace0002);
177 bytestream_put_le32(&riff_extradata, 0xaea2f732);
178 bytestream_put_le16(&riff_extradata, 0xacde);
182 bytestream_put_le16(&riff_extradata,
frame_size);
188 if (waveformatextensible) {
193 avio_wl16(pb, riff_extradata - riff_extradata_start + 22);
209 riff_extradata - riff_extradata_start) {
223 avio_wl16(pb, riff_extradata - riff_extradata_start);
225 avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
237 int for_asf,
int ignore_extradata,
int rgb_frame_is_flipped)
241 int keep_height = flipped_extradata || rgb_frame_is_flipped;
248 pal_avi = !for_asf &&
254 avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size));
275 if (!ignore_extradata) {
278 if (!for_asf && extradata_size & 1)
280 }
else if (pal_avi) {
296 int *au_ssize,
int *au_scale)
300 int audio_frame_size;
303 if (!audio_frame_size)
308 *au_scale = audio_frame_size;
320 gcd =
av_gcd(*au_scale, *au_rate);
327 size_t len = strlen(str);
328 if (
len > 0 &&
len < UINT32_MAX) {
339 "IARL",
"IART",
"IAS1",
"IAS2",
"IAS3",
"IAS4",
"IAS5",
"IAS6",
"IAS7",
340 "IAS8",
"IAS9",
"ICMS",
"ICMT",
"ICOP",
"ICRD",
"ICRP",
"IDIM",
"IDPI",
341 "IENG",
"IGNR",
"IKEY",
"ILGT",
"ILNG",
"IMED",
"INAM",
"IPLT",
"IPRD",
342 "IPRT",
"ITRK",
"ISBJ",
"ISFT",
"ISHP",
"ISMP",
"ISRC",
"ISRF",
"ITCH",
389 if (
id == av_guid[
i].
id)
390 return &(av_guid[
i].
guid);
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
void avio_wl32(AVIOContext *s, unsigned int val)
void avio_wl16(AVIOContext *s, unsigned int val)
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
void avio_w8(AVIOContext *s, int b)
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)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
#define FF_COMPLIANCE_NORMAL
static enum AVPixelFormat pix_fmt
static const uint8_t frame_size[4]
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
AVCodecID
Identify the syntax and semantics of the bitstream.
@ AV_CODEC_ID_ADPCM_IMA_WAV
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
#define AV_CHANNEL_LAYOUT_STEREO
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
#define AV_CHANNEL_LAYOUT_MONO
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
const AVCodecGuid ff_codec_wav_guids[]
const AVMetadataConv ff_riff_info_conv[]
internal header for RIFF based (de)muxers do NOT include this in end user applications
#define FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX
Tell ff_put_wav_header() to use WAVEFORMATEX even for PCM codecs.
#define FF_PUT_WAV_HEADER_SKIP_CHANNELMASK
Tell ff_put_wav_header() to write an empty channel mask.
void ff_end_tag(AVIOContext *pb, int64_t start)
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
Write a single RIFF info tag.
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
static const char riff_tags[][5]
void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, int for_asf, int ignore_extradata, int rgb_frame_is_flipped)
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
const ff_asf_guid * ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale)
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags)
Write WAVEFORMAT header structure.
static int riff_has_valid_tags(AVFormatContext *s)
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g)
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannelOrder order
Channel order used in this layout.
uint64_t mask
This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC ...
union AVChannelLayout::@162063043056170047076125117143030261346263330336 u
Details about which channels are present in this layout.
int nb_channels
Number of channels in this layout.
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
int frame_size
Audio frame size, if known.
int height
The height of the video frame in pixels.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
int block_align
The number of bytes per coded audio frame, required by some formats.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.