FFmpeg
riffenc.c
Go to the documentation of this file.
1 /*
2  * RIFF muxing functions
3  * Copyright (c) 2000 Fabrice Bellard
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
23 #include "libavutil/dict.h"
24 #include "libavutil/log.h"
25 #include "libavutil/mathematics.h"
26 #include "libavcodec/avcodec.h"
27 #include "libavcodec/bytestream.h"
28 #include "avformat.h"
29 #include "avio_internal.h"
30 #include "riff.h"
31 
32 int64_t ff_start_tag(AVIOContext *pb, const char *tag)
33 {
34  ffio_wfourcc(pb, tag);
35  avio_wl32(pb, -1);
36  return avio_tell(pb);
37 }
38 
39 void ff_end_tag(AVIOContext *pb, int64_t start)
40 {
41  int64_t pos;
42 
43  av_assert0((start&1) == 0);
44 
45  pos = avio_tell(pb);
46  if (pos & 1)
47  avio_w8(pb, 0);
48  avio_seek(pb, start - 4, SEEK_SET);
49  avio_wl32(pb, (uint32_t)(pos - start));
50  avio_seek(pb, FFALIGN(pos, 2), SEEK_SET);
51 }
52 
53 /* WAVEFORMATEX header */
54 /* returns the size or -1 on error */
56  AVCodecParameters *par, int flags)
57 {
58  int bps, blkalign, bytespersec, frame_size;
59  int hdrsize;
60  int64_t hdrstart = avio_tell(pb);
61  int waveformatextensible;
62  uint8_t temp[256];
63  uint8_t *riff_extradata = temp;
64  uint8_t *riff_extradata_start = temp;
65 
66  if (!par->codec_tag || par->codec_tag > 0xffff)
67  return -1;
68 
69  if (par->codec_id == AV_CODEC_ID_ADPCM_SWF && par->block_align == 0) {
70  av_log(s, AV_LOG_ERROR, "%s can only be written to WAVE with a constant frame size\n",
72  return AVERROR(EINVAL);
73  }
74 
75  /* We use the known constant frame size for the codec if known, otherwise
76  * fall back on using AVCodecContext.frame_size, which is not as reliable
77  * for indicating packet duration. */
79 
80  waveformatextensible = (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE &&
83  par->sample_rate > 48000 ||
86 
87  if (waveformatextensible)
88  avio_wl16(pb, 0xfffe);
89  else
90  avio_wl16(pb, par->codec_tag);
91 
93  avio_wl32(pb, par->sample_rate);
94  if (par->codec_id == AV_CODEC_ID_ATRAC3 ||
95  par->codec_id == AV_CODEC_ID_G723_1 ||
96  par->codec_id == AV_CODEC_ID_MP2 ||
97  par->codec_id == AV_CODEC_ID_MP3 ||
98  par->codec_id == AV_CODEC_ID_GSM_MS) {
99  bps = 0;
100  } else {
101  if (!(bps = av_get_bits_per_sample(par->codec_id))) {
102  if (par->bits_per_coded_sample)
103  bps = par->bits_per_coded_sample;
104  else
105  bps = 16; // default to 16
106  }
107  }
108  if (bps != par->bits_per_coded_sample && par->bits_per_coded_sample) {
110  "requested bits_per_coded_sample (%d) "
111  "and actually stored (%d) differ\n",
112  par->bits_per_coded_sample, bps);
113  }
114 
115  if (par->codec_id == AV_CODEC_ID_MP2) {
116  blkalign = (144 * par->bit_rate - 1)/par->sample_rate + 1;
117  } else if (par->codec_id == AV_CODEC_ID_MP3) {
118  blkalign = 576 * (par->sample_rate <= (24000 + 32000)/2 ? 1 : 2);
119  } else if (par->codec_id == AV_CODEC_ID_AC3) {
120  blkalign = 3840; /* maximum bytes per frame */
121  } else if (par->codec_id == AV_CODEC_ID_AAC) {
122  blkalign = 768 * par->ch_layout.nb_channels; /* maximum bytes per frame */
123  } else if (par->codec_id == AV_CODEC_ID_G723_1) {
124  blkalign = 24;
125  } else if (par->block_align != 0) { /* specified by the codec */
126  blkalign = par->block_align;
127  } else
128  blkalign = bps * par->ch_layout.nb_channels / av_gcd(8, bps);
129  if (par->codec_id == AV_CODEC_ID_PCM_U8 ||
135  bytespersec = par->sample_rate * blkalign;
136  } else if (par->codec_id == AV_CODEC_ID_G723_1) {
137  bytespersec = 800;
138  } else {
139  bytespersec = par->bit_rate / 8;
140  }
141  avio_wl32(pb, bytespersec); /* bytes per second */
142  avio_wl16(pb, blkalign); /* block align */
143  avio_wl16(pb, bps); /* bits per sample */
144  if (par->codec_id == AV_CODEC_ID_MP3) {
145  bytestream_put_le16(&riff_extradata, 1); /* wID */
146  bytestream_put_le32(&riff_extradata, 2); /* fdwFlags */
147  bytestream_put_le16(&riff_extradata, 1152); /* nBlockSize */
148  bytestream_put_le16(&riff_extradata, 1); /* nFramesPerBlock */
149  bytestream_put_le16(&riff_extradata, 1393); /* nCodecDelay */
150  } else if (par->codec_id == AV_CODEC_ID_MP2) {
151  /* fwHeadLayer */
152  bytestream_put_le16(&riff_extradata, 2);
153  /* dwHeadBitrate */
154  bytestream_put_le32(&riff_extradata, par->bit_rate);
155  /* fwHeadMode */
156  bytestream_put_le16(&riff_extradata, par->ch_layout.nb_channels == 2 ? 1 : 8);
157  /* fwHeadModeExt */
158  bytestream_put_le16(&riff_extradata, 0);
159  /* wHeadEmphasis */
160  bytestream_put_le16(&riff_extradata, 1);
161  /* fwHeadFlags */
162  bytestream_put_le16(&riff_extradata, 16);
163  /* dwPTSLow */
164  bytestream_put_le32(&riff_extradata, 0);
165  /* dwPTSHigh */
166  bytestream_put_le32(&riff_extradata, 0);
167  } else if (par->codec_id == AV_CODEC_ID_G723_1) {
168  bytestream_put_le32(&riff_extradata, 0x9ace0002); /* extradata needed for msacm g723.1 codec */
169  bytestream_put_le32(&riff_extradata, 0xaea2f732);
170  bytestream_put_le16(&riff_extradata, 0xacde);
171  } else if (par->codec_id == AV_CODEC_ID_GSM_MS ||
173  /* wSamplesPerBlock */
174  bytestream_put_le16(&riff_extradata, frame_size);
175  } else if (par->extradata_size) {
176  riff_extradata_start = par->extradata;
177  riff_extradata = par->extradata + par->extradata_size;
178  }
179  /* write WAVEFORMATEXTENSIBLE extensions */
180  if (waveformatextensible) {
181  int write_channel_mask = !(flags & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) &&
182  (s->strict_std_compliance < FF_COMPLIANCE_NORMAL ||
183  par->ch_layout.u.mask < 0x40000);
184  /* 22 is WAVEFORMATEXTENSIBLE size */
185  avio_wl16(pb, riff_extradata - riff_extradata_start + 22);
186  /* ValidBitsPerSample || SamplesPerBlock || Reserved */
187  avio_wl16(pb, bps);
188  /* dwChannelMask */
189  avio_wl32(pb, write_channel_mask ? par->ch_layout.u.mask : 0);
190  /* GUID + next 3 */
191  if (par->codec_id == AV_CODEC_ID_EAC3 || par->codec_id == AV_CODEC_ID_DFPWM) {
193  } else {
194  avio_wl32(pb, par->codec_tag);
195  avio_wl32(pb, 0x00100000);
196  avio_wl32(pb, 0xAA000080);
197  avio_wl32(pb, 0x719B3800);
198  }
200  par->codec_tag != 0x0001 /* PCM */ ||
201  riff_extradata - riff_extradata_start) {
202  /* WAVEFORMATEX */
203  avio_wl16(pb, riff_extradata - riff_extradata_start); /* cbSize */
204  } /* else PCMWAVEFORMAT */
205  avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
206  hdrsize = avio_tell(pb) - hdrstart;
207  if (hdrsize & 1) {
208  hdrsize++;
209  avio_w8(pb, 0);
210  }
211 
212  return hdrsize;
213 }
214 
215 /* BITMAPINFOHEADER header */
217  int for_asf, int ignore_extradata, int rgb_frame_is_flipped)
218 {
219  int flipped_extradata = (par->extradata_size >= 9 &&
220  !memcmp(par->extradata + par->extradata_size - 9, "BottomUp", 9));
221  int keep_height = flipped_extradata || rgb_frame_is_flipped;
222  int extradata_size = par->extradata_size - 9*flipped_extradata;
223  enum AVPixelFormat pix_fmt = par->format;
224  int pal_avi;
225 
226  if (pix_fmt == AV_PIX_FMT_NONE && par->bits_per_coded_sample == 1)
228  pal_avi = !for_asf &&
229  (pix_fmt == AV_PIX_FMT_PAL8 ||
232 
233  /* Size (not including the size of the color table or color masks) */
234  avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size));
235  avio_wl32(pb, par->width);
236  //We always store RGB TopDown
237  avio_wl32(pb, par->codec_tag || keep_height ? par->height : -par->height);
238  /* planes */
239  avio_wl16(pb, 1);
240  /* depth */
242  /* compression type */
243  avio_wl32(pb, par->codec_tag);
244  avio_wl32(pb, (par->width * par->height * (par->bits_per_coded_sample ? par->bits_per_coded_sample : 24)+7) / 8);
245  avio_wl32(pb, 0);
246  avio_wl32(pb, 0);
247  /* Number of color indices in the color table that are used.
248  * A value of 0 means 2^biBitCount indices, but this doesn't work
249  * with Windows Media Player and files containing xxpc chunks. */
250  avio_wl32(pb, pal_avi ? 1 << par->bits_per_coded_sample : 0);
251  avio_wl32(pb, 0);
252 
253  if (!ignore_extradata) {
254  if (par->extradata_size) {
255  avio_write(pb, par->extradata, extradata_size);
256  if (!for_asf && extradata_size & 1)
257  avio_w8(pb, 0);
258  } else if (pal_avi) {
259  int i;
260  for (i = 0; i < 1 << par->bits_per_coded_sample; i++) {
261  /* Initialize 1 bpp palette to black & white */
262  if (i == 0 && pix_fmt == AV_PIX_FMT_MONOWHITE)
263  avio_wl32(pb, 0xffffff);
264  else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK)
265  avio_wl32(pb, 0xffffff);
266  else
267  avio_wl32(pb, 0);
268  }
269  }
270  }
271 }
272 
273 void ff_parse_specific_params(AVStream *st, int *au_rate,
274  int *au_ssize, int *au_scale)
275 {
276  AVCodecParameters *par = st->codecpar;
277  int gcd;
278  int audio_frame_size;
279 
280  audio_frame_size = av_get_audio_frame_duration2(par, 0);
281  if (!audio_frame_size)
282  audio_frame_size = par->frame_size;
283 
284  *au_ssize = par->block_align;
285  if (audio_frame_size && par->sample_rate) {
286  *au_scale = audio_frame_size;
287  *au_rate = par->sample_rate;
288  } else if (par->codec_type == AVMEDIA_TYPE_VIDEO ||
289  par->codec_type == AVMEDIA_TYPE_DATA ||
291  *au_scale = st->time_base.num;
292  *au_rate = st->time_base.den;
293  } else {
294  *au_scale = par->block_align ? par->block_align * 8 : 8;
295  *au_rate = par->bit_rate ? par->bit_rate :
296  8 * par->sample_rate;
297  }
298  gcd = av_gcd(*au_scale, *au_rate);
299  *au_scale /= gcd;
300  *au_rate /= gcd;
301 }
302 
303 void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
304 {
305  size_t len = strlen(str);
306  if (len > 0 && len < UINT32_MAX) {
307  len++;
308  ffio_wfourcc(pb, tag);
309  avio_wl32(pb, len);
310  avio_put_str(pb, str);
311  if (len & 1)
312  avio_w8(pb, 0);
313  }
314 }
315 
316 static const char riff_tags[][5] = {
317  "IARL", "IART", "IAS1", "IAS2", "IAS3", "IAS4", "IAS5", "IAS6", "IAS7",
318  "IAS8", "IAS9", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI",
319  "IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD",
320  "IPRT", "ITRK", "ISBJ", "ISFT", "ISHP", "ISMP", "ISRC", "ISRF", "ITCH",
321  { 0 }
322 };
323 
325 {
326  int i;
327 
328  for (i = 0; *riff_tags[i]; i++)
329  if (av_dict_get(s->metadata, riff_tags[i], NULL, AV_DICT_MATCH_CASE))
330  return 1;
331 
332  return 0;
333 }
334 
336 {
337  AVIOContext *pb = s->pb;
338  int i;
339  int64_t list_pos;
340  AVDictionaryEntry *t = NULL;
341 
343 
344  /* writing empty LIST is not nice and may cause problems */
345  if (!riff_has_valid_tags(s))
346  return;
347 
348  list_pos = ff_start_tag(pb, "LIST");
349  ffio_wfourcc(pb, "INFO");
350  for (i = 0; *riff_tags[i]; i++)
351  if ((t = av_dict_get(s->metadata, riff_tags[i],
353  ff_riff_write_info_tag(s->pb, t->key, t->value);
354  ff_end_tag(pb, list_pos);
355 }
356 
358 {
359  av_assert0(sizeof(*g) == 16);
360  avio_write(s, *g, sizeof(*g));
361 }
362 
363 const ff_asf_guid *ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
364 {
365  int i;
366  for (i = 0; av_guid[i].id != AV_CODEC_ID_NONE; i++) {
367  if (id == av_guid[i].id)
368  return &(av_guid[i].guid);
369  }
370  return NULL;
371 }
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:318
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:75
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:430
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:57
ffio_wfourcc
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
Definition: avio_internal.h:116
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:53
ff_parse_specific_params
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale)
Definition: riffenc.c:273
AV_PIX_FMT_MONOWHITE
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:75
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:353
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:354
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:65
mathematics.h
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:295
AVChannelLayout::mask
uint64_t mask
This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC ...
Definition: channel_layout.h:322
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:300
ff_put_guid
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g)
Definition: riffenc.c:357
av_gcd
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
Definition: mathematics.c:37
av_get_audio_frame_duration2
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters in...
Definition: utils.c:832
avio_wl16
void avio_wl16(AVIOContext *s, unsigned int val)
Definition: aviobuf.c:466
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:505
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:428
AVRational::num
int num
Numerator.
Definition: rational.h:59
AV_CODEC_ID_ATRAC3
@ AV_CODEC_ID_ATRAC3
Definition: codec_id.h:458
av_get_bits_per_sample
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:586
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
ff_get_codec_guid
const ff_asf_guid * ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
Definition: riffenc.c:363
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:112
AVCodecParameters::frame_size
int frame_size
Audio only.
Definition: codec_par.h:188
av_dict_get
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:40
s
#define s(width, name)
Definition: cbs_vp9.c:256
g
const char * g
Definition: vf_curves.c:117
AVDictionaryEntry::key
char * key
Definition: dict.h:80
frame_size
int frame_size
Definition: mxfenc.c:2201
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:127
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition: codec_id.h:427
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demuxing_decoding.c:41
AVMEDIA_TYPE_DATA
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
Definition: avutil.h:203
ff_riff_write_info
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
Definition: riffenc.c:335
AVFormatContext
Format I/O context.
Definition: avformat.h:1213
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
AVChannelLayout::u
union AVChannelLayout::@296 u
Details about which channels are present in this layout.
AVStream::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avformat.h:978
NULL
#define NULL
Definition: coverity.c:32
ff_asf_guid
uint8_t ff_asf_guid[16]
Definition: riff.h:95
ff_put_bmp_header
void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, int for_asf, int ignore_extradata, int rgb_frame_is_flipped)
Definition: riffenc.c:216
AV_PIX_FMT_MONOBLACK
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:76
AV_CODEC_ID_G723_1
@ AV_CODEC_ID_G723_1
Definition: codec_id.h:479
av_channel_layout_compare
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
Definition: channel_layout.c:930
avio_w8
void avio_w8(AVIOContext *s, int b)
Definition: aviobuf.c:210
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:212
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:177
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:47
AV_CODEC_ID_EAC3
@ AV_CODEC_ID_EAC3
Definition: codec_id.h:467
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:79
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:429
AVIOContext
Bytestream IO Context.
Definition: avio.h:162
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:330
ff_end_tag
void ff_end_tag(AVIOContext *pb, int64_t start)
Definition: riffenc.c:39
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:290
AVCodecGuid::id
enum AVCodecID id
Definition: riff.h:98
bps
unsigned bps
Definition: movenc.c:1647
AV_CODEC_ID_ADPCM_SWF
@ AV_CODEC_ID_ADPCM_SWF
Definition: codec_id.h:370
AVCodecGuid
Definition: riff.h:97
FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX
#define FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX
Tell ff_put_wav_header() to use WAVEFORMATEX even for PCM codecs.
Definition: riff.h:53
ff_riff_info_conv
const AVMetadataConv ff_riff_info_conv[]
Definition: riff.c:609
FF_PUT_WAV_HEADER_SKIP_CHANNELMASK
#define FF_PUT_WAV_HEADER_SKIP_CHANNELMASK
Tell ff_put_wav_header() to write an empty channel mask.
Definition: riff.h:58
ff_riff_write_info_tag
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
Write a single RIFF info tag.
Definition: riffenc.c:303
avio_write
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Definition: aviobuf.c:232
avio_wl32
void avio_wl32(AVIOContext *s, unsigned int val)
Definition: aviobuf.c:386
FF_COMPLIANCE_NORMAL
#define FF_COMPLIANCE_NORMAL
Definition: avcodec.h:1303
avcodec_get_name
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:447
riff_tags
static const char riff_tags[][5]
Definition: riffenc.c:316
log.h
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:48
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
avio_internal.h
ff_start_tag
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
Definition: riffenc.c:32
AVCodecParameters::height
int height
Definition: codec_par.h:128
AVCodecParameters::block_align
int block_align
Audio only.
Definition: codec_par.h:184
riff_has_valid_tags
static int riff_has_valid_tags(AVFormatContext *s)
Definition: riffenc.c:324
ff_metadata_conv
void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv)
Definition: metadata.c:26
len
int len
Definition: vorbis_enc_data.h:426
avcodec.h
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
AV_CODEC_ID_GSM_MS
@ AV_CODEC_ID_GSM_MS
Definition: codec_id.h:457
tag
uint32_t tag
Definition: movenc.c:1646
AVStream
Stream structure.
Definition: avformat.h:948
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:260
pos
unsigned int pos
Definition: spdifenc.c:412
avformat.h
dict.h
AV_DICT_MATCH_CASE
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
Definition: dict.h:67
channel_layout.h
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
temp
else temp
Definition: vf_mcdeint.c:248
ff_put_wav_header
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags)
Write WAVEFORMAT header structure.
Definition: riffenc.c:55
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:326
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:103
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:323
AVCodecParameters::format
int format
Definition: codec_par.h:85
AV_CODEC_ID_PCM_F64LE
@ AV_CODEC_ID_PCM_F64LE
Definition: codec_id.h:341
AVDictionaryEntry
Definition: dict.h:79
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:61
AV_CODEC_ID_ADPCM_IMA_WAV
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition: codec_id.h:358
riff.h
ff_codec_wav_guids
const AVCodecGuid ff_codec_wav_guids[]
Definition: riff.c:636
bytestream.h
convert_header.str
string str
Definition: convert_header.py:20
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AV_CODEC_ID_DFPWM
@ AV_CODEC_ID_DFPWM
Definition: codec_id.h:523
AV_CODEC_ID_PCM_F32LE
@ AV_CODEC_ID_PCM_F32LE
Definition: codec_id.h:339
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:90
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVCodecGuid::guid
ff_asf_guid guid
Definition: riff.h:99
AVDictionaryEntry::value
char * value
Definition: dict.h:81
avio_put_str
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
Definition: aviobuf.c:402