FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
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; ///< number of streams that have finished
40  int stream_index; ///< current stream index
41  int frame[2]; ///< frame nb for current stream
42 
43  int acompression; ///< compression level for audio stream
44  int aformat; ///< audio format
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;
61 
62  if (size < 0 || size == INT_MAX)
63  return NULL;
64 
65  str = av_malloc(size + 1);
66  if (!str)
67  return NULL;
68  n = avio_get_str(pb, size, str, size + 1);
69  if (n < size)
70  avio_skip(pb, size - n);
71  return str;
72 }
73 
74 static int var_read_int(AVIOContext *pb, int size)
75 {
76  int v;
77  char *s = var_read_string(pb, size);
78  if (!s)
79  return 0;
80  v = strtol(s, NULL, 10);
81  av_free(s);
82  return v;
83 }
84 
86 {
87  AVRational v;
88  char *s = var_read_string(pb, size);
89  if (!s)
90  return (AVRational) { 0, 0 };
91  v = av_d2q(av_strtod(s, NULL), INT_MAX);
92  av_free(s);
93  return v;
94 }
95 
96 static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
97 {
98  char *value = var_read_string(avctx->pb, size);
99  if (value)
100  av_dict_set(&avctx->metadata, tag, value, AV_DICT_DONT_STRDUP_VAL);
101 }
102 
103 static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
104 {
105  if (channels <= 0) {
106  av_log(avctx, AV_LOG_ERROR, "Channel count %d invalid.\n", channels);
107  return AVERROR_INVALIDDATA;
108  }
109  st->codecpar->channels = channels;
112  return 0;
113 }
114 
115 /**
116  * Parse global variable
117  * @return < 0 if unknown
118  */
120  const char *name, int size)
121 {
122  MvContext *mv = avctx->priv_data;
123  AVIOContext *pb = avctx->pb;
124  if (!strcmp(name, "__NUM_I_TRACKS")) {
125  mv->nb_video_tracks = var_read_int(pb, size);
126  } else if (!strcmp(name, "__NUM_A_TRACKS")) {
127  mv->nb_audio_tracks = var_read_int(pb, size);
128  } else if (!strcmp(name, "COMMENT") || !strcmp(name, "TITLE")) {
129  var_read_metadata(avctx, name, size);
130  } else if (!strcmp(name, "LOOP_MODE") || !strcmp(name, "NUM_LOOPS") ||
131  !strcmp(name, "OPTIMIZED")) {
132  avio_skip(pb, size); // ignore
133  } else
134  return AVERROR_INVALIDDATA;
135 
136  return 0;
137 }
138 
139 /**
140  * Parse audio variable
141  * @return < 0 if unknown
142  */
143 static int parse_audio_var(AVFormatContext *avctx, AVStream *st,
144  const char *name, int size)
145 {
146  MvContext *mv = avctx->priv_data;
147  AVIOContext *pb = avctx->pb;
148  if (!strcmp(name, "__DIR_COUNT")) {
149  st->nb_frames = var_read_int(pb, size);
150  } else if (!strcmp(name, "AUDIO_FORMAT")) {
151  mv->aformat = var_read_int(pb, size);
152  } else if (!strcmp(name, "COMPRESSION")) {
153  mv->acompression = var_read_int(pb, size);
154  } else if (!strcmp(name, "DEFAULT_VOL")) {
155  var_read_metadata(avctx, name, size);
156  } else if (!strcmp(name, "NUM_CHANNELS")) {
157  return set_channels(avctx, st, var_read_int(pb, size));
158  } else if (!strcmp(name, "SAMPLE_RATE")) {
159  st->codecpar->sample_rate = var_read_int(pb, size);
160  avpriv_set_pts_info(st, 33, 1, st->codecpar->sample_rate);
161  } else if (!strcmp(name, "SAMPLE_WIDTH")) {
162  st->codecpar->bits_per_coded_sample = var_read_int(pb, size) * 8;
163  } else
164  return AVERROR_INVALIDDATA;
165 
166  return 0;
167 }
168 
169 /**
170  * Parse video variable
171  * @return < 0 if unknown
172  */
173 static int parse_video_var(AVFormatContext *avctx, AVStream *st,
174  const char *name, int size)
175 {
176  AVIOContext *pb = avctx->pb;
177  if (!strcmp(name, "__DIR_COUNT")) {
178  st->nb_frames = st->duration = var_read_int(pb, size);
179  } else if (!strcmp(name, "COMPRESSION")) {
180  char *str = var_read_string(pb, size);
181  if (!str)
182  return AVERROR_INVALIDDATA;
183  if (!strcmp(str, "1")) {
185  } else if (!strcmp(str, "2")) {
188  } else if (!strcmp(str, "3")) {
190  } else if (!strcmp(str, "10")) {
192  } else if (!strcmp(str, "MVC2")) {
194  } else {
195  avpriv_request_sample(avctx, "Video compression %s", str);
196  }
197  av_free(str);
198  } else if (!strcmp(name, "FPS")) {
199  AVRational fps = var_read_float(pb, size);
200  avpriv_set_pts_info(st, 64, fps.den, fps.num);
201  st->avg_frame_rate = fps;
202  } else if (!strcmp(name, "HEIGHT")) {
203  st->codecpar->height = var_read_int(pb, size);
204  } else if (!strcmp(name, "PIXEL_ASPECT")) {
205  st->sample_aspect_ratio = var_read_float(pb, size);
208  INT_MAX);
209  } else if (!strcmp(name, "WIDTH")) {
210  st->codecpar->width = var_read_int(pb, size);
211  } else if (!strcmp(name, "ORIENTATION")) {
212  if (var_read_int(pb, size) == 1101) {
213  st->codecpar->extradata = av_strdup("BottomUp");
214  st->codecpar->extradata_size = 9;
215  }
216  } else if (!strcmp(name, "Q_SPATIAL") || !strcmp(name, "Q_TEMPORAL")) {
217  var_read_metadata(avctx, name, size);
218  } else if (!strcmp(name, "INTERLACING") || !strcmp(name, "PACKING")) {
219  avio_skip(pb, size); // ignore
220  } else
221  return AVERROR_INVALIDDATA;
222 
223  return 0;
224 }
225 
226 static int read_table(AVFormatContext *avctx, AVStream *st,
227  int (*parse)(AVFormatContext *avctx, AVStream *st,
228  const char *name, int size))
229 {
230  unsigned count;
231  int i;
232 
233  AVIOContext *pb = avctx->pb;
234  avio_skip(pb, 4);
235  count = avio_rb32(pb);
236  avio_skip(pb, 4);
237  for (i = 0; i < count; i++) {
238  char name[17];
239  int size;
240 
241  if (avio_feof(pb))
242  return AVERROR_EOF;
243 
244  avio_read(pb, name, 16);
245  name[sizeof(name) - 1] = 0;
246  size = avio_rb32(pb);
247  if (size < 0) {
248  av_log(avctx, AV_LOG_ERROR, "entry size %d is invalid\n", size);
249  return AVERROR_INVALIDDATA;
250  }
251  if (parse(avctx, st, name, size) < 0) {
252  avpriv_request_sample(avctx, "Variable %s", name);
253  avio_skip(pb, size);
254  }
255  }
256  return 0;
257 }
258 
259 static void read_index(AVIOContext *pb, AVStream *st)
260 {
261  uint64_t timestamp = 0;
262  int i;
263  for (i = 0; i < st->nb_frames; i++) {
264  uint32_t pos = avio_rb32(pb);
265  uint32_t size = avio_rb32(pb);
266  avio_skip(pb, 8);
267  av_add_index_entry(st, pos, timestamp, size, 0, AVINDEX_KEYFRAME);
268  if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
269  timestamp += size / (st->codecpar->channels * 2);
270  } else {
271  timestamp++;
272  }
273  }
274 }
275 
276 static int mv_read_header(AVFormatContext *avctx)
277 {
278  MvContext *mv = avctx->priv_data;
279  AVIOContext *pb = avctx->pb;
280  AVStream *ast = NULL, *vst = NULL; //initialization to suppress warning
281  int version, i;
282  int ret;
283 
284  avio_skip(pb, 4);
285 
286  version = avio_rb16(pb);
287  if (version == 2) {
288  uint64_t timestamp;
289  int v;
290  avio_skip(pb, 22);
291 
292  /* allocate audio track first to prevent unnecessary seeking
293  * (audio packet always precede video packet for a given frame) */
294  ast = avformat_new_stream(avctx, NULL);
295  if (!ast)
296  return AVERROR(ENOMEM);
297 
298  vst = avformat_new_stream(avctx, NULL);
299  if (!vst)
300  return AVERROR(ENOMEM);
301  avpriv_set_pts_info(vst, 64, 1, 15);
302  vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
303  vst->avg_frame_rate = av_inv_q(vst->time_base);
304  vst->nb_frames = avio_rb32(pb);
305  v = avio_rb32(pb);
306  switch (v) {
307  case 1:
308  vst->codecpar->codec_id = AV_CODEC_ID_MVC1;
309  break;
310  case 2:
311  vst->codecpar->format = AV_PIX_FMT_ARGB;
312  vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
313  break;
314  default:
315  avpriv_request_sample(avctx, "Video compression %i", v);
316  break;
317  }
318  vst->codecpar->codec_tag = 0;
319  vst->codecpar->width = avio_rb32(pb);
320  vst->codecpar->height = avio_rb32(pb);
321  avio_skip(pb, 12);
322 
324  ast->nb_frames = vst->nb_frames;
325  ast->codecpar->sample_rate = avio_rb32(pb);
326  if (ast->codecpar->sample_rate <= 0) {
327  av_log(avctx, AV_LOG_ERROR, "Invalid sample rate %d\n", ast->codecpar->sample_rate);
328  return AVERROR_INVALIDDATA;
329  }
330  avpriv_set_pts_info(ast, 33, 1, ast->codecpar->sample_rate);
331  if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
332  return AVERROR_INVALIDDATA;
333 
334  v = avio_rb32(pb);
335  if (v == AUDIO_FORMAT_SIGNED) {
337  } else {
338  avpriv_request_sample(avctx, "Audio compression (format %i)", v);
339  }
340 
341  avio_skip(pb, 12);
342  var_read_metadata(avctx, "title", 0x80);
343  var_read_metadata(avctx, "comment", 0x100);
344  avio_skip(pb, 0x80);
345 
346  timestamp = 0;
347  for (i = 0; i < vst->nb_frames; i++) {
348  uint32_t pos = avio_rb32(pb);
349  uint32_t asize = avio_rb32(pb);
350  uint32_t vsize = avio_rb32(pb);
351  if (avio_feof(pb))
352  return AVERROR_INVALIDDATA;
353  avio_skip(pb, 8);
354  av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
355  av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
356  timestamp += asize / (ast->codecpar->channels * 2);
357  }
358  } else if (!version && avio_rb16(pb) == 3) {
359  avio_skip(pb, 4);
360 
361  if ((ret = read_table(avctx, NULL, parse_global_var)) < 0)
362  return ret;
363 
364  if (mv->nb_audio_tracks > 1) {
365  avpriv_request_sample(avctx, "Multiple audio streams support");
366  return AVERROR_PATCHWELCOME;
367  } else if (mv->nb_audio_tracks) {
368  ast = avformat_new_stream(avctx, NULL);
369  if (!ast)
370  return AVERROR(ENOMEM);
372  if ((read_table(avctx, ast, parse_audio_var)) < 0)
373  return ret;
374  if (mv->acompression == 100 &&
375  mv->aformat == AUDIO_FORMAT_SIGNED &&
376  ast->codecpar->bits_per_coded_sample == 16) {
378  } else {
379  avpriv_request_sample(avctx,
380  "Audio compression %i (format %i, sr %i)",
381  mv->acompression, mv->aformat,
384  }
385  if (ast->codecpar->channels <= 0) {
386  av_log(avctx, AV_LOG_ERROR, "No valid channel count found.\n");
387  return AVERROR_INVALIDDATA;
388  }
389  }
390 
391  if (mv->nb_video_tracks > 1) {
392  avpriv_request_sample(avctx, "Multiple video streams support");
393  return AVERROR_PATCHWELCOME;
394  } else if (mv->nb_video_tracks) {
395  vst = avformat_new_stream(avctx, NULL);
396  if (!vst)
397  return AVERROR(ENOMEM);
398  vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
399  if ((ret = read_table(avctx, vst, parse_video_var))<0)
400  return ret;
401  }
402 
403  if (mv->nb_audio_tracks)
404  read_index(pb, ast);
405 
406  if (mv->nb_video_tracks)
407  read_index(pb, vst);
408  } else {
409  avpriv_request_sample(avctx, "Version %i", version);
410  return AVERROR_PATCHWELCOME;
411  }
412 
413  return 0;
414 }
415 
417 {
418  MvContext *mv = avctx->priv_data;
419  AVIOContext *pb = avctx->pb;
420  AVStream *st = avctx->streams[mv->stream_index];
421  const AVIndexEntry *index;
422  int frame = mv->frame[mv->stream_index];
423  int64_t ret;
424  uint64_t pos;
425 
426  if (frame < st->nb_index_entries) {
427  index = &st->index_entries[frame];
428  pos = avio_tell(pb);
429  if (index->pos > pos)
430  avio_skip(pb, index->pos - pos);
431  else if (index->pos < pos) {
432  if (!(pb->seekable & AVIO_SEEKABLE_NORMAL))
433  return AVERROR(EIO);
434  ret = avio_seek(pb, index->pos, SEEK_SET);
435  if (ret < 0)
436  return ret;
437  }
438  ret = av_get_packet(pb, pkt, index->size);
439  if (ret < 0)
440  return ret;
441 
442  pkt->stream_index = mv->stream_index;
443  pkt->pts = index->timestamp;
444  pkt->flags |= AV_PKT_FLAG_KEY;
445 
446  mv->frame[mv->stream_index]++;
447  mv->eof_count = 0;
448  } else {
449  mv->eof_count++;
450  if (mv->eof_count >= avctx->nb_streams)
451  return AVERROR_EOF;
452 
453  // avoid returning 0 without a packet
454  return AVERROR(EAGAIN);
455  }
456 
457  mv->stream_index++;
458  if (mv->stream_index >= avctx->nb_streams)
459  mv->stream_index = 0;
460 
461  return 0;
462 }
463 
464 static int mv_read_seek(AVFormatContext *avctx, int stream_index,
465  int64_t timestamp, int flags)
466 {
467  MvContext *mv = avctx->priv_data;
468  AVStream *st = avctx->streams[stream_index];
469  int frame, i;
470 
471  if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE))
472  return AVERROR(ENOSYS);
473 
474  if (!(avctx->pb->seekable & AVIO_SEEKABLE_NORMAL))
475  return AVERROR(EIO);
476 
477  frame = av_index_search_timestamp(st, timestamp, flags);
478  if (frame < 0)
479  return AVERROR_INVALIDDATA;
480 
481  for (i = 0; i < avctx->nb_streams; i++)
482  mv->frame[i] = frame;
483  return 0;
484 }
485 
487  .name = "mv",
488  .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Movie"),
489  .priv_data_size = sizeof(MvContext),
490  .read_probe = mv_probe,
494 };
#define NULL
Definition: coverity.c:32
const char * s
Definition: avisynth_c.h:768
Bytestream IO Context.
Definition: avio.h:161
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static int mv_read_header(AVFormatContext *avctx)
Definition: mvdec.c:276
static int parse_video_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse video variable.
Definition: mvdec.c:173
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:2038
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:4820
int64_t pos
Definition: avformat.h:803
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:153
channels
Definition: aptx.c:30
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: avcodec.h:3884
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:935
int num
Numerator.
Definition: rational.h:59
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:246
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: avformat.h:1102
static AVRational var_read_float(AVIOContext *pb, int size)
Definition: mvdec.c:85
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:331
int version
Definition: avisynth_c.h:766
static AVPacket pkt
#define AV_CH_LAYOUT_STEREO
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:786
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:87
static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt)
Definition: mvdec.c:416
Format I/O context.
Definition: avformat.h:1342
static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
Definition: mvdec.c:96
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.
#define av_malloc(s)
int width
Video only.
Definition: avcodec.h:3950
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:801
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:4450
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:87
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1410
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:90
static AVFrame * frame
static int flags
Definition: log.c:55
uint32_t tag
Definition: movenc.c:1455
#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.
Definition: utils.c:310
ptrdiff_t size
Definition: opengl_enc.c:101
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:557
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
uint64_t channel_layout
Audio only.
Definition: avcodec.h:3986
#define av_log(a,...)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:648
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1462
#define AVINDEX_KEYFRAME
Definition: avformat.h:810
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1580
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:2147
#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:464
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
Definition: avformat.h:804
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3880
int nb_audio_tracks
Definition: mvdec.c:37
GLsizei count
Definition: opengl_enc.c:109
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:946
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:88
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1436
int extradata_size
Size of the extradata content in bytes.
Definition: avcodec.h:3902
static int read_table(AVFormatContext *avctx, AVStream *st, int(*parse)(AVFormatContext *avctx, AVStream *st, const char *name, int size))
Definition: mvdec.c:226
static void read_index(AVIOContext *pb, AVStream *st)
Definition: mvdec.c:259
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:450
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1398
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
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
Definition: dict.h:76
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:109
#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:143
int nb_video_tracks
Definition: mvdec.c:36
int acompression
compression level for audio stream
Definition: mvdec.c:43
int n
Definition: avisynth_c.h:684
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:530
Stream structure.
Definition: avformat.h:873
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
double av_strtod(const char *numstr, char **tail)
Parse the string in numstr and return its value as a double.
Definition: eval.c:106
static const int8_t mv[256][2]
Definition: 4xm.c:77
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
Definition: avio.h:40
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:251
AVIOContext * pb
I/O context.
Definition: avformat.h:1384
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
int index
Definition: gxfenc.c:89
Rational number (pair of numerator and denominator).
Definition: rational.h:58
#define AVSEEK_FLAG_BYTE
seeking based on position in bytes
Definition: avformat.h:2487
This structure contains the data a format has to probe a file.
Definition: avformat.h:448
AVInputFormat ff_mv_demuxer
Definition: mvdec.c:486
static int var_read_int(AVIOContext *pb, int size)
Definition: mvdec.c:74
static int parse_global_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse global variable.
Definition: mvdec.c:119
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
Definition: rational.c:106
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:922
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
int sample_rate
Audio only.
Definition: avcodec.h:3994
int aformat
audio format
Definition: mvdec.c:44
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:460
Main libavformat public API header.
Utilties for rational number calculation.
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:924
int den
Denominator.
Definition: rational.h:60
#define MKBETAG(a, b, c, d)
Definition: common.h:367
#define av_free(p)
void * priv_data
Format private data.
Definition: avformat.h:1370
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: avcodec.h:3926
#define AVSEEK_FLAG_FRAME
seeking based on frame number
Definition: avformat.h:2489
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: avcodec.h:3898
static int mv_probe(AVProbeData *p)
Definition: mvdec.c:49
int channels
Audio only.
Definition: avcodec.h:3990
static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
Definition: mvdec.c:103
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:647
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1020
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
Definition: aviobuf.c:880
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
Definition: aviobuf.c:358
int stream_index
Definition: avcodec.h:1432
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
Definition: avcodec.h:1407
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1423
simple arithmetic expression evaluator
const char * name
Definition: opengl_enc.c:103