FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mlvdec.c
Go to the documentation of this file.
1 /*
2  * Magic Lantern Video (MLV) demuxer
3  * Copyright (c) 2014 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  * Magic Lantern Video (MLV) demuxer
25  */
26 
27 #include "libavutil/eval.h"
28 #include "libavutil/intreadwrite.h"
29 #include "libavutil/rational.h"
30 #include "avformat.h"
31 #include "avio_internal.h"
32 #include "internal.h"
33 #include "riff.h"
34 
35 #define MLV_VERSION "v2.0"
36 
37 #define MLV_VIDEO_CLASS_RAW 1
38 #define MLV_VIDEO_CLASS_YUV 2
39 #define MLV_VIDEO_CLASS_JPEG 3
40 #define MLV_VIDEO_CLASS_H264 4
41 
42 #define MLV_AUDIO_CLASS_WAV 1
43 
44 #define MLV_CLASS_FLAG_DELTA 0x40
45 #define MLV_CLASS_FLAG_LZMA 0x80
46 
47 typedef struct {
48  AVIOContext *pb[101];
49  int class[2];
51  uint64_t pts;
52 } MlvContext;
53 
54 static int probe(AVProbeData *p)
55 {
56  if (AV_RL32(p->buf) == MKTAG('M','L','V','I') &&
57  AV_RL32(p->buf + 4) >= 52 &&
58  !memcmp(p->buf + 8, MLV_VERSION, 5))
59  return AVPROBE_SCORE_MAX;
60  return 0;
61 }
62 
63 static int check_file_header(AVIOContext *pb, uint64_t guid)
64 {
65  unsigned int size;
66  uint8_t version[8];
67 
68  avio_skip(pb, 4);
69  size = avio_rl32(pb);
70  if (size < 52)
71  return AVERROR_INVALIDDATA;
72  avio_read(pb, version, 8);
73  if (memcmp(version, MLV_VERSION, 5) || avio_rl64(pb) != guid)
74  return AVERROR_INVALIDDATA;
75  avio_skip(pb, size - 24);
76  return 0;
77 }
78 
79 static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, int size)
80 {
81  char * value = av_malloc(size + 1);
82  if (!value) {
83  avio_skip(pb, size);
84  return;
85  }
86 
87  avio_read(pb, value, size);
88  if (!value[0]) {
89  av_free(value);
90  return;
91  }
92 
93  value[size] = 0;
94  av_dict_set(&avctx->metadata, tag, value, AV_DICT_DONT_STRDUP_VAL);
95 }
96 
97 static void read_uint8(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
98 {
99  av_dict_set_int(&avctx->metadata, tag, avio_r8(pb), 0);
100 }
101 
102 static void read_uint16(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
103 {
104  av_dict_set_int(&avctx->metadata, tag, avio_rl16(pb), 0);
105 }
106 
107 static void read_uint32(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
108 {
109  av_dict_set_int(&avctx->metadata, tag, avio_rl32(pb), 0);
110 }
111 
112 static void read_uint64(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
113 {
114  av_dict_set_int(&avctx->metadata, tag, avio_rl64(pb), 0);
115 }
116 
117 static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int file)
118 {
119  MlvContext *mlv = avctx->priv_data;
120  AVIOContext *pb = mlv->pb[file];
121  int ret;
122  while (!avio_feof(pb)) {
123  int type;
124  unsigned int size;
125  type = avio_rl32(pb);
126  size = avio_rl32(pb);
127  avio_skip(pb, 8); //timestamp
128  if (size < 16)
129  break;
130  size -= 16;
131  if (vst && type == MKTAG('R','A','W','I') && size >= 164) {
132  vst->codec->width = avio_rl16(pb);
133  vst->codec->height = avio_rl16(pb);
134  if (avio_rl32(pb) != 1)
135  avpriv_request_sample(avctx, "raw api version");
136  avio_skip(pb, 20); // pointer, width, height, pitch, frame_size
138  avio_skip(pb, 8 + 16 + 24); // black_level, white_level, xywh, active_area, exposure_bias
139  if (avio_rl32(pb) != 0x2010100) /* RGGB */
140  avpriv_request_sample(avctx, "cfa_pattern");
141  avio_skip(pb, 80); // calibration_illuminant1, color_matrix1, dynamic_range
143  vst->codec->codec_tag = MKTAG('B', 'I', 'T', 16);
144  size -= 164;
145  } else if (ast && type == MKTAG('W', 'A', 'V', 'I') && size >= 16) {
146  ret = ff_get_wav_header(avctx, pb, ast->codec, 16, 0);
147  if (ret < 0)
148  return ret;
149  size -= 16;
150  } else if (type == MKTAG('I','N','F','O')) {
151  if (size > 0)
152  read_string(avctx, pb, "info", size);
153  continue;
154  } else if (type == MKTAG('I','D','N','T') && size >= 36) {
155  read_string(avctx, pb, "cameraName", 32);
156  read_uint32(avctx, pb, "cameraModel", "0x%"PRIx32);
157  size -= 36;
158  if (size >= 32) {
159  read_string(avctx, pb, "cameraSerial", 32);
160  size -= 32;
161  }
162  } else if (type == MKTAG('L','E','N','S') && size >= 48) {
163  read_uint16(avctx, pb, "focalLength", "%i");
164  read_uint16(avctx, pb, "focalDist", "%i");
165  read_uint16(avctx, pb, "aperture", "%i");
166  read_uint8(avctx, pb, "stabilizerMode", "%i");
167  read_uint8(avctx, pb, "autofocusMode", "%i");
168  read_uint32(avctx, pb, "flags", "0x%"PRIx32);
169  read_uint32(avctx, pb, "lensID", "%"PRIi32);
170  read_string(avctx, pb, "lensName", 32);
171  size -= 48;
172  if (size >= 32) {
173  read_string(avctx, pb, "lensSerial", 32);
174  size -= 32;
175  }
176  } else if (vst && type == MKTAG('V', 'I', 'D', 'F') && size >= 4) {
177  uint64_t pts = avio_rl32(pb);
179  avio_tell(pb) - 20, pts, file, 0, AVINDEX_KEYFRAME);
180  size -= 4;
181  } else if (ast && type == MKTAG('A', 'U', 'D', 'F') && size >= 4) {
182  uint64_t pts = avio_rl32(pb);
184  avio_tell(pb) - 20, pts, file, 0, AVINDEX_KEYFRAME);
185  size -= 4;
186  } else if (vst && type == MKTAG('W','B','A','L') && size >= 28) {
187  read_uint32(avctx, pb, "wb_mode", "%"PRIi32);
188  read_uint32(avctx, pb, "kelvin", "%"PRIi32);
189  read_uint32(avctx, pb, "wbgain_r", "%"PRIi32);
190  read_uint32(avctx, pb, "wbgain_g", "%"PRIi32);
191  read_uint32(avctx, pb, "wbgain_b", "%"PRIi32);
192  read_uint32(avctx, pb, "wbs_gm", "%"PRIi32);
193  read_uint32(avctx, pb, "wbs_ba", "%"PRIi32);
194  size -= 28;
195  } else if (type == MKTAG('R','T','C','I') && size >= 20) {
196  char str[32];
197  struct tm time = { 0 };
198  time.tm_sec = avio_rl16(pb);
199  time.tm_min = avio_rl16(pb);
200  time.tm_hour = avio_rl16(pb);
201  time.tm_mday = avio_rl16(pb);
202  time.tm_mon = avio_rl16(pb);
203  time.tm_year = avio_rl16(pb);
204  time.tm_wday = avio_rl16(pb);
205  time.tm_yday = avio_rl16(pb);
206  time.tm_isdst = avio_rl16(pb);
207  avio_skip(pb, 2);
208  if (strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S", &time))
209  av_dict_set(&avctx->metadata, "time", str, 0);
210  size -= 20;
211  } else if (type == MKTAG('E','X','P','O') && size >= 16) {
212  av_dict_set(&avctx->metadata, "isoMode", avio_rl32(pb) ? "auto" : "manual", 0);
213  read_uint32(avctx, pb, "isoValue", "%"PRIi32);
214  read_uint32(avctx, pb, "isoAnalog", "%"PRIi32);
215  read_uint32(avctx, pb, "digitalGain", "%"PRIi32);
216  size -= 16;
217  if (size >= 8) {
218  read_uint64(avctx, pb, "shutterValue", "%"PRIi64);
219  size -= 8;
220  }
221  } else if (type == MKTAG('S','T','Y','L') && size >= 36) {
222  read_uint32(avctx, pb, "picStyleId", "%"PRIi32);
223  read_uint32(avctx, pb, "contrast", "%"PRIi32);
224  read_uint32(avctx, pb, "sharpness", "%"PRIi32);
225  read_uint32(avctx, pb, "saturation", "%"PRIi32);
226  read_uint32(avctx, pb, "colortone", "%"PRIi32);
227  read_string(avctx, pb, "picStyleName", 16);
228  size -= 36;
229  } else if (type == MKTAG('M','A','R','K')) {
230  } else if (type == MKTAG('N','U','L','L')) {
231  } else if (type == MKTAG('M','L','V','I')) { /* occurs when MLV and Mnn files are concatenated */
232  } else {
233  av_log(avctx, AV_LOG_INFO, "unsupported tag %c%c%c%c, size %u\n", type&0xFF, (type>>8)&0xFF, (type>>16)&0xFF, (type>>24)&0xFF, size);
234  }
235  avio_skip(pb, size);
236  }
237  return 0;
238 }
239 
240 static int read_header(AVFormatContext *avctx)
241 {
242  MlvContext *mlv = avctx->priv_data;
243  AVIOContext *pb = avctx->pb;
244  AVStream *vst = NULL, *ast = NULL;
245  int size, ret;
246  unsigned nb_video_frames, nb_audio_frames;
247  uint64_t guid;
248  char guidstr[32];
249 
250  avio_skip(pb, 4);
251  size = avio_rl32(pb);
252  if (size < 52)
253  return AVERROR_INVALIDDATA;
254 
255  avio_skip(pb, 8);
256 
257  guid = avio_rl64(pb);
258  snprintf(guidstr, sizeof(guidstr), "0x%"PRIx64, guid);
259  av_dict_set(&avctx->metadata, "guid", guidstr, 0);
260 
261  avio_skip(pb, 8); //fileNum, fileCount, fileFlags
262 
263  mlv->class[0] = avio_rl16(pb);
264  mlv->class[1] = avio_rl16(pb);
265 
266  nb_video_frames = avio_rl32(pb);
267  nb_audio_frames = avio_rl32(pb);
268 
269  if (nb_video_frames && mlv->class[0]) {
270  vst = avformat_new_stream(avctx, NULL);
271  if (!vst)
272  return AVERROR(ENOMEM);
273  vst->id = 0;
274  vst->nb_frames = nb_video_frames;
276  avpriv_request_sample(avctx, "compression");
278  switch (mlv->class[0] & ~(MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA)) {
279  case MLV_VIDEO_CLASS_RAW:
281  break;
282  case MLV_VIDEO_CLASS_YUV:
285  vst->codec->codec_tag = 0;
286  break;
289  vst->codec->codec_tag = 0;
290  break;
293  vst->codec->codec_tag = 0;
294  break;
295  default:
296  avpriv_request_sample(avctx, "unknown video class");
297  }
298  }
299 
300  if (nb_audio_frames && mlv->class[1]) {
301  ast = avformat_new_stream(avctx, NULL);
302  if (!ast)
303  return AVERROR(ENOMEM);
304  ast->id = 1;
305  ast->nb_frames = nb_audio_frames;
306  if ((mlv->class[1] & MLV_CLASS_FLAG_LZMA))
307  avpriv_request_sample(avctx, "compression");
308  if ((mlv->class[1] & ~MLV_CLASS_FLAG_LZMA) != MLV_AUDIO_CLASS_WAV)
309  avpriv_request_sample(avctx, "unknown audio class");
310 
311  ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
312  avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate);
313  }
314 
315  if (vst) {
316  AVRational framerate;
317  framerate.num = avio_rl32(pb);
318  framerate.den = avio_rl32(pb);
319  avpriv_set_pts_info(vst, 64, framerate.den, framerate.num);
320  } else
321  avio_skip(pb, 8);
322 
323  avio_skip(pb, size - 52);
324 
325  /* scan primary file */
326  mlv->pb[100] = avctx->pb;
327  ret = scan_file(avctx, vst, ast, 100);
328  if (ret < 0)
329  return ret;
330 
331  /* scan secondary files */
332  if (strlen(avctx->filename) > 2) {
333  int i;
334  char *filename = av_strdup(avctx->filename);
335  AVOpenCallback open_func = avctx->open_cb;
336 
337  if (!filename)
338  return AVERROR(ENOMEM);
339 
340  if (!open_func)
341  open_func = ffio_open2_wrapper;
342 
343  for (i = 0; i < 100; i++) {
344  snprintf(filename + strlen(filename) - 2, 3, "%02d", i);
345  if (open_func(avctx, &mlv->pb[i], filename, AVIO_FLAG_READ, &avctx->interrupt_callback, NULL) < 0)
346  break;
347  if (check_file_header(mlv->pb[i], guid) < 0) {
348  av_log(avctx, AV_LOG_WARNING, "ignoring %s; bad format or guid mismatch\n", filename);
349  avio_closep(&mlv->pb[i]);
350  continue;
351  }
352  av_log(avctx, AV_LOG_INFO, "scanning %s\n", filename);
353  ret = scan_file(avctx, vst, ast, i);
354  if (ret < 0) {
355  av_log(avctx, AV_LOG_WARNING, "ignoring %s; %s\n", filename, av_err2str(ret));
356  avio_closep(&mlv->pb[i]);
357  continue;
358  }
359  }
360  av_free(filename);
361  }
362 
363  if (vst)
364  vst->duration = vst->nb_index_entries;
365  if (ast)
366  ast->duration = ast->nb_index_entries;
367 
368  if (vst && ast)
369  avio_seek(pb, FFMIN(vst->index_entries[0].pos, ast->index_entries[0].pos), SEEK_SET);
370  else if (vst)
371  avio_seek(pb, vst->index_entries[0].pos, SEEK_SET);
372  else if (ast)
373  avio_seek(pb, ast->index_entries[0].pos, SEEK_SET);
374 
375  return 0;
376 }
377 
379 {
380  MlvContext *mlv = avctx->priv_data;
381  AVIOContext *pb;
382  AVStream *st = avctx->streams[mlv->stream_index];
383  int index, ret;
384  unsigned int size, space;
385 
386  if (mlv->pts >= st->duration)
387  return AVERROR_EOF;
388 
389  index = av_index_search_timestamp(st, mlv->pts, AVSEEK_FLAG_ANY);
390  if (index < 0) {
391  av_log(avctx, AV_LOG_ERROR, "could not find index entry for frame %"PRId64"\n", mlv->pts);
392  return AVERROR(EIO);
393  }
394 
395  pb = mlv->pb[st->index_entries[index].size];
396  avio_seek(pb, st->index_entries[index].pos, SEEK_SET);
397 
398  avio_skip(pb, 4); // blockType
399  size = avio_rl32(pb);
400  if (size < 16)
401  return AVERROR_INVALIDDATA;
402  avio_skip(pb, 12); //timestamp, frameNumber
403  if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
404  avio_skip(pb, 8); // cropPosX, cropPosY, panPosX, panPosY
405  space = avio_rl32(pb);
406  avio_skip(pb, space);
407 
408  if ((mlv->class[st->id] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA))) {
409  ret = AVERROR_PATCHWELCOME;
410  } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
411  ret = av_get_packet(pb, pkt, (st->codec->width * st->codec->height * st->codec->bits_per_coded_sample + 7) >> 3);
412  } else { // AVMEDIA_TYPE_AUDIO
413  if (space > UINT_MAX - 24 || size < (24 + space))
414  return AVERROR_INVALIDDATA;
415  ret = av_get_packet(pb, pkt, size - (24 + space));
416  }
417 
418  if (ret < 0)
419  return ret;
420 
421  pkt->stream_index = mlv->stream_index;
422  pkt->pts = mlv->pts;
423 
424  mlv->stream_index++;
425  if (mlv->stream_index == avctx->nb_streams) {
426  mlv->stream_index = 0;
427  mlv->pts++;
428  }
429  return 0;
430 }
431 
432 static int read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags)
433 {
434  MlvContext *mlv = avctx->priv_data;
435 
436  if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE))
437  return AVERROR(ENOSYS);
438 
439  if (!avctx->pb->seekable)
440  return AVERROR(EIO);
441 
442  mlv->pts = timestamp;
443  return 0;
444 }
445 
447 {
448  MlvContext *mlv = s->priv_data;
449  int i;
450  for (i = 0; i < 100; i++)
451  if (mlv->pb[i])
452  avio_closep(&mlv->pb[i]);
453  return 0;
454 }
455 
457  .name = "mlv",
458  .long_name = NULL_IF_CONFIG_SMALL("Magic Lantern Video (MLV)"),
459  .priv_data_size = sizeof(MlvContext),
460  .read_probe = probe,
464  .read_seek = read_seek,
465 };
#define NULL
Definition: coverity.c:32
static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int file)
Definition: mlvdec.c:117
int stream_index
Definition: mlvdec.c:50
const char * s
Definition: avisynth_c.h:631
Bytestream IO Context.
Definition: avio.h:111
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static int check_file_header(AVIOContext *pb, uint64_t guid)
Definition: mlvdec.c:63
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
Definition: avformat.h:1523
const char * fmt
Definition: avisynth_c.h:632
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
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:4083
int64_t pos
Definition: avformat.h:784
#define MLV_CLASS_FLAG_LZMA
Definition: mlvdec.c:45
#define AVSEEK_FLAG_ANY
seek to any frame, even non-keyframes
Definition: avformat.h:2279
static int read_close(AVFormatContext *s)
Definition: mlvdec.c:446
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:204
#define AVIO_FLAG_READ
read-only
Definition: avio.h:485
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: avformat.h:1045
static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
Definition: mlvdec.c:378
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1722
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:277
int version
Definition: avisynth_c.h:629
static AVPacket pkt
int(* open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Called to open further IO contexts when needed for demuxing.
Definition: avformat.h:1821
#define MLV_CLASS_FLAG_DELTA
Definition: mlvdec.c:44
Format I/O context.
Definition: avformat.h:1273
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t
#define av_malloc(s)
int id
Format-specific stream ID.
Definition: avformat.h:849
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:3749
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1341
#define MLV_VIDEO_CLASS_RAW
Definition: mlvdec.c:37
uint32_t tag
Definition: movenc.c:1334
#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:244
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:390
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2996
#define av_log(a,...)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:538
#define AVINDEX_KEYFRAME
Definition: avformat.h:791
#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:1485
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
Definition: utils.c:1844
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:659
#define AVERROR(e)
Definition: error.h:43
#define MLV_VIDEO_CLASS_H264
Definition: mlvdec.c:40
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:529
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:861
static int read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags)
Definition: mlvdec.c:432
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:450
#define MLV_VIDEO_CLASS_YUV
Definition: mlvdec.c:38
AVIOContext * pb[101]
Definition: mlvdec.c:48
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1329
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
Definition: avio.h:160
char filename[1024]
input or output filename
Definition: avformat.h:1349
#define FFMIN(a, b)
Definition: common.h:81
AVInputFormat ff_mlv_demuxer
Definition: mlvdec.c:456
#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:78
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
int width
picture width / height.
Definition: avcodec.h:1681
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:109
static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, int size)
Definition: mlvdec.c:79
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:119
int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Definition: aviobuf.c:935
#define MLV_VERSION
Definition: mlvdec.c:35
Stream structure.
Definition: avformat.h:842
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
int ff_add_index_entry(AVIndexEntry **index_entries, int *nb_index_entries, unsigned int *index_entries_allocated_size, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Internal version of av_add_index_entry.
Definition: utils.c:1686
enum AVMediaType codec_type
Definition: avcodec.h:1510
enum AVCodecID codec_id
Definition: avcodec.h:1519
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:267
AVIOContext * pb
I/O context.
Definition: avformat.h:1315
static int probe(AVProbeData *p)
Definition: mlvdec.c:54
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1534
GLint GLenum type
Definition: opengl_enc.c:105
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:69
int nb_index_entries
Definition: avformat.h:1047
static void read_uint32(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
Definition: mlvdec.c:107
int index
Definition: gxfenc.c:89
rational number numerator/denominator
Definition: rational.h:43
#define AVSEEK_FLAG_BYTE
seeking based on position in bytes
Definition: avformat.h:2278
#define snprintf
Definition: snprintf.h:34
static int read_header(AVFormatContext *avctx)
Definition: mlvdec.c:240
int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecContext *codec, int size, int big_endian)
Definition: riffdec.c:86
This structure contains the data a format has to probe a file.
Definition: avformat.h:448
static void read_uint64(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
Definition: mlvdec.c:112
static int64_t pts
Global timestamp for the audio frames.
static int flags
Definition: cpu.c:47
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
Definition: pixfmt.h:310
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:901
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:460
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:643
Main libavformat public API header.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:63
rational numbers
#define MLV_VIDEO_CLASS_JPEG
Definition: mlvdec.c:39
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set that converts the value to a string and stores it...
Definition: dict.c:143
int64_t pos
position in the file of the current buffer
Definition: avio.h:137
int class[2]
Definition: mlvdec.c:49
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:903
int den
denominator
Definition: rational.h:45
unsigned int index_entries_allocated_size
Definition: avformat.h:1048
#define av_free(p)
int(* AVOpenCallback)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Definition: avformat.h:1250
#define MLV_AUDIO_CLASS_WAV
Definition: mlvdec.c:42
void * priv_data
Format private data.
Definition: avformat.h:1301
static void read_uint8(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
Definition: mlvdec.c:97
#define AVSEEK_FLAG_FRAME
seeking based on frame number
Definition: avformat.h:2280
uint64_t pts
Definition: mlvdec.c:51
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:628
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
Definition: aviobuf.c:301
int stream_index
Definition: avcodec.h:1425
#define MKTAG(a, b, c, d)
Definition: common.h:330
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:87
This structure stores compressed data.
Definition: avcodec.h:1400
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
Definition: aviobuf.c:959
uint64_t avio_rl64(AVIOContext *s)
Definition: aviobuf.c:667
static void read_uint16(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
Definition: mlvdec.c:102
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1416
simple arithmetic expression evaluator