35 #define MLV_VERSION "v2.0"
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
42 #define MLV_AUDIO_CLASS_WAV 1
44 #define MLV_CLASS_FLAG_DELTA 0x40
45 #define MLV_CLASS_FLAG_LZMA 0x80
131 if (vst && type ==
MKTAG(
'R',
'A',
'W',
'I') && size >= 164) {
145 }
else if (ast && type ==
MKTAG(
'W',
'A',
'V',
'I') && size >= 16) {
150 }
else if (type ==
MKTAG(
'I',
'N',
'F',
'O')) {
154 }
else if (type ==
MKTAG(
'I',
'D',
'N',
'T') && size >= 36) {
156 read_uint32(avctx, pb,
"cameraModel",
"0x%"PRIx32);
162 }
else if (type ==
MKTAG(
'L',
'E',
'N',
'S') && size >= 48) {
166 read_uint8(avctx, pb,
"stabilizerMode",
"%i");
176 }
else if (vst && type ==
MKTAG(
'V',
'I',
'D',
'F') && size >= 4) {
181 }
else if (ast && type ==
MKTAG(
'A',
'U',
'D',
'F') && size >= 4) {
186 }
else if (vst && type ==
MKTAG(
'W',
'B',
'A',
'L') && size >= 28) {
195 }
else if (type ==
MKTAG(
'R',
'T',
'C',
'I') && size >= 20) {
197 struct tm time = { 0 };
208 if (strftime(str,
sizeof(str),
"%Y-%m-%d %H:%M:%S", &time))
211 }
else if (type ==
MKTAG(
'E',
'X',
'P',
'O') && size >= 16) {
221 }
else if (type ==
MKTAG(
'S',
'T',
'Y',
'L') && 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')) {
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);
246 unsigned nb_video_frames, nb_audio_frames;
258 snprintf(guidstr,
sizeof(guidstr),
"0x%"PRIx64, guid);
269 if (nb_video_frames && mlv->
class[0]) {
300 if (nb_audio_frames && mlv->
class[1]) {
305 ast->nb_frames = nb_audio_frames;
326 mlv->
pb[100] = avctx->
pb;
343 for (i = 0; i < 100; i++) {
344 snprintf(filename + strlen(filename) - 2, 3,
"%02d", i);
366 ast->duration = ast->nb_index_entries;
384 unsigned int size, space;
413 if (space > UINT_MAX - 24 || size < (24 + space))
442 mlv->
pts = timestamp;
450 for (i = 0; i < 100; i++)
static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int file)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int check_file_header(AVIOContext *pb, uint64_t guid)
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define MLV_CLASS_FLAG_LZMA
static int read_close(AVFormatContext *s)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_FLAG_READ
read-only
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
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.
int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size, int big_endian)
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.
#define MLV_CLASS_FLAG_DELTA
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
int id
Format-specific stream ID.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
#define MLV_VIDEO_CLASS_RAW
#define AVERROR_EOF
End of file.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
unsigned int avio_rl32(AVIOContext *s)
#define MLV_VIDEO_CLASS_H264
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int avio_r8(AVIOContext *s)
AVCodecContext * codec
Codec context associated with this stream.
static int read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define MLV_VIDEO_CLASS_YUV
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
char filename[1024]
input or output filename
AVInputFormat ff_mlv_demuxer
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int width
picture width / height.
GLsizei GLboolean const GLfloat * value
static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, int size)
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...
int ffio_open2_wrapper(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AV_LOG_INFO
Standard information.
enum AVMediaType codec_type
char * av_strdup(const char *s)
Duplicate the string s.
AVIOContext * pb
I/O context.
static int probe(AVProbeData *p)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
static void read_uint32(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
rational number numerator/denominator
static int read_header(AVFormatContext *avctx)
This structure contains the data a format has to probe a file.
static void read_uint64(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
static int64_t pts
Global timestamp for the audio frames.
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */
int64_t duration
Decoding: duration of the stream, in stream time base.
unsigned int avio_rl16(AVIOContext *s)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define MLV_VIDEO_CLASS_JPEG
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...
int64_t pos
position in the file of the current buffer
int64_t nb_frames
number of frames in this stream if known or 0
unsigned int index_entries_allocated_size
#define MLV_AUDIO_CLASS_WAV
void * priv_data
Format private data.
static void read_uint8(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
#define MKTAG(a, b, c, d)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
uint64_t avio_rl64(AVIOContext *s)
static void read_uint16(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
simple arithmetic expression evaluator