FFmpeg
Loading...
Searching...
No Matches
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"
27#include "avformat.h"
28#include "avio_internal.h"
29#include "riff.h"
30
32{
33 ffio_wfourcc(pb, tag);
34 avio_wl32(pb, -1);
35 return avio_tell(pb);
36}
37
39{
41
42 av_assert0((start&1) == 0);
43
44 pos = avio_tell(pb);
45 if (pos & 1)
46 avio_w8(pb, 0);
47 avio_seek(pb, start - 4, SEEK_SET);
48 avio_wl32(pb, (uint32_t)(pos - start));
49 avio_seek(pb, FFALIGN(pos, 2), SEEK_SET);
50}
51
52/* WAVEFORMATEX header */
53/* returns the size or -1 on error */
55 AVCodecParameters *par, int flags)
56{
57 int bps, blkalign, bytespersec, frame_size;
58 int hdrsize;
59 int64_t hdrstart = avio_tell(pb);
60 int waveformatextensible;
61 uint8_t temp[256];
62 uint8_t *riff_extradata = temp;
63 uint8_t *riff_extradata_start = temp;
64
65 if (!par->codec_tag || par->codec_tag > 0xffff)
66 return -1;
67
68 if (par->codec_id == AV_CODEC_ID_ADPCM_SWF && par->block_align == 0) {
69 av_log(s, AV_LOG_ERROR, "%s can only be written to WAVE with a constant frame size\n",
71 return AVERROR(EINVAL);
72 }
73
74 /* We use the known constant frame size for the codec if known, otherwise
75 * fall back on using AVCodecParameters.frame_size, which is not as reliable
76 * for indicating packet duration. */
78
79 waveformatextensible = (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE &&
82 par->sample_rate > 48000 ||
84 (av_get_bits_per_sample(par->codec_id) > 16 && par->codec_tag != 0x0003);
85
86 if (waveformatextensible)
87 avio_wl16(pb, 0xfffe);
88 else
89 avio_wl16(pb, par->codec_tag);
90
92 avio_wl32(pb, par->sample_rate);
93 if (par->codec_id == AV_CODEC_ID_ATRAC3 ||
95 par->codec_id == AV_CODEC_ID_G728 ||
96 par->codec_id == AV_CODEC_ID_MP2 ||
97 par->codec_id == AV_CODEC_ID_MP3 ||
99 bps = 0;
100 } else {
101 if (!(bps = av_get_bits_per_sample(par->codec_id))) {
102 if (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",
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 if (par->codec_id == AV_CODEC_ID_ADPCM_MS ||
140 if (frame_size <= 0) {
141 av_log(s, AV_LOG_ERROR, "Invalid block_align or bps for %s\n",
143 return AVERROR(EINVAL);
144 }
145 bytespersec = (int64_t)par->sample_rate * blkalign / frame_size;
146 } else {
147 bytespersec = par->bit_rate / 8;
148 }
149 avio_wl32(pb, bytespersec); /* bytes per second */
150 avio_wl16(pb, blkalign); /* block align */
151 avio_wl16(pb, bps); /* bits per sample */
152 if (par->codec_id == AV_CODEC_ID_MP3) {
153 bytestream_put_le16(&riff_extradata, 1); /* wID */
154 bytestream_put_le32(&riff_extradata, 2); /* fdwFlags */
155 bytestream_put_le16(&riff_extradata, 1152); /* nBlockSize */
156 bytestream_put_le16(&riff_extradata, 1); /* nFramesPerBlock */
157 bytestream_put_le16(&riff_extradata, 1393); /* nCodecDelay */
158 } else if (par->codec_id == AV_CODEC_ID_MP2) {
159 /* fwHeadLayer */
160 bytestream_put_le16(&riff_extradata, 2);
161 /* dwHeadBitrate */
162 bytestream_put_le32(&riff_extradata, par->bit_rate);
163 /* fwHeadMode */
164 bytestream_put_le16(&riff_extradata, par->ch_layout.nb_channels == 2 ? 1 : 8);
165 /* fwHeadModeExt */
166 bytestream_put_le16(&riff_extradata, 0);
167 /* wHeadEmphasis */
168 bytestream_put_le16(&riff_extradata, 1);
169 /* fwHeadFlags */
170 bytestream_put_le16(&riff_extradata, 16);
171 /* dwPTSLow */
172 bytestream_put_le32(&riff_extradata, 0);
173 /* dwPTSHigh */
174 bytestream_put_le32(&riff_extradata, 0);
175 } else if (par->codec_id == AV_CODEC_ID_G723_1) {
176 bytestream_put_le32(&riff_extradata, 0x9ace0002); /* extradata needed for msacm g723.1 codec */
177 bytestream_put_le32(&riff_extradata, 0xaea2f732);
178 bytestream_put_le16(&riff_extradata, 0xacde);
179 } else if (par->codec_id == AV_CODEC_ID_GSM_MS ||
181 /* wSamplesPerBlock */
182 bytestream_put_le16(&riff_extradata, frame_size);
183 } else if (par->extradata_size) {
184 riff_extradata_start = par->extradata;
185 riff_extradata = par->extradata + par->extradata_size;
186 }
187 /* write WAVEFORMATEXTENSIBLE extensions */
188 if (waveformatextensible) {
189 int write_channel_mask = !(flags & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) &&
190 (s->strict_std_compliance < FF_COMPLIANCE_NORMAL ||
191 par->ch_layout.u.mask < 0x40000);
192 /* 22 is WAVEFORMATEXTENSIBLE size */
193 avio_wl16(pb, riff_extradata - riff_extradata_start + 22);
194 /* ValidBitsPerSample || SamplesPerBlock || Reserved */
195 avio_wl16(pb, bps);
196 /* dwChannelMask */
197 avio_wl32(pb, write_channel_mask ? par->ch_layout.u.mask : 0);
198 /* GUID + next 3 */
199 if (par->codec_id == AV_CODEC_ID_EAC3 || par->codec_id == AV_CODEC_ID_DFPWM) {
201 } else {
202 avio_wl32(pb, par->codec_tag);
203 avio_wl32(pb, 0x00100000);
204 avio_wl32(pb, 0xAA000080);
205 avio_wl32(pb, 0x719B3800);
206 }
208 par->codec_tag != 0x0001 /* PCM */ ||
209 riff_extradata - riff_extradata_start) {
210 /* WAVEFORMATEX */
211 if (par->codec_tag == 0x1610) {
212 /* HEAACWAVEFORMAT */
213 avio_wl16(pb, par->extradata_size + 12); /* cbSize */
214 avio_wl16(pb, !par->extradata_size); // wPayloadType, 0 = Raw, 1 = ADTS
215 avio_wl16(pb, 0xFE); // wAudioProfileLevelIndication, 0xFE = unspecified
216 avio_wl16(pb, 0); // wStructType, 0 = AudioSpecificConfig()
217 avio_wl16(pb, 0); // wReserved1
218 avio_wl32(pb, 0); // dwReserved2
219 } else if (par->codec_tag == 0xFF && !par->extradata_size) {
220 av_log(s, AV_LOG_ERROR, "ADTS is only supported with codec tag 0x1610\n");
221 return AVERROR(EINVAL);
222 } else
223 avio_wl16(pb, riff_extradata - riff_extradata_start); /* cbSize */
224 } /* else PCMWAVEFORMAT */
225 avio_write(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
226 hdrsize = avio_tell(pb) - hdrstart;
227 if (hdrsize & 1) {
228 hdrsize++;
229 avio_w8(pb, 0);
230 }
231
232 return hdrsize;
233}
234
235/* BITMAPINFOHEADER header */
237 int for_asf, int ignore_extradata, int rgb_frame_is_flipped)
238{
239 int flipped_extradata = (par->extradata_size >= 9 &&
240 !memcmp(par->extradata + par->extradata_size - 9, "BottomUp", 9));
241 int keep_height = flipped_extradata || rgb_frame_is_flipped;
242 int extradata_size = par->extradata_size - 9*flipped_extradata;
243 enum AVPixelFormat pix_fmt = par->format;
244 int pal_avi;
245
248 pal_avi = !for_asf &&
252
253 /* Size (not including the size of the color table or color masks) */
254 avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size));
255 avio_wl32(pb, par->width);
256 //We always store RGB TopDown
257 avio_wl32(pb, par->codec_tag || keep_height ? par->height : -par->height);
258 /* planes */
259 avio_wl16(pb, 1);
260 /* depth */
262 /* compression type */
263 // MSRLE compatibility with Media Player 3.1 and Windows 95
264 avio_wl32(pb, par->codec_id == AV_CODEC_ID_MSRLE ? 1 : par->codec_tag);
265 avio_wl32(pb, (par->width * par->height * (par->bits_per_coded_sample ? par->bits_per_coded_sample : 24)+7) / 8);
266 avio_wl32(pb, 0);
267 avio_wl32(pb, 0);
268 /* Number of color indices in the color table that are used.
269 * A value of 0 means 2^biBitCount indices, but this doesn't work
270 * with Windows Media Player and files containing xxpc chunks. */
271 // MSRLE on Windows 95 requires a zero here
272 avio_wl32(pb, pal_avi && par->codec_id != AV_CODEC_ID_MSRLE ? 1 << par->bits_per_coded_sample : 0);
273 avio_wl32(pb, 0);
274
275 if (!ignore_extradata) {
276 if (par->extradata_size) {
277 avio_write(pb, par->extradata, extradata_size);
278 if (!for_asf && extradata_size & 1)
279 avio_w8(pb, 0);
280 } else if (pal_avi) {
281 int i;
282 for (i = 0; i < 1 << par->bits_per_coded_sample; i++) {
283 /* Initialize 1 bpp palette to black & white */
284 if (i == 0 && pix_fmt == AV_PIX_FMT_MONOWHITE)
285 avio_wl32(pb, 0xffffff);
286 else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK)
287 avio_wl32(pb, 0xffffff);
288 else
289 avio_wl32(pb, 0);
290 }
291 }
292 }
293}
294
295void ff_parse_specific_params(AVStream *st, int *au_rate,
296 int *au_ssize, int *au_scale)
297{
298 AVCodecParameters *par = st->codecpar;
299 int gcd;
300 int audio_frame_size;
301
302 audio_frame_size = av_get_audio_frame_duration2(par, 0);
303 if (!audio_frame_size)
304 audio_frame_size = par->frame_size;
305
306 *au_ssize = par->block_align;
307 if (audio_frame_size && par->sample_rate) {
308 *au_scale = audio_frame_size;
309 *au_rate = par->sample_rate;
310 } else if (par->codec_type == AVMEDIA_TYPE_VIDEO ||
313 *au_scale = st->time_base.num;
314 *au_rate = st->time_base.den;
315 } else {
316 *au_scale = par->block_align ? par->block_align * 8 : 8;
317 *au_rate = par->bit_rate ? par->bit_rate :
318 8 * par->sample_rate;
319 }
320 gcd = av_gcd(*au_scale, *au_rate);
321 *au_scale /= gcd;
322 *au_rate /= gcd;
323}
324
325void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
326{
327 size_t len = strlen(str);
328 if (len > 0 && len < UINT32_MAX) {
329 len++;
330 ffio_wfourcc(pb, tag);
331 avio_wl32(pb, len);
332 avio_put_str(pb, str);
333 if (len & 1)
334 avio_w8(pb, 0);
335 }
336}
337
338static const char riff_tags[][5] = {
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",
343 { 0 }
344};
345
347{
348 int i;
349
350 for (i = 0; *riff_tags[i]; i++)
351 if (av_dict_get(s->metadata, riff_tags[i], NULL, AV_DICT_MATCH_CASE))
352 return 1;
353
354 return 0;
355}
356
358{
359 AVIOContext *pb = s->pb;
360 int i;
361 int64_t list_pos;
363
365
366 /* writing empty LIST is not nice and may cause problems */
368 return;
369
370 list_pos = ff_start_tag(pb, "LIST");
371 ffio_wfourcc(pb, "INFO");
372 for (i = 0; *riff_tags[i]; i++)
373 if ((t = av_dict_get(s->metadata, riff_tags[i],
375 ff_riff_write_info_tag(s->pb, t->key, t->value);
376 ff_end_tag(pb, list_pos);
377}
378
380{
381 av_assert0(sizeof(*g) == 16);
382 avio_write(s, *g, sizeof(*g));
383}
384
385const ff_asf_guid *ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
386{
387 int i;
388 for (i = 0; av_guid[i].id != AV_CODEC_ID_NONE; i++) {
389 if (id == av_guid[i].id)
390 return &(av_guid[i].guid);
391 }
392 return NULL;
393}
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
Main libavformat public API header.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition aviobuf.c:236
void avio_wl32(AVIOContext *s, unsigned int val)
Definition aviobuf.c:360
void avio_wl16(AVIOContext *s, unsigned int val)
Definition aviobuf.c:440
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
Definition aviobuf.c:376
void avio_w8(AVIOContext *s, int b)
Definition aviobuf.c:184
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition avio.h:494
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Definition aviobuf.c:206
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
#define FF_COMPLIANCE_NORMAL
Definition defs.h:60
static enum AVPixelFormat pix_fmt
Public dictionary API.
static const uint8_t frame_size[4]
Definition g723_1.h:222
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition utils.c:556
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition utils.c:421
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
@ AV_CODEC_ID_PCM_F32LE
Definition codec_id.h:351
@ AV_CODEC_ID_G723_1
Definition codec_id.h:505
@ AV_CODEC_ID_ADPCM_SWF
Definition codec_id.h:383
@ AV_CODEC_ID_EAC3
Definition codec_id.h:493
@ AV_CODEC_ID_PCM_U8
Definition codec_id.h:335
@ AV_CODEC_ID_PCM_S16LE
Definition codec_id.h:330
@ AV_CODEC_ID_G728
Definition codec_id.h:560
@ AV_CODEC_ID_NONE
Definition codec_id.h:48
@ AV_CODEC_ID_MSRLE
Definition codec_id.h:95
@ AV_CODEC_ID_PCM_S24LE
Definition codec_id.h:342
@ AV_CODEC_ID_PCM_S32LE
Definition codec_id.h:338
@ AV_CODEC_ID_ADPCM_MS
Definition codec_id.h:376
@ AV_CODEC_ID_GSM_MS
Definition codec_id.h:483
@ AV_CODEC_ID_PCM_F64LE
Definition codec_id.h:353
@ AV_CODEC_ID_MP2
Definition codec_id.h:453
@ AV_CODEC_ID_ATRAC3
Definition codec_id.h:484
@ AV_CODEC_ID_AAC
Definition codec_id.h:455
@ AV_CODEC_ID_AC3
Definition codec_id.h:456
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition codec_id.h:371
@ AV_CODEC_ID_DFPWM
Definition codec_id.h:549
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition codec_id.h:454
#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.
Definition dict.c:60
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
Definition dict.h:74
#define AVERROR(e)
Definition error.h:45
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
Definition mathematics.c:37
@ AVMEDIA_TYPE_SUBTITLE
Definition avutil.h:203
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
Definition avutil.h:202
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
Definition utils.c:823
#define FFALIGN(x, a)
Definition macros.h:78
void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv)
Definition metadata.c:26
uint32_t tag
Definition movenc.c:2073
unsigned bps
Definition movenc.c:2074
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ 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:83
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
@ 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:82
const AVCodecGuid ff_codec_wav_guids[]
Definition riff.c:659
const AVMetadataConv ff_riff_info_conv[]
Definition riff.c:632
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.
Definition riff.h:53
uint8_t ff_asf_guid[16]
Definition riff.h:96
#define FF_PUT_WAV_HEADER_SKIP_CHANNELMASK
Tell ff_put_wav_header() to write an empty channel mask.
Definition riff.h:58
void ff_end_tag(AVIOContext *pb, int64_t start)
Definition riffenc.c:38
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
Write a single RIFF info tag.
Definition riffenc.c:325
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
Definition riffenc.c:357
static const char riff_tags[][5]
Definition riffenc.c:338
void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, int for_asf, int ignore_extradata, int rgb_frame_is_flipped)
Definition riffenc.c:236
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
Definition riffenc.c:31
const ff_asf_guid * ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
Definition riffenc.c:385
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale)
Definition riffenc.c:295
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags)
Write WAVEFORMAT header structure.
Definition riffenc.c:54
static int riff_has_valid_tags(AVFormatContext *s)
Definition riffenc.c:346
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g)
Definition riffenc.c:379
unsigned int pos
Definition spdifenc.c:431
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.
ff_asf_guid guid
Definition riff.h:100
enum AVCodecID id
Definition riff.h:99
This struct describes the properties of an encoded stream.
Definition codec_par.h:49
int extradata_size
Size of the extradata content in bytes.
Definition codec_par.h:75
int frame_size
Audio frame size, if known.
Definition codec_par.h:227
int height
The height of the video frame in pixels.
Definition codec_par.h:150
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition codec_par.h:113
AVChannelLayout ch_layout
The channel layout and number of channels.
Definition codec_par.h:207
int width
The width of the video frame in pixels.
Definition codec_par.h:143
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition codec_par.h:99
enum AVMediaType codec_type
General type of the encoded data.
Definition codec_par.h:53
int block_align
The number of bytes per coded audio frame, required by some formats.
Definition codec_par.h:221
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition codec_par.h:61
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition codec_par.h:71
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition codec_par.h:57
int sample_rate
The number of audio samples per second.
Definition codec_par.h:213
char * key
Definition dict.h:91
char * value
Definition dict.h:92
Format I/O context.
Definition avformat.h:1333
Bytestream IO Context.
Definition avio.h:160
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
Stream structure.
Definition avformat.h:766
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:789
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition avformat.h:805
#define av_log(a,...)
const char * g
Definition vf_curves.c:128
else temp
Definition vf_mcdeint.c:275
int len