mvdec.c
Go to the documentation of this file.
1 /*
2  * Silicon Graphics Movie demuxer
3  * Copyright (c) 2012 Peter Ross
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 
22 /**
23  * @file
24  * Silicon Graphics Movie demuxer
25  */
26 
27 #include "libavutil/eval.h"
28 #include "libavutil/intreadwrite.h"
29 #include "libavutil/rational.h"
30 #include "avformat.h"
31 #include "internal.h"
32 
33 typedef struct {
36 
37  int eof_count; /**< number of streams that have finished */
38  int stream_index; /**< current stream index */
39  int frame[2]; /**< frame nb for current stream */
40 } MvContext;
41 
42 #define AUDIO_FORMAT_SIGNED 401
43 
44 static int mv_probe(AVProbeData *p)
45 {
46  if (AV_RB32(p->buf) == MKBETAG('M','O','V','I') && AV_RB16(p->buf + 4) < 3)
47  return AVPROBE_SCORE_MAX;
48  return 0;
49 }
50 
51 static char * var_read_string(AVIOContext *pb, int size)
52 {
53  char *str = av_malloc(size + 1);
54  int n;
55  if (!str)
56  return NULL;
57  n = avio_get_str(pb, size, str, size + 1);
58  if (n < size)
59  avio_skip(pb, size - n);
60  return str;
61 }
62 
63 static int var_read_int(AVIOContext *pb, int size)
64 {
65  int v;
66  char * s = var_read_string(pb, size);
67  if (!s || sscanf(s, "%d", &v) != 1)
68  v = 0;
69  av_free(s);
70  return v;
71 }
72 
74 {
75  AVRational v;
76  char * s = var_read_string(pb, size);
77  if (!s)
78  return (AVRational){0, 0};
79  v = av_d2q(av_strtod(s, NULL), INT_MAX);
80  av_free(s);
81  return v;
82 }
83 
84 static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
85 {
86  char *value = var_read_string(avctx->pb, size);
87  if (value)
88  av_dict_set(&avctx->metadata, tag, value, AV_DICT_DONT_STRDUP_VAL);
89 }
90 
91 static int set_channels(AVFormatContext *avctx, AVStream *st, int channels) {
92  if (channels <= 0) {
93  av_log(avctx, AV_LOG_ERROR, "Channel count %d invalid\n", channels);
94  return AVERROR_INVALIDDATA;
95  }
96  st->codec->channels = channels;
98  return 0;
99 }
100 
101 /**
102  * Parse global variable
103  * @return < 0 if unknown
104  */
105 static int parse_global_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
106 {
107  MvContext *mv = avctx->priv_data;
108  AVIOContext *pb = avctx->pb;
109  if (!strcmp(name, "__NUM_I_TRACKS")) {
110  mv->nb_video_tracks = var_read_int(pb, size);
111  } else if (!strcmp(name, "__NUM_A_TRACKS")) {
112  mv->nb_audio_tracks = var_read_int(pb, size);
113  } else if (!strcmp(name, "COMMENT") || !strcmp(name, "TITLE")) {
114  var_read_metadata(avctx, name, size);
115  } else if (!strcmp(name, "LOOP_MODE") || !strcmp(name, "NUM_LOOPS") || !strcmp(name, "OPTIMIZED")) {
116  avio_skip(pb, size); // ignore
117  } else
118  return -1;
119 
120  return 0;
121 }
122 
123 /**
124  * Parse audio variable
125  * @return < 0 if unknown
126  */
127 static int parse_audio_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
128 {
129  AVIOContext *pb = avctx->pb;
130  if (!strcmp(name, "__DIR_COUNT")) {
131  st->nb_frames = var_read_int(pb, size);
132  } else if (!strcmp(name, "AUDIO_FORMAT")) {
133  st->codec->codec_id = var_read_int(pb, size);
134  } else if (!strcmp(name, "COMPRESSION")) {
135  st->codec->codec_tag = var_read_int(pb, size);
136  } else if (!strcmp(name, "DEFAULT_VOL")) {
137  var_read_metadata(avctx, name, size);
138  } else if (!strcmp(name, "NUM_CHANNELS")) {
139  return set_channels(avctx, st, var_read_int(pb, size));
140  } else if (!strcmp(name, "SAMPLE_RATE")) {
141  st->codec->sample_rate = var_read_int(pb, size);
142  avpriv_set_pts_info(st, 33, 1, st->codec->sample_rate);
143  } else if (!strcmp(name, "SAMPLE_WIDTH")) {
144  st->codec->bits_per_coded_sample = var_read_int(pb, size) * 8;
145  } else
146  return -1;
147  return 0;
148 }
149 
150 /**
151  * Parse video variable
152  * @return < 0 if unknown
153  */
154 static int parse_video_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
155 {
156  AVIOContext *pb = avctx->pb;
157  if (!strcmp(name, "__DIR_COUNT")) {
158  st->nb_frames = st->duration = var_read_int(pb, size);
159  } else if (!strcmp(name, "COMPRESSION")) {
160  char * str = var_read_string(pb, size);
161  if (!str)
162  return AVERROR_INVALIDDATA;
163  if (!strcmp(str, "1")) {
165  } else if (!strcmp(str, "2")) {
168  } else if (!strcmp(str, "3")) {
170  } else if (!strcmp(str, "10")) {
172  } else if (!strcmp(str, "MVC2")) {
174  } else {
175  avpriv_request_sample(avctx, "video compression %s", str);
176  }
177  av_free(str);
178  } else if (!strcmp(name, "FPS")) {
179  AVRational fps = var_read_float(pb, size);
180  avpriv_set_pts_info(st, 64, fps.den, fps.num);
181  } else if (!strcmp(name, "HEIGHT")) {
182  st->codec->height = var_read_int(pb, size);
183  } else if (!strcmp(name, "PIXEL_ASPECT")) {
184  st->sample_aspect_ratio = var_read_float(pb, size);
186  st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, INT_MAX);
187  } else if (!strcmp(name, "WIDTH")) {
188  st->codec->width = var_read_int(pb, size);
189  } else if (!strcmp(name, "ORIENTATION")) {
190  if (var_read_int(pb, size) == 1101) {
191  st->codec->extradata = av_strdup("BottomUp");
192  st->codec->extradata_size = 9;
193  }
194  } else if (!strcmp(name, "Q_SPATIAL") || !strcmp(name, "Q_TEMPORAL")) {
195  var_read_metadata(avctx, name, size);
196  } else if (!strcmp(name, "INTERLACING") || !strcmp(name, "PACKING")) {
197  avio_skip(pb, size); // ignore
198  } else
199  return -1;
200  return 0;
201 }
202 
203 static void read_table(AVFormatContext *avctx, AVStream *st, int (*parse)(AVFormatContext *avctx, AVStream *st, const char *name, int size))
204 {
205  int count, i;
206  AVIOContext *pb = avctx->pb;
207  avio_skip(pb, 4);
208  count = avio_rb32(pb);
209  avio_skip(pb, 4);
210  for (i = 0; i < count; i++) {
211  char name[17];
212  int size;
213  avio_read(pb, name, 16);
214  name[sizeof(name) - 1] = 0;
215  size = avio_rb32(pb);
216  if (parse(avctx, st, name, size) < 0) {
217  avpriv_request_sample(avctx, "variable %s", name);
218  avio_skip(pb, size);
219  }
220  }
221 }
222 
223 static void read_index(AVIOContext *pb, AVStream *st)
224 {
225  uint64_t timestamp = 0;
226  int i;
227  for (i = 0; i < st->nb_frames; i++) {
228  uint32_t pos = avio_rb32(pb);
229  uint32_t size = avio_rb32(pb);
230  avio_skip(pb, 8);
231  av_add_index_entry(st, pos, timestamp, size, 0, AVINDEX_KEYFRAME);
232  if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
233  timestamp += size / (st->codec->channels * 2);
234  } else {
235  timestamp++;
236  }
237  }
238 }
239 
240 static int mv_read_header(AVFormatContext *avctx)
241 {
242  MvContext *mv = avctx->priv_data;
243  AVIOContext *pb = avctx->pb;
244  AVStream *ast = NULL, *vst = NULL; //initialization to suppress warning
245  int version, i;
246 
247  avio_skip(pb, 4);
248 
249  version = avio_rb16(pb);
250  if (version == 2) {
251  uint64_t timestamp;
252  int v;
253  avio_skip(pb, 22);
254 
255  /* allocate audio track first to prevent unnecessary seeking
256  (audio packet always precede video packet for a given frame) */
257  ast = avformat_new_stream(avctx, NULL);
258  if (!ast)
259  return AVERROR(ENOMEM);
260 
261  vst = avformat_new_stream(avctx, NULL);
262  if (!vst)
263  return AVERROR(ENOMEM);
264  vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
265  avpriv_set_pts_info(vst, 64, 1, 15);
266  vst->nb_frames = avio_rb32(pb);
267  v = avio_rb32(pb);
268  switch (v) {
269  case 1:
270  vst->codec->codec_id = AV_CODEC_ID_MVC1;
271  break;
272  case 2:
273  vst->codec->pix_fmt = AV_PIX_FMT_ARGB;
274  vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
275  break;
276  default:
277  avpriv_request_sample(avctx, "video compression %i", v);
278  break;
279  }
280  vst->codec->codec_tag = 0;
281  vst->codec->width = avio_rb32(pb);
282  vst->codec->height = avio_rb32(pb);
283  avio_skip(pb, 12);
284 
286  ast->nb_frames = vst->nb_frames;
287  ast->codec->sample_rate = avio_rb32(pb);
288  avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate);
289  if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
290  return AVERROR_INVALIDDATA;
291 
292  v = avio_rb32(pb);
293  if (v == AUDIO_FORMAT_SIGNED) {
295  } else {
296  avpriv_request_sample(avctx, "audio compression (format %i)", v);
297  }
298 
299  avio_skip(pb, 12);
300  var_read_metadata(avctx, "title", 0x80);
301  var_read_metadata(avctx, "comment", 0x100);
302  avio_skip(pb, 0x80);
303 
304  timestamp = 0;
305  for (i = 0; i < vst->nb_frames; i++) {
306  uint32_t pos = avio_rb32(pb);
307  uint32_t asize = avio_rb32(pb);
308  uint32_t vsize = avio_rb32(pb);
309  avio_skip(pb, 8);
310  av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
311  av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
312  timestamp += asize / (ast->codec->channels * 2);
313  }
314  } else if (!version && avio_rb16(pb) == 3) {
315  avio_skip(pb, 4);
316 
318 
319  if (mv->nb_audio_tracks > 1) {
320  avpriv_request_sample(avctx, "multiple audio streams support");
321  return AVERROR_PATCHWELCOME;
322  } else if (mv->nb_audio_tracks) {
323  ast = avformat_new_stream(avctx, NULL);
324  if (!ast)
325  return AVERROR(ENOMEM);
327  /* temporarily store compression value in codec_tag; format value in codec_id */
328  read_table(avctx, ast, parse_audio_var);
329  if (ast->codec->codec_tag == 100 && ast->codec->codec_id == AUDIO_FORMAT_SIGNED && ast->codec->bits_per_coded_sample == 16) {
331  } else {
332  avpriv_request_sample(avctx, "audio compression %i (format %i, width %i)",
335  }
336  ast->codec->codec_tag = 0;
337  if (ast->codec->channels <= 0) {
338  av_log(avctx, AV_LOG_ERROR, "No valid channel count found\n");
339  return AVERROR_INVALIDDATA;
340  }
341  }
342 
343  if (mv->nb_video_tracks > 1) {
344  avpriv_request_sample(avctx, "multiple video streams support");
345  return AVERROR_PATCHWELCOME;
346  } else if (mv->nb_video_tracks) {
347  vst = avformat_new_stream(avctx, NULL);
348  if (!vst)
349  return AVERROR(ENOMEM);
350  vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
351  read_table(avctx, vst, parse_video_var);
352  }
353 
354  if (mv->nb_audio_tracks)
355  read_index(pb, ast);
356 
357  if (mv->nb_video_tracks)
358  read_index(pb, vst);
359  } else {
360  avpriv_request_sample(avctx, "version %i", version);
361  return AVERROR_PATCHWELCOME;
362  }
363 
364  return 0;
365 }
366 
368 {
369  MvContext *mv = avctx->priv_data;
370  AVIOContext *pb = avctx->pb;
371  AVStream *st = avctx->streams[mv->stream_index];
372  const AVIndexEntry *index;
373  int frame = mv->frame[mv->stream_index];
374  int ret;
375  uint64_t pos;
376 
377  if (frame < st->nb_index_entries) {
378  index = &st->index_entries[frame];
379  pos = avio_tell(pb);
380  if (index->pos > pos)
381  avio_skip(pb, index->pos - pos);
382  else if (index->pos < pos) {
383  if (!pb->seekable)
384  return AVERROR(EIO);
385  ret = avio_seek(pb, index->pos, SEEK_SET);
386  if (ret < 0)
387  return ret;
388  }
389  ret = av_get_packet(pb, pkt, index->size);
390  if (ret < 0)
391  return ret;
392 
393  pkt->stream_index = mv->stream_index;
394  pkt->pts = index->timestamp;
395  pkt->flags |= AV_PKT_FLAG_KEY;
396 
397  mv->frame[mv->stream_index]++;
398  mv->eof_count = 0;
399  } else {
400  mv->eof_count++;
401  if (mv->eof_count >= avctx->nb_streams)
402  return AVERROR_EOF;
403  }
404 
405  mv->stream_index++;
406  if (mv->stream_index >= avctx->nb_streams)
407  mv->stream_index = 0;
408 
409  return 0;
410 }
411 
412 static int mv_read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags)
413 {
414  MvContext *mv = avctx->priv_data;
415  AVStream *st = avctx->streams[stream_index];
416  int frame, i;
417 
418  if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE))
419  return AVERROR(ENOSYS);
420 
421  if (!avctx->pb->seekable)
422  return AVERROR(EIO);
423 
424  frame = av_index_search_timestamp(st, timestamp, flags);
425  if (frame < 0)
426  return -1;
427 
428  for (i = 0; i < avctx->nb_streams; i++)
429  mv->frame[i] = frame;
430  return 0;
431 }
432 
434  .name = "mv",
435  .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Movie"),
436  .priv_data_size = sizeof(MvContext),
437  .read_probe = mv_probe,
441 };
const char * name
Definition: avisynth_c.h:675
float v
const char * s
Definition: avisynth_c.h:668
Bytestream IO Context.
Definition: avio.h:68
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static int mv_read_header(AVFormatContext *avctx)
Definition: mvdec.c:240
static int parse_video_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse video variable.
Definition: mvdec.c:154
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
static char * var_read_string(AVIOContext *pb, int size)
Definition: mvdec.c:51
int stream_index
current stream index
Definition: mvdec.c:38
void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
int64_t pos
Definition: avformat.h:592
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:709
int num
numerator
Definition: rational.h:44
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:199
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: avformat.h:822
static AVRational var_read_float(AVIOContext *pb, int size)
Definition: mvdec.c:73
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:256
int version
Definition: avisynth_c.h:666
#define AV_CH_LAYOUT_STEREO
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:595
static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt)
Definition: mvdec.c:367
Format I/O context.
Definition: avformat.h:944
static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
Definition: mvdec.c:84
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
Definition: vp3_parser.c:23
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static void read_table(AVFormatContext *avctx, AVStream *st, int(*parse)(AVFormatContext *avctx, AVStream *st, const char *name, int size))
Definition: mvdec.c:203
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:610
#define AV_RB32
static AVPacket pkt
Definition: demuxing.c:56
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
Definition: avformat.h:992
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:98
uint32_t tag
Definition: movenc.c:894
#define AVERROR_EOF
End of file.
Definition: error.h:55
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:248
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:478
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
frame
Definition: stft.m:14
#define AVINDEX_KEYFRAME
Definition: avformat.h:599
AVDictionary * metadata
Definition: avformat.h:1092
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:183
int eof_count
number of streams that have finished
Definition: mvdec.c:37
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
#define AV_RB16
static int mv_read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags)
Definition: mvdec.c:412
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
Definition: avformat.h:593
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
int nb_audio_tracks
Definition: mvdec.c:35
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:96
int size
int flags
A combination of AV_PKT_FLAG values.
uint64_t channel_layout
Audio channel layout.
static void read_index(AVIOContext *pb, AVStream *st)
Definition: mvdec.c:223
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:662
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:36
int frame[2]
frame nb for current stream
Definition: mvdec.c:39
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:336
unsigned int nb_streams
A list of all streams in the file.
Definition: avformat.h:991
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:117
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
Definition: rational.c:106
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that&#39;s been allocated with av_malloc() and chilren.
Definition: dict.h:72
static int read_probe(AVProbeData *pd)
ret
Definition: avfilter.c:821
int width
picture width / height.
#define AUDIO_FORMAT_SIGNED
Definition: mvdec.c:42
static int parse_audio_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse audio variable.
Definition: mvdec.c:127
int nb_video_tracks
Definition: mvdec.c:34
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:517
Stream structure.
Definition: avformat.h:643
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
double av_strtod(const char *numstr, char **tail)
Parse the string in numstr and return its value as a double.
Definition: eval.c:89
static const int8_t mv[256][2]
NULL
Definition: eval.c:55
enum AVMediaType codec_type
enum AVCodecID codec_id
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:220
int sample_rate
samples per second
AVIOContext * pb
I/O context.
Definition: avformat.h:977
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:148
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> (&#39;D&#39;<<24) + (&#39;C&#39;<<16) + (&#39;B&#39;<<8) + &#39;A&#39;).
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Definition: libcdio.c:114
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:62
double value
Definition: eval.c:82
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:73
int index
Definition: gxfenc.c:89
synthesis window for stochastic i
rational number numerator/denominator
Definition: rational.h:43
#define AVSEEK_FLAG_BYTE
seeking based on position in bytes
Definition: avformat.h:1744
This structure contains the data a format has to probe a file.
Definition: avformat.h:334
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer 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.Buffer references ownership and permissions
AVInputFormat ff_mv_demuxer
Definition: mvdec.c:433
static int var_read_int(AVIOContext *pb, int size)
Definition: mvdec.c:63
static int flags
Definition: cpu.c:23
static int parse_global_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse global variable.
Definition: mvdec.c:105
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:696
#define AVPROBE_SCORE_MAX
maximum score, half of that is used for file-extension-based detection
Definition: avformat.h:340
Main libavformat public API header.
rational numbers
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:698
int den
denominator
Definition: rational.h:45
#define MKBETAG(a, b, c, d)
Definition: common.h:283
int channels
number of audio channels
void * priv_data
Format private data.
Definition: avformat.h:964
#define AVSEEK_FLAG_FRAME
seeking based on frame number
Definition: avformat.h:1746
static int mv_probe(AVProbeData *p)
Definition: mvdec.c:44
static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
Definition: mvdec.c:91
void INT64 INT64 count
Definition: avisynth_c.h:594
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:461
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
Definition: aviobuf.c:633
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
simple arithmetic expression evaluator