54#define AUDIO_FORMAT_SIGNED 401
87 v = strtol(
s,
NULL, 10);
129 if (!strcmp(
name,
"__NUM_I_TRACKS")) {
131 }
else if (!strcmp(
name,
"__NUM_A_TRACKS")) {
133 }
else if (!strcmp(
name,
"COMMENT") || !strcmp(
name,
"TITLE")) {
135 }
else if (!strcmp(
name,
"LOOP_MODE") || !strcmp(
name,
"NUM_LOOPS") ||
136 !strcmp(
name,
"OPTIMIZED")) {
153 if (!strcmp(
name,
"__DIR_COUNT")) {
155 }
else if (!strcmp(
name,
"AUDIO_FORMAT")) {
157 }
else if (!strcmp(
name,
"COMPRESSION")) {
159 }
else if (!strcmp(
name,
"DEFAULT_VOL")) {
161 }
else if (!strcmp(
name,
"NUM_CHANNELS")) {
163 }
else if (!strcmp(
name,
"SAMPLE_RATE")) {
165 if (sample_rate <= 0)
169 }
else if (!strcmp(
name,
"SAMPLE_WIDTH")) {
188 if (!strcmp(
name,
"__DIR_COUNT")) {
190 }
else if (!strcmp(
name,
"COMPRESSION")) {
194 if (!strcmp(str,
"1")) {
196 }
else if (!strcmp(str,
"2")) {
199 }
else if (!strcmp(str,
"3")) {
201 }
else if (!strcmp(str,
"10")) {
203 }
else if (!strcmp(str,
"MVC2")) {
209 }
else if (!strcmp(
name,
"FPS")) {
213 }
else if (!strcmp(
name,
"HEIGHT")) {
215 }
else if (!strcmp(
name,
"PIXEL_ASPECT")) {
220 }
else if (!strcmp(
name,
"WIDTH")) {
222 }
else if (!strcmp(
name,
"ORIENTATION")) {
231 }
else if (!strcmp(
name,
"Q_SPATIAL") || !strcmp(
name,
"Q_TEMPORAL")) {
233 }
else if (!strcmp(
name,
"INTERLACING") || !strcmp(
name,
"PACKING")) {
252 for (
i = 0;
i < count;
i++) {
277 uint64_t timestamp = 0;
308 uint32_t bytes_per_sample;
333 vst->avg_frame_rate = fps;
334 vst->duration = vst->nb_frames =
avio_rb32(pb);
348 vst->codecpar->codec_tag = 0;
367 switch (bytes_per_sample) {
382 if (bytes_per_sample == 0)
397 for (
i = 0;
i < vst->nb_frames;
i++) {
416 if (
mv->nb_audio_tracks < 0 ||
mv->nb_video_tracks < 0 ||
417 (
mv->nb_audio_tracks == 0 &&
mv->nb_video_tracks == 0)) {
422 if (
mv->nb_audio_tracks > 1) {
425 }
else if (
mv->nb_audio_tracks) {
432 if (
mv->acompression == 100 &&
438 "Audio compression %i (format %i, sr %i)",
439 mv->acompression,
mv->aformat,
449 if (
mv->nb_video_tracks > 1) {
452 }
else if (
mv->nb_video_tracks) {
461 if (
mv->nb_audio_tracks)
464 if (
mv->nb_video_tracks)
501 pkt->stream_index =
mv->stream_index;
505 mv->frame[
mv->stream_index]++;
518 mv->stream_index = 0;
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
uint64_t avio_rb64(AVIOContext *s)
unsigned int avio_rb16(AVIOContext *s)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
unsigned int avio_rb32(AVIOContext *s)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int read_probe(const AVProbeData *p)
Public libavutil channel layout APIs header.
double av_strtod(const char *numstr, char **tail)
Parse the string in numstr and return its value as a double.
simple arithmetic expression evaluator
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
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.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
static const int8_t mv[256][2]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
#define MKBETAG(a, b, c, d)
Memory handling functions.
static void read_index(AVIOContext *pb, AVStream *st)
static char * var_read_string(AVIOContext *pb, int size)
static int parse_audio_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse audio variable.
static int mv_read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags)
static int read_table(AVFormatContext *avctx, AVStream *st, int(*parse)(AVFormatContext *avctx, AVStream *st, const char *name, int size))
static int var_read_int(AVIOContext *pb, int size)
static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
static AVRational var_read_float(AVIOContext *pb, int size)
static int parse_video_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse video variable.
static int parse_global_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)
Parse global variable.
static int mv_read_header(AVFormatContext *avctx)
#define AUDIO_FORMAT_SIGNED
static int mv_probe(const AVProbeData *p)
static void var_read_metadata(AVFormatContext *avctx, const char *tag, int size)
static int mv_read_packet(AVFormatContext *avctx, AVPacket *pkt)
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Utilities for rational number calculation.
int nb_channels
Number of channels in this layout.
int extradata_size
Size of the extradata content in bytes.
int height
The height of the video frame in pixels.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVIOContext * pb
I/O context.
AVDictionary * metadata
Metadata that applies to the whole file.
void * priv_data
Format private data.
AVStream ** streams
A list of all streams in the file.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
This structure stores compressed data.
This structure contains the data a format has to probe a file.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t nb_frames
number of frames in this stream if known or 0
int64_t duration
Decoding: duration of the stream, in stream time base.
AVRational avg_frame_rate
Average framerate.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
int eof_count
number of streams that have finished
int frame[2]
frame nb for current stream
int stream_index
current stream index
int acompression
compression level for audio stream
#define avpriv_request_sample(...)