36 #define MLV_VERSION "v2.0" 38 #define MLV_VIDEO_CLASS_RAW 1 39 #define MLV_VIDEO_CLASS_YUV 2 40 #define MLV_VIDEO_CLASS_JPEG 3 41 #define MLV_VIDEO_CLASS_H264 4 43 #define MLV_AUDIO_CLASS_WAV 1 45 #define MLV_CLASS_FLAG_DELTA 0x40 46 #define MLV_CLASS_FLAG_LZMA 0x80 134 if (vst && type ==
MKTAG(
'R',
'A',
'W',
'I') && size >= 164) {
137 unsigned bits_per_coded_sample;
145 if (bits_per_coded_sample > (INT_MAX - 7) / (width * height)) {
147 "invalid bits_per_coded_sample %u (size: %ux%u)\n",
148 bits_per_coded_sample, width, height);
161 }
else if (ast && type ==
MKTAG(
'W',
'A',
'V',
'I') && size >= 16) {
166 }
else if (type ==
MKTAG(
'I',
'N',
'F',
'O')) {
170 }
else if (type ==
MKTAG(
'I',
'D',
'N',
'T') && size >= 36) {
172 read_uint32(avctx, pb,
"cameraModel",
"0x%"PRIx32);
178 }
else if (type ==
MKTAG(
'L',
'E',
'N',
'S') && size >= 48) {
182 read_uint8(avctx, pb,
"stabilizerMode",
"%i");
192 }
else if (vst && type ==
MKTAG(
'V',
'I',
'D',
'F') && size >= 4) {
197 }
else if (ast && type ==
MKTAG(
'A',
'U',
'D',
'F') && size >= 4) {
202 }
else if (vst && type ==
MKTAG(
'W',
'B',
'A',
'L') && size >= 28) {
211 }
else if (type ==
MKTAG(
'R',
'T',
'C',
'I') && size >= 20) {
213 struct tm time = { 0 };
224 if (strftime(str,
sizeof(str),
"%Y-%m-%d %H:%M:%S", &time))
227 }
else if (type ==
MKTAG(
'E',
'X',
'P',
'O') && size >= 16) {
237 }
else if (type ==
MKTAG(
'S',
'T',
'Y',
'L') && size >= 36) {
245 }
else if (type ==
MKTAG(
'M',
'A',
'R',
'K')) {
246 }
else if (type ==
MKTAG(
'N',
'U',
'L',
'L')) {
247 }
else if (type ==
MKTAG(
'M',
'L',
'V',
'I')) {
263 unsigned nb_video_frames, nb_audio_frames;
275 snprintf(guidstr,
sizeof(guidstr),
"0x%"PRIx64, guid);
286 if (nb_video_frames && mlv->
class[0]) {
317 if (nb_audio_frames && mlv->
class[1]) {
322 ast->nb_frames = nb_audio_frames;
343 mlv->
pb[100] = avctx->
pb;
349 if (strlen(avctx->
url) > 2) {
356 for (i = 0; i < 100; i++) {
357 snprintf(filename + strlen(filename) - 2, 3,
"%02d", i);
379 ast->duration = ast->internal->nb_index_entries;
392 avio_seek(pb, ast->internal->index_entries[0].
pos, SEEK_SET);
440 if (space > UINT_MAX - 24 || size < (24 + space))
471 mlv->
pts = timestamp;
479 for (i = 0; i < 100; i++)
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
A callback for opening new IO streams.
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)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define MLV_CLASS_FLAG_LZMA
static int read_close(AVFormatContext *s)
#define avpriv_request_sample(...)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_FLAG_READ
read-only
static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
#define MLV_CLASS_FLAG_DELTA
int id
Format-specific stream ID.
GLsizei GLboolean const GLfloat * value
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 avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int size, int big_endian)
#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)
static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, unsigned size)
#define MLV_VIDEO_CLASS_H264
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
char * url
input or output URL.
#define av_fourcc2str(fourcc)
enum AVMediaType codec_type
General type of the encoded data.
int avio_r8(AVIOContext *s)
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
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
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...
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...
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated space
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
#define AV_LOG_INFO
Standard information.
char * av_strdup(const char *s)
Duplicate a string.
AVStreamInternal * internal
An opaque field for libavformat internal usage.
AVIOContext * pb
I/O context.
static int probe(const AVProbeData *p)
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 (pair of numerator and denominator).
static int read_header(AVFormatContext *avctx)
This structure contains the data a format has to probe a file.
unsigned int index_entries_allocated_size
static void read_uint64(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt)
#define flags(name, subs,...)
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)
Utilties for rational number calculation.
#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
#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 bits_per_coded_sample
The number of bits per sample in the codedwords.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame 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.Frame references ownership and permissions
#define MKTAG(a, b, c, d)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
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