FFmpeg
flacenc.c
Go to the documentation of this file.
1 /*
2  * raw FLAC muxer
3  * Copyright (c) 2006-2009 Justin Ruggles
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/opt.h"
24 #include "libavutil/pixdesc.h"
25 #include "libavcodec/flac.h"
26 #include "avformat.h"
27 #include "avio_internal.h"
28 #include "flacenc.h"
29 #include "id3v2.h"
30 #include "internal.h"
31 #include "vorbiscomment.h"
32 
33 
34 typedef struct FlacMuxerContext {
35  const AVClass *class;
37 
40  /* audio packets are queued here until we get all the attached pictures */
42 
43  /* updated streaminfo sent by the encoder at the end */
46 
47  unsigned attached_types;
49 
50 static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes,
51  int last_block)
52 {
53  avio_w8(pb, last_block ? 0x81 : 0x01);
54  avio_wb24(pb, n_padding_bytes);
55  ffio_fill(pb, 0, n_padding_bytes);
56  return 0;
57 }
58 
60  int last_block, int bitexact)
61 {
62  const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
63  int64_t len;
64 
66 
67  len = ff_vorbiscomment_length(*m, vendor, NULL, 0);
68  if (len >= ((1<<24) - 4))
69  return AVERROR(EINVAL);
70 
71  avio_w8(pb, last_block ? 0x84 : 0x04);
72  avio_wb24(pb, len);
73  ff_vorbiscomment_write(pb, *m, vendor, NULL, 0);
74 
75  return 0;
76 }
77 
79 {
81  AVIOContext *pb = s->pb;
82  const AVPixFmtDescriptor *pixdesc;
83  const CodecMime *mime = ff_id3v2_mime_tags;
85  const char *mimetype = NULL, *desc = "";
86  const AVStream *st = s->streams[pkt->stream_index];
87  int i, mimelen, desclen, type = 0, blocklen;
88 
89  if (!pkt->data)
90  return 0;
91 
92  while (mime->id != AV_CODEC_ID_NONE) {
93  if (mime->id == st->codecpar->codec_id) {
94  mimetype = mime->str;
95  break;
96  }
97  mime++;
98  }
99  if (!mimetype) {
100  av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot "
101  "write an attached picture.\n", st->index);
102  return AVERROR(EINVAL);
103  }
104  mimelen = strlen(mimetype);
105 
106  /* get the picture type */
107  e = av_dict_get(st->metadata, "comment", NULL, 0);
108  for (i = 0; e && i < FF_ARRAY_ELEMS(ff_id3v2_picture_types); i++) {
110  type = i;
111  break;
112  }
113  }
114 
115  if ((c->attached_types & (1 << type)) & 0x6) {
116  av_log(s, AV_LOG_ERROR, "Duplicate attachment for type '%s'\n", ff_id3v2_picture_types[type]);
117  return AVERROR(EINVAL);
118  }
119 
120  if (type == 1 && (st->codecpar->codec_id != AV_CODEC_ID_PNG ||
121  st->codecpar->width != 32 ||
122  st->codecpar->height != 32)) {
123  av_log(s, AV_LOG_ERROR, "File icon attachment must be a 32x32 PNG");
124  return AVERROR(EINVAL);
125  }
126 
127  c->attached_types |= (1 << type);
128 
129  /* get the description */
130  if ((e = av_dict_get(st->metadata, "title", NULL, 0)))
131  desc = e->value;
132  desclen = strlen(desc);
133 
134  blocklen = 4 + 4 + mimelen + 4 + desclen + 4 + 4 + 4 + 4 + 4 + pkt->size;
135  if (blocklen >= 1<<24) {
136  av_log(s, AV_LOG_ERROR, "Picture block too big %d >= %d\n", blocklen, 1<<24);
137  return AVERROR(EINVAL);
138  }
139 
140  avio_w8(pb, 0x06);
141  avio_wb24(pb, blocklen);
142 
143  avio_wb32(pb, type);
144 
145  avio_wb32(pb, mimelen);
146  avio_write(pb, mimetype, mimelen);
147 
148  avio_wb32(pb, desclen);
149  avio_write(pb, desc, desclen);
150 
151  avio_wb32(pb, st->codecpar->width);
152  avio_wb32(pb, st->codecpar->height);
153  if ((pixdesc = av_pix_fmt_desc_get(st->codecpar->format)))
154  avio_wb32(pb, av_get_bits_per_pixel(pixdesc));
155  else
156  avio_wb32(pb, 0);
157  avio_wb32(pb, 0);
158 
159  avio_wb32(pb, pkt->size);
160  avio_write(pb, pkt->data, pkt->size);
161  return 0;
162 }
163 
165 {
166  int i, ret, padding = s->metadata_header_padding;
167  if (padding < 0)
168  padding = 8192;
169  /* The FLAC specification states that 24 bits are used to represent the
170  * size of a metadata block so we must clip this value to 2^24-1. */
171  padding = av_clip_uintp2(padding, 24);
172 
173  for (i = 0; i < s->nb_streams; i++) {
174  AVStream *st = s->streams[i];
175  AVPacket *pkt = st->priv_data;
176  if (!pkt)
177  continue;
178  ret = flac_write_picture(s, pkt);
179  av_packet_unref(pkt);
180  if (ret < 0 && (s->error_recognition & AV_EF_EXPLODE))
181  return ret;
182  }
183 
184  ret = flac_write_block_comment(s->pb, &s->metadata, !padding,
186  if (ret)
187  return ret;
188 
189  /* The command line flac encoder defaults to placing a seekpoint
190  * every 10s. So one might add padding to allow that later
191  * but there seems to be no simple way to get the duration here.
192  * So just add the amount requested by the user. */
193  if (padding)
194  flac_write_block_padding(s->pb, padding, 1);
195 
196  return 0;
197 }
198 
199 static int flac_init(struct AVFormatContext *s)
200 {
201  AVCodecParameters *par;
203  int i;
204 
205  c->audio_stream_idx = -1;
206  for (i = 0; i < s->nb_streams; i++) {
207  AVStream *st = s->streams[i];
208  if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
209  if (c->audio_stream_idx >= 0 || st->codecpar->codec_id != AV_CODEC_ID_FLAC) {
210  av_log(s, AV_LOG_ERROR, "Invalid audio stream. Exactly one FLAC "
211  "audio stream is required.\n");
212  return AVERROR(EINVAL);
213  }
214  par = s->streams[i]->codecpar;
215  c->audio_stream_idx = i;
216  } else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
218  av_log(s, AV_LOG_WARNING, "Video stream #%d is not an attached picture. Ignoring\n", i);
219  continue;
220  } else if (st->codecpar->codec_id == AV_CODEC_ID_GIF) {
221  av_log(s, AV_LOG_ERROR, "GIF image support is not implemented.\n");
222  return AVERROR_PATCHWELCOME;
223  } else if (!c->write_header) {
224  av_log(s, AV_LOG_ERROR, "Can't write attached pictures without a header.\n");
225  return AVERROR(EINVAL);
226  }
227  c->waiting_pics++;
228  } else {
229  av_log(s, AV_LOG_ERROR, "Only audio streams and pictures are allowed in FLAC.\n");
230  return AVERROR(EINVAL);
231  }
232  }
233  if (c->audio_stream_idx < 0) {
234  av_log(s, AV_LOG_ERROR, "No audio stream present.\n");
235  return AVERROR(EINVAL);
236  }
237 
238  /* add the channel layout tag */
239  if (par->channel_layout &&
240  !(par->channel_layout & ~0x3ffffULL) &&
242  AVDictionaryEntry *chmask = av_dict_get(s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
243  NULL, 0);
244 
245  if (chmask) {
246  av_log(s, AV_LOG_WARNING, "A WAVEFORMATEXTENSIBLE_CHANNEL_MASK is "
247  "already present, this muxer will not overwrite it.\n");
248  } else {
249  uint8_t buf[32];
250  snprintf(buf, sizeof(buf), "0x%"PRIx64, par->channel_layout);
251  av_dict_set(&s->metadata, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
252  }
253  }
254 
255  return 0;
256 }
257 
259 {
262  int ret;
263 
264  if (!c->write_header)
265  return 0;
266 
267  ret = ff_flac_write_header(s->pb, par->extradata,
268  par->extradata_size, 0);
269  if (ret < 0)
270  return ret;
271 
272  if (!c->waiting_pics)
273  ret = flac_finish_header(s);
274 
275  return ret;
276 }
277 
279 {
282  int streaminfo_size;
283 
284  /* check for updated streaminfo */
286  &streaminfo_size);
287  if (streaminfo && streaminfo_size == FLAC_STREAMINFO_SIZE) {
288  memcpy(c->streaminfo, streaminfo, FLAC_STREAMINFO_SIZE);
289  c->updated_streaminfo = 1;
290  }
291 
292  if (pkt->size)
293  avio_write(s->pb, pkt->data, pkt->size);
294  return 0;
295 }
296 
298 {
300  AVPacket pkt;
301  int ret, write = 1;
302 
303  ret = flac_finish_header(s);
304  if (ret < 0)
305  write = 0;
306 
307  while (c->queue) {
308  ff_packet_list_get(&c->queue, &c->queue_end, &pkt);
309  if (write && (ret = flac_write_audio_packet(s, &pkt)) < 0)
310  write = 0;
311  av_packet_unref(&pkt);
312  }
313  return ret;
314 }
315 
317 {
318  AVIOContext *pb = s->pb;
319  int64_t file_size;
321 
322  if (c->waiting_pics) {
323  av_log(s, AV_LOG_WARNING, "No packets were sent for some of the "
324  "attached pictures.\n");
325  flac_queue_flush(s);
326  }
327 
328  if (!c->write_header || !c->updated_streaminfo)
329  return 0;
330 
331  if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
332  /* rewrite the STREAMINFO header block data */
333  file_size = avio_tell(pb);
334  avio_seek(pb, 8, SEEK_SET);
336  avio_seek(pb, file_size, SEEK_SET);
337  } else {
338  av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n");
339  }
340 
341  return 0;
342 }
343 
344 static void flac_deinit(struct AVFormatContext *s)
345 {
347 
349 }
350 
352 {
354  int ret;
355 
356  if (pkt->stream_index == c->audio_stream_idx) {
357  if (c->waiting_pics) {
358  /* buffer audio packets until we get all the pictures */
360  if (ret < 0) {
361  av_log(s, AV_LOG_ERROR, "Out of memory in packet queue; skipping attached pictures\n");
362  c->waiting_pics = 0;
363  ret = flac_queue_flush(s);
364  if (ret < 0)
365  return ret;
366  return flac_write_audio_packet(s, pkt);
367  }
368  } else
369  return flac_write_audio_packet(s, pkt);
370  } else {
371  AVStream *st = s->streams[pkt->stream_index];
372 
373  if (!c->waiting_pics ||
375  return 0;
376 
377  /* warn only once for each stream */
378  if (st->nb_frames == 1) {
379  av_log(s, AV_LOG_WARNING, "Got more than one picture in stream %d,"
380  " ignoring.\n", pkt->stream_index);
381  }
382  if (st->nb_frames >= 1)
383  return 0;
384 
385  st->priv_data = av_packet_clone(pkt);
386  if (!st->priv_data)
387  av_log(s, AV_LOG_ERROR, "Out of memory queueing an attached picture; skipping\n");
388  c->waiting_pics--;
389 
390  /* flush the buffered audio packets */
391  if (!c->waiting_pics &&
392  (ret = flac_queue_flush(s)) < 0)
393  return ret;
394  }
395 
396  return 0;
397 }
398 
399 static const AVOption flacenc_options[] = {
400  { "write_header", "Write the file header", offsetof(FlacMuxerContext, write_header), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
401  { NULL },
402 };
403 
404 static const AVClass flac_muxer_class = {
405  .class_name = "flac muxer",
406  .item_name = av_default_item_name,
407  .option = flacenc_options,
408  .version = LIBAVUTIL_VERSION_INT,
409 };
410 
412  .name = "flac",
413  .long_name = NULL_IF_CONFIG_SMALL("raw FLAC"),
414  .priv_data_size = sizeof(FlacMuxerContext),
415  .mime_type = "audio/x-flac",
416  .extensions = "flac",
417  .audio_codec = AV_CODEC_ID_FLAC,
418  .video_codec = AV_CODEC_ID_PNG,
419  .init = flac_init,
423  .deinit = flac_deinit,
425  .priv_class = &flac_muxer_class,
426 };
static void flac_deinit(struct AVFormatContext *s)
Definition: flacenc.c:344
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:701
#define NULL
Definition: coverity.c:32
Bytestream IO Context.
Definition: avio.h:161
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
AVOption.
Definition: opt.h:248
int ff_packet_list_put(AVPacketList **head, AVPacketList **tail, AVPacket *pkt, int flags)
Append an AVPacket to the list.
Definition: utils.c:441
static int flac_init(struct AVFormatContext *s)
Definition: flacenc.c:199
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * desc
Definition: nvenc.c:87
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
AVPacketList * queue
Definition: flacenc.c:41
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
Definition: pixdesc.c:2525
static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes, int last_block)
Definition: flacenc.c:50
AVOutputFormat ff_flac_muxer
Definition: flacenc.c:411
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
int index
stream index in AVFormatContext
Definition: avformat.h:877
int size
Definition: packet.h:356
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:253
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
int ff_flac_is_native_layout(uint64_t channel_layout)
GLint GLenum type
Definition: opengl_enc.c:104
void * priv_data
Definition: avformat.h:891
static AVPacket pkt
This struct describes the properties of an encoded stream.
Definition: codec_par.h:52
Format I/O context.
Definition: avformat.h:1351
int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m, const char *vendor_string, AVChapter **chapters, unsigned int nb_chapters)
Write a VorbisComment into an AVIOContext.
Definition: vorbiscomment.c:65
char str[32]
Definition: internal.h:48
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
static int flac_queue_flush(AVFormatContext *s)
Definition: flacenc.c:297
uint8_t
int width
Video only.
Definition: codec_par.h:126
AVOptions.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
static int flac_write_header(struct AVFormatContext *s)
Definition: flacenc.c:258
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1419
#define FF_PACKETLIST_FLAG_REF_PACKET
Create a new reference for the packet instead of transferring the ownership of the existing one to th...
Definition: internal.h:733
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
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1482
uint8_t * data
Definition: packet.h:355
enum AVCodecID id
Definition: internal.h:49
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:557
static int flac_finish_header(struct AVFormatContext *s)
Definition: flacenc.c:164
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Definition: aviobuf.c:225
#define AVFMT_FLAG_BITEXACT
When muxing, try to avoid writing any random/volatile data to the output.
Definition: avformat.h:1499
static int flac_write_trailer(struct AVFormatContext *s)
Definition: flacenc.c:316
uint64_t channel_layout
Audio only.
Definition: codec_par.h:162
#define av_log(a,...)
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Definition: opt.h:278
static int flac_write_audio_packet(struct AVFormatContext *s, AVPacket *pkt)
Definition: flacenc.c:278
int updated_streaminfo
Definition: flacenc.c:45
static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt)
Definition: flacenc.c:78
const AVMetadataConv ff_vorbiscomment_metadata_conv[]
VorbisComment metadata conversion mapping.
Definition: vorbiscomment.c:33
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1591
AVPacket * av_packet_clone(const AVPacket *src)
Create a new packet that references the same data as src.
Definition: avpacket.c:650
FLAC (Free Lossless Audio Codec) decoder/demuxer common functions.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
Definition: avpacket.c:353
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:153
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:56
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:78
static const AVOption flacenc_options[]
Definition: flacenc.c:399
const CodecMime ff_id3v2_mime_tags[]
Definition: id3v2.c:131
int write_header
Definition: flacenc.c:36
unsigned attached_types
Definition: flacenc.c:47
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1407
#define LIBAVFORMAT_IDENT
Definition: version.h:46
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:260
audio channel layout utility functions
void ffio_fill(AVIOContext *s, int b, int count)
Definition: aviobuf.c:211
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition: avstring.c:213
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:98
void avio_wb24(AVIOContext *s, unsigned int val)
Definition: aviobuf.c:477
const char * name
Definition: avformat.h:500
#define FLAC_STREAMINFO_SIZE
Definition: flac.h:34
#define s(width, name)
Definition: cbs_vp9.c:257
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: avcodec.h:1666
AVDictionary * metadata
Definition: avformat.h:940
static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, int last_block, int bitexact)
Definition: flacenc.c:59
int64_t ff_vorbiscomment_length(const AVDictionary *m, const char *vendor_string, AVChapter **chapters, unsigned int nb_chapters)
Calculate the length in bytes of a VorbisComment.
Definition: vorbiscomment.c:41
#define FF_ARRAY_ELEMS(a)
#define AV_DISPOSITION_ATTACHED_PIC
The stream is stored in the file as an attached picture/"cover art" (e.g.
Definition: avformat.h:844
int metadata_header_padding
Number of bytes to be written as padding in a metadata header.
Definition: avformat.h:1851
Stream structure.
Definition: avformat.h:876
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
#define AVFMT_NOTIMESTAMPS
Format does not need / have any timestamps.
Definition: avformat.h:462
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
Definition: avio.h:40
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
Definition: packet.h:55
static const AVClass flac_muxer_class
Definition: flacenc.c:404
AVIOContext * pb
I/O context.
Definition: avformat.h:1393
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
void avio_w8(AVIOContext *s, int b)
Definition: aviobuf.c:203
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:605
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:70
Describe the class of an AVClass context structure.
Definition: log.h:67
int waiting_pics
Definition: flacenc.c:39
void ff_packet_list_free(AVPacketList **head, AVPacketList **tail)
Wipe the list and unref all the packets in it.
Definition: utils.c:1423
#define snprintf
Definition: snprintf.h:34
uint8_t streaminfo[FLAC_STREAMINFO_SIZE]
Definition: flacenc.c:44
#define flags(name, subs,...)
Definition: cbs_av1.c:560
AVPacketList * queue_end
Definition: flacenc.c:41
int ff_flac_write_header(AVIOContext *pb, const uint8_t *extradata, int extradata_size, int last_block)
static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
Definition: flacenc.c:351
int ff_packet_list_get(AVPacketList **head, AVPacketList **tail, AVPacket *pkt)
Remove the oldest AVPacket in the list and return it.
Definition: utils.c:1553
Main libavformat public API header.
int audio_stream_idx
Definition: flacenc.c:38
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
Definition: avformat.h:1618
int disposition
AV_DISPOSITION_* bit field.
Definition: avformat.h:929
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:927
void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv)
Definition: metadata.c:26
char * value
Definition: dict.h:87
int len
void * priv_data
Format private data.
Definition: avformat.h:1379
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:74
void avio_wb32(AVIOContext *s, unsigned int val)
Definition: aviobuf.c:387
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1023
const char *const ff_id3v2_picture_types[21]
Definition: id3v2.c:107
int stream_index
Definition: packet.h:357
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
This structure stores compressed data.
Definition: packet.h:332
int i
Definition: input.c:406