Libav
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 Libav.
6  *
7  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
28 #include "libavutil/eval.h"
29 #include "libavutil/intreadwrite.h"
30 #include "libavutil/rational.h"
31 
32 #include "avformat.h"
33 #include "internal.h"
34 
35 typedef struct MvContext {
38 
39  int eof_count;
41  int frame[2];
42 
44  int aformat;
45 } MvContext;
46 
47 #define AUDIO_FORMAT_SIGNED 401
48 
49 static int mv_probe(AVProbeData *p)
50 {
51  if (AV_RB32(p->buf) == MKBETAG('M', 'O', 'V', 'I') &&
52  AV_RB16(p->buf + 4) < 3)
53  return AVPROBE_SCORE_MAX;
54  return 0;
55 }
56 
57 static char *var_read_string(AVIOContext *pb, int size)
58 {
59  int n;
60  char *str = av_malloc(size + 1);
61  if (!str)
62  return NULL;
63  n = avio_get_str(pb, size, str, size + 1);
64  if (n < size)
65  avio_skip(pb, size - n);
66  return str;
67 }
68 
69 static int var_read_int(AVIOContext *pb, int size)
70 {
71  int v;
72  char *s = var_read_string(pb, size);
73  if (!s)
74  return 0;
75  v = strtol(s, NULL, 10);
76  av_free(s);
77  return v;
78 }
79 
81 {
82  AVRational v;
83  char *s = var_read_string(pb, size);
84  if (!s)
85  return (AVRational) { 0, 0 };
86  v = av_d2q(av_strtod(s, NULL), INT_MAX);
87  av_free(s);
88  return v;
89 }
90 
91 static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
92 {
93  char *value = var_read_string(avctx->pb, size);
94  if (value)
95  av_dict_set(&avctx->metadata, tag, value, AV_DICT_DONT_STRDUP_VAL);
96 }
97 
98 static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
99 {
100  if (channels <= 0) {
101  av_log(avctx, AV_LOG_ERROR, "Channel count %d invalid.\n", channels);
102  return AVERROR_INVALIDDATA;
103  }
104  st->codec->channels = channels;
107  return 0;
108 }
109 
115  const char *name, int size)
116 {
117  MvContext *mv = avctx->priv_data;
118  AVIOContext *pb = avctx->pb;
119  if (!strcmp(name, "__NUM_I_TRACKS")) {
120  mv->nb_video_tracks = var_read_int(pb, size);
121  } else if (!strcmp(name, "__NUM_A_TRACKS")) {
122  mv->nb_audio_tracks = var_read_int(pb, size);
123  } else if (!strcmp(name, "COMMENT") || !strcmp(name, "TITLE")) {
124  var_read_metadata(avctx, name, size);
125  } else if (!strcmp(name, "LOOP_MODE") || !strcmp(name, "NUM_LOOPS") ||
126  !strcmp(name, "OPTIMIZED")) {
127  avio_skip(pb, size); // ignore
128  } else
129  return AVERROR_INVALIDDATA;
130 
131  return 0;
132 }
133 
138 static int parse_audio_var(AVFormatContext *avctx, AVStream *st,
139  const char *name, int size)
140 {
141  MvContext *mv = avctx->priv_data;
142  AVIOContext *pb = avctx->pb;
143  if (!strcmp(name, "__DIR_COUNT")) {
144  st->nb_frames = var_read_int(pb, size);
145  } else if (!strcmp(name, "AUDIO_FORMAT")) {
146  mv->aformat = var_read_int(pb, size);
147  } else if (!strcmp(name, "COMPRESSION")) {
148  mv->acompression = var_read_int(pb, size);
149  } else if (!strcmp(name, "DEFAULT_VOL")) {
150  var_read_metadata(avctx, name, size);
151  } else if (!strcmp(name, "NUM_CHANNELS")) {
152  return set_channels(avctx, st, var_read_int(pb, size));
153  } else if (!strcmp(name, "SAMPLE_RATE")) {
154  st->codec->sample_rate = var_read_int(pb, size);
155  avpriv_set_pts_info(st, 33, 1, st->codec->sample_rate);
156  } else if (!strcmp(name, "SAMPLE_WIDTH")) {
157  st->codec->bits_per_coded_sample = var_read_int(pb, size) * 8;
158  } else
159  return AVERROR_INVALIDDATA;
160 
161  return 0;
162 }
163 
168 static int parse_video_var(AVFormatContext *avctx, AVStream *st,
169  const char *name, int size)
170 {
171  AVIOContext *pb = avctx->pb;
172  if (!strcmp(name, "__DIR_COUNT")) {
173  st->nb_frames = st->duration = var_read_int(pb, size);
174  } else if (!strcmp(name, "COMPRESSION")) {
175  char *str = var_read_string(pb, size);
176  if (!str)
177  return AVERROR_INVALIDDATA;
178  if (!strcmp(str, "1")) {
180  } else if (!strcmp(str, "2")) {
183  } else if (!strcmp(str, "3")) {
185  } else if (!strcmp(str, "10")) {
187  } else if (!strcmp(str, "MVC2")) {
189  } else {
190  avpriv_request_sample(avctx, "Video compression %s", str);
191  }
192  av_free(str);
193  } else if (!strcmp(name, "FPS")) {
194  AVRational fps = var_read_float(pb, size);
195  avpriv_set_pts_info(st, 64, fps.den, fps.num);
196  st->avg_frame_rate = fps;
197  } else if (!strcmp(name, "HEIGHT")) {
198  st->codec->height = var_read_int(pb, size);
199  } else if (!strcmp(name, "PIXEL_ASPECT")) {
200  st->sample_aspect_ratio = var_read_float(pb, size);
203  INT_MAX);
204  } else if (!strcmp(name, "WIDTH")) {
205  st->codec->width = var_read_int(pb, size);
206  } else if (!strcmp(name, "ORIENTATION")) {
207  if (var_read_int(pb, size) == 1101) {
208  st->codec->extradata = av_strdup("BottomUp");
209  st->codec->extradata_size = 9;
210  }
211  } else if (!strcmp(name, "Q_SPATIAL") || !strcmp(name, "Q_TEMPORAL")) {
212  var_read_metadata(avctx, name, size);
213  } else if (!strcmp(name, "INTERLACING") || !strcmp(name, "PACKING")) {
214  avio_skip(pb, size); // ignore
215  } else
216  return AVERROR_INVALIDDATA;
217 
218  return 0;
219 }
220 
221 static void read_table(AVFormatContext *avctx, AVStream *st,
222  int (*parse)(AVFormatContext *avctx, AVStream *st,
223  const char *name, int size))
224 {
225  int count, i;
226  AVIOContext *pb = avctx->pb;
227  avio_skip(pb, 4);
228  count = avio_rb32(pb);
229  avio_skip(pb, 4);
230  for (i = 0; i < count; i++) {
231  char name[17];
232  int size;
233  avio_read(pb, name, 16);
234  name[sizeof(name) - 1] = 0;
235  size = avio_rb32(pb);
236  if (parse(avctx, st, name, size) < 0) {
237  avpriv_request_sample(avctx, "Variable %s", name);
238  avio_skip(pb, size);
239  }
240  }
241 }
242 
243 static void read_index(AVIOContext *pb, AVStream *st)
244 {
245  uint64_t timestamp = 0;
246  int i;
247  for (i = 0; i < st->nb_frames; i++) {
248  uint32_t pos = avio_rb32(pb);
249  uint32_t size = avio_rb32(pb);
250  avio_skip(pb, 8);
251  av_add_index_entry(st, pos, timestamp, size, 0, AVINDEX_KEYFRAME);
252  if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
253  timestamp += size / (st->codec->channels * 2);
254  } else {
255  timestamp++;
256  }
257  }
258 }
259 
260 static int mv_read_header(AVFormatContext *avctx)
261 {
262  MvContext *mv = avctx->priv_data;
263  AVIOContext *pb = avctx->pb;
264  AVStream *ast = NULL, *vst = NULL;
265  int version, i;
266 
267  avio_skip(pb, 4);
268 
269  version = avio_rb16(pb);
270  if (version == 2) {
271  uint64_t timestamp;
272  int v;
273  avio_skip(pb, 22);
274 
275  /* allocate audio track first to prevent unnecessary seeking
276  * (audio packet always precede video packet for a given frame) */
277  ast = avformat_new_stream(avctx, NULL);
278  if (!ast)
279  return AVERROR(ENOMEM);
280 
281  vst = avformat_new_stream(avctx, NULL);
282  if (!vst)
283  return AVERROR(ENOMEM);
284  avpriv_set_pts_info(vst, 64, 1, 15);
285  vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
286  vst->avg_frame_rate = av_inv_q(vst->time_base);
287  vst->nb_frames = avio_rb32(pb);
288  v = avio_rb32(pb);
289  switch (v) {
290  case 1:
291  vst->codec->codec_id = AV_CODEC_ID_MVC1;
292  break;
293  case 2:
294  vst->codec->pix_fmt = AV_PIX_FMT_ARGB;
295  vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
296  break;
297  default:
298  avpriv_request_sample(avctx, "Video compression %i", v);
299  break;
300  }
301  vst->codec->codec_tag = 0;
302  vst->codec->width = avio_rb32(pb);
303  vst->codec->height = avio_rb32(pb);
304  avio_skip(pb, 12);
305 
307  ast->nb_frames = vst->nb_frames;
308  ast->codec->sample_rate = avio_rb32(pb);
309  avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate);
310  if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
311  return AVERROR_INVALIDDATA;
312 
313  v = avio_rb32(pb);
314  if (v == AUDIO_FORMAT_SIGNED) {
316  } else {
317  avpriv_request_sample(avctx, "Audio compression (format %i)", v);
318  }
319 
320  avio_skip(pb, 12);
321  var_read_metadata(avctx, "title", 0x80);
322  var_read_metadata(avctx, "comment", 0x100);
323  avio_skip(pb, 0x80);
324 
325  timestamp = 0;
326  for (i = 0; i < vst->nb_frames; i++) {
327  uint32_t pos = avio_rb32(pb);
328  uint32_t asize = avio_rb32(pb);
329  uint32_t vsize = avio_rb32(pb);
330  if (avio_feof(pb))
331  return AVERROR_INVALIDDATA;
332  avio_skip(pb, 8);
333  av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
334  av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
335  timestamp += asize / (ast->codec->channels * 2);
336  }
337  } else if (!version && avio_rb16(pb) == 3) {
338  avio_skip(pb, 4);
339 
341 
342  if (mv->nb_audio_tracks > 1) {
343  avpriv_request_sample(avctx, "Multiple audio streams support");
344  return AVERROR_PATCHWELCOME;
345  } else if (mv->nb_audio_tracks) {
346  ast = avformat_new_stream(avctx, NULL);
347  if (!ast)
348  return AVERROR(ENOMEM);
350  read_table(avctx, ast, parse_audio_var);
351  if (mv->acompression == 100 &&
352  mv->aformat == AUDIO_FORMAT_SIGNED &&
353  ast->codec->bits_per_coded_sample == 16) {
355  } else {
356  avpriv_request_sample(avctx,
357  "Audio compression %i (format %i, sr %i)",
358  mv->acompression, mv->aformat,
361  }
362  if (ast->codec->channels <= 0) {
363  av_log(avctx, AV_LOG_ERROR, "No valid channel count found.\n");
364  return AVERROR_INVALIDDATA;
365  }
366  }
367 
368  if (mv->nb_video_tracks > 1) {
369  avpriv_request_sample(avctx, "Multiple video streams support");
370  return AVERROR_PATCHWELCOME;
371  } else if (mv->nb_video_tracks) {
372  vst = avformat_new_stream(avctx, NULL);
373  if (!vst)
374  return AVERROR(ENOMEM);
375  vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
376  read_table(avctx, vst, parse_video_var);
377  }
378 
379  if (mv->nb_audio_tracks)
380  read_index(pb, ast);
381 
382  if (mv->nb_video_tracks)
383  read_index(pb, vst);
384  } else {
385  avpriv_request_sample(avctx, "Version %i", version);
386  return AVERROR_PATCHWELCOME;
387  }
388 
389  return 0;
390 }
391 
392 static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt)
393 {
394  MvContext *mv = avctx->priv_data;
395  AVIOContext *pb = avctx->pb;
396  AVStream *st = avctx->streams[mv->stream_index];
397  const AVIndexEntry *index;
398  int frame = mv->frame[mv->stream_index];
399  int ret;
400  uint64_t pos;
401 
402  if (frame < st->nb_index_entries) {
403  index = &st->index_entries[frame];
404  pos = avio_tell(pb);
405  if (index->pos > pos)
406  avio_skip(pb, index->pos - pos);
407  else if (index->pos < pos) {
408  if (!pb->seekable)
409  return AVERROR(EIO);
410  ret = avio_seek(pb, index->pos, SEEK_SET);
411  if (ret < 0)
412  return ret;
413  }
414  ret = av_get_packet(pb, pkt, index->size);
415  if (ret < 0)
416  return ret;
417 
418  pkt->stream_index = mv->stream_index;
419  pkt->pts = index->timestamp;
420  pkt->flags |= AV_PKT_FLAG_KEY;
421 
422  mv->frame[mv->stream_index]++;
423  mv->eof_count = 0;
424  } else {
425  mv->eof_count++;
426  if (mv->eof_count >= avctx->nb_streams)
427  return AVERROR_EOF;
428 
429  // avoid returning 0 without a packet
430  return AVERROR(EAGAIN);
431  }
432 
433  mv->stream_index++;
434  if (mv->stream_index >= avctx->nb_streams)
435  mv->stream_index = 0;
436 
437  return 0;
438 }
439 
440 static int mv_read_seek(AVFormatContext *avctx, int stream_index,
441  int64_t timestamp, int flags)
442 {
443  MvContext *mv = avctx->priv_data;
444  AVStream *st = avctx->streams[stream_index];
445  int frame, i;
446 
447  if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE))
448  return AVERROR(ENOSYS);
449 
450  if (!avctx->pb->seekable)
451  return AVERROR(EIO);
452 
453  frame = av_index_search_timestamp(st, timestamp, flags);
454  if (frame < 0)
455  return AVERROR_INVALIDDATA;
456 
457  for (i = 0; i < avctx->nb_streams; i++)
458  mv->frame[i] = frame;
459  return 0;
460 }
461 
463  .name = "mv",
464  .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Movie"),
465  .priv_data_size = sizeof(MvContext),
466  .read_probe = mv_probe,
470 };
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:62
Bytestream IO Context.
Definition: avio.h:68
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:54
static int mv_read_header(AVFormatContext *avctx)
Definition: mvdec.c:260
int size
static int parse_video_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse video variable.
Definition: mvdec.c:168
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.
Definition: utils.c:1181
static char * var_read_string(AVIOContext *pb, int size)
Definition: mvdec.c:57
int stream_index
current stream index
Definition: mvdec.c:40
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.
Definition: utils.c:2829
int64_t pos
Definition: avformat.h:660
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:769
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:186
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: avformat.h:878
static AVRational var_read_float(AVIOContext *pb, int size)
Definition: mvdec.c:80
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1270
#define AV_CH_LAYOUT_STEREO
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:591
static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt)
Definition: mvdec.c:392
Format I/O context.
Definition: avformat.h:922
static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
Definition: mvdec.c:91
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:221
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:606
#define AV_RB32
Definition: intreadwrite.h:130
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1164
const char * name
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:2521
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:990
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:97
static int flags
Definition: log.c:44
uint32_t tag
Definition: movenc.c:844
#define AVERROR_EOF
End of file.
Definition: error.h:51
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.
Definition: utils.c:117
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:219
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2523
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:463
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1019
#define AVINDEX_KEYFRAME
Definition: avformat.h:662
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1130
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:186
int eof_count
number of streams that have finished
Definition: mvdec.c:39
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
Definition: utils.c:1222
#define AV_RB16
Definition: intreadwrite.h:53
#define AVERROR(e)
Definition: error.h:43
static int mv_read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags)
Definition: mvdec.c:440
int64_t timestamp
Definition: avformat.h:661
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:145
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
int nb_audio_tracks
Definition: mvdec.c:37
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:780
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:95
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:979
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:1868
static void read_index(AVIOContext *pb, AVStream *st)
Definition: mvdec.c:243
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:718
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
int frame[2]
frame nb for current stream
Definition: mvdec.c:41
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:397
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:978
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:117
audio channel layout utility functions
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
Definition: rational.c:105
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() and chilren.
Definition: dict.h:66
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
int width
picture width / height.
Definition: avcodec.h:1229
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: avio.h:210
#define AUDIO_FORMAT_SIGNED
Definition: mvdec.c:47
static int parse_audio_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse audio variable.
Definition: mvdec.c:138
int nb_video_tracks
Definition: mvdec.c:36
int acompression
compression level for audio stream
Definition: mvdec.c:43
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:544
Stream structure.
Definition: avformat.h:699
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
Definition: error.h:57
double av_strtod(const char *numstr, char **tail)
Parse the string in numstr and return its value as a double.
Definition: eval.c:80
static const int8_t mv[256][2]
Definition: 4xm.c:75
NULL
Definition: eval.c:55
enum AVMediaType codec_type
Definition: avcodec.h:1058
version
Definition: ffv1enc.c:1080
enum AVCodecID codec_id
Definition: avcodec.h:1067
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:213
int sample_rate
samples per second
Definition: avcodec.h:1807
AVIOContext * pb
I/O context.
Definition: avformat.h:964
int extradata_size
Definition: avcodec.h:1165
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:68
int index
Definition: gxfenc.c:72
rational number numerator/denominator
Definition: rational.h:43
#define AVSEEK_FLAG_BYTE
seeking based on position in bytes
Definition: avformat.h:1610
This structure contains the data a format has to probe a file.
Definition: avformat.h:395
AVInputFormat ff_mv_demuxer
Definition: mvdec.c:462
static int var_read_int(AVIOContext *pb, int size)
Definition: mvdec.c:69
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:122
static int parse_global_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse global variable.
Definition: mvdec.c:114
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:756
int aformat
audio format
Definition: mvdec.c:44
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:404
Main libavformat public API header.
rational numbers
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:758
int den
denominator
Definition: rational.h:45
#define MKBETAG(a, b, c, d)
Definition: common.h:239
int channels
number of audio channels
Definition: avcodec.h:1808
void * priv_data
Format private data.
Definition: avformat.h:950
#define AVSEEK_FLAG_FRAME
seeking based on frame number
Definition: avformat.h:1612
static int mv_probe(AVProbeData *p)
Definition: mvdec.c:49
static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
Definition: mvdec.c:98
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:525
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
Definition: aviobuf.c:629
int avio_feof(AVIOContext *s)
Definition: aviobuf.c:260
int stream_index
Definition: avcodec.h:975
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
Definition: avcodec.h:950
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:966
simple arithmetic expression evaluator