FFmpeg
Data Structures | Macros | Functions | Variables
avidec.c File Reference
#include "config_components.h"
#include <inttypes.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
#include "libavutil/integer.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
#include "avi.h"
#include "demux.h"
#include "dv.h"
#include "internal.h"
#include "isom.h"
#include "riff.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/exif.h"
#include "libavcodec/startcode.h"

Go to the source code of this file.

Data Structures

struct  AVIStream
 
struct  AVIContext
 

Macros

#define MAX_ODML_DEPTH   1000
 
#define print_tag(s, str, tag, size)
 

Functions

static int avi_load_index (AVFormatContext *s)
 
static int guess_ni_flag (AVFormatContext *s)
 
static int get_duration (AVIStream *ast, int len)
 
static int get_riff (AVFormatContext *s, AVIOContext *pb)
 
static int read_odml_index (AVFormatContext *s, int64_t frame_num)
 
static void clean_index (AVFormatContext *s)
 
static int avi_read_tag (AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size)
 
static void avi_metadata_creation_time (AVDictionary **metadata, char *date)
 
static void avi_read_nikon (AVFormatContext *s, uint64_t end)
 
static int avi_extract_stream_metadata (AVFormatContext *s, AVStream *st)
 
static int calculate_bitrate (AVFormatContext *s)
 
static int avi_read_header (AVFormatContext *s)
 
static int read_gab2_sub (AVFormatContext *s, AVStream *st, AVPacket *pkt)
 
static AVStreamget_subtitle_pkt (AVFormatContext *s, AVStream *next_st, AVPacket *pkt)
 
static int get_stream_idx (const unsigned *d)
 
static int avi_sync (AVFormatContext *s, int exit_early)
 
static int ni_prepare_read (AVFormatContext *s)
 
static int avi_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int avi_read_idx1 (AVFormatContext *s, int size)
 
static int check_stream_max_drift (AVFormatContext *s)
 
static void seek_subtitle (AVStream *st, AVStream *st2, int64_t timestamp)
 
static int avi_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 
static int avi_read_close (AVFormatContext *s)
 
static int avi_probe (const AVProbeData *p)
 

Variables

static const AVOption options []
 
static const AVClass demuxer_class
 
static const char avi_headers [][8]
 
static const AVMetadataConv avi_metadata_conv []
 
static const char months [12][4]
 
const FFInputFormat ff_avi_demuxer
 

Macro Definition Documentation

◆ MAX_ODML_DEPTH

#define MAX_ODML_DEPTH   1000

Definition at line 89 of file avidec.c.

◆ print_tag

#define print_tag (   s,
  str,
  tag,
  size 
)
Value:
av_log(s, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \

Definition at line 134 of file avidec.c.

Function Documentation

◆ avi_load_index()

static int avi_load_index ( AVFormatContext s)
static

Definition at line 1799 of file avidec.c.

Referenced by avi_read_header(), and avi_read_seek().

◆ guess_ni_flag()

static int guess_ni_flag ( AVFormatContext s)
static

Definition at line 1756 of file avidec.c.

Referenced by avi_read_header().

◆ get_duration()

static int get_duration ( AVIStream ast,
int  len 
)
inlinestatic

Definition at line 138 of file avidec.c.

Referenced by avi_read_idx1(), avi_read_packet(), avi_sync(), and read_odml_index().

◆ get_riff()

static int get_riff ( AVFormatContext s,
AVIOContext pb 
)
static

Definition at line 148 of file avidec.c.

Referenced by avi_read_header().

◆ read_odml_index()

static int read_odml_index ( AVFormatContext s,
int64_t  frame_num 
)
static

Definition at line 173 of file avidec.c.

Referenced by avi_read_header().

◆ clean_index()

static void clean_index ( AVFormatContext s)
static

Definition at line 292 of file avidec.c.

Referenced by avi_read_header().

◆ avi_read_tag()

static int avi_read_tag ( AVFormatContext s,
AVStream st,
uint32_t  tag,
uint32_t  size 
)
static

Definition at line 321 of file avidec.c.

Referenced by avi_read_header().

◆ avi_metadata_creation_time()

static void avi_metadata_creation_time ( AVDictionary **  metadata,
char *  date 
)
static

Definition at line 350 of file avidec.c.

Referenced by avi_read_header().

◆ avi_read_nikon()

static void avi_read_nikon ( AVFormatContext s,
uint64_t  end 
)
static

Definition at line 369 of file avidec.c.

Referenced by avi_read_header().

◆ avi_extract_stream_metadata()

static int avi_extract_stream_metadata ( AVFormatContext s,
AVStream st 
)
static

Definition at line 413 of file avidec.c.

Referenced by avi_read_header().

◆ calculate_bitrate()

static int calculate_bitrate ( AVFormatContext s)
static

Definition at line 451 of file avidec.c.

Referenced by avi_read_header().

◆ avi_read_header()

static int avi_read_header ( AVFormatContext s)
static

Definition at line 501 of file avidec.c.

◆ read_gab2_sub()

static int read_gab2_sub ( AVFormatContext s,
AVStream st,
AVPacket pkt 
)
static

Definition at line 1111 of file avidec.c.

Referenced by avi_read_packet().

◆ get_subtitle_pkt()

static AVStream* get_subtitle_pkt ( AVFormatContext s,
AVStream next_st,
AVPacket pkt 
)
static

Definition at line 1189 of file avidec.c.

Referenced by avi_read_packet().

◆ get_stream_idx()

static int get_stream_idx ( const unsigned *  d)
static

Definition at line 1223 of file avidec.c.

Referenced by avi_sync(), and guess_ni_flag().

◆ avi_sync()

static int avi_sync ( AVFormatContext s,
int  exit_early 
)
static
Parameters
exit_earlyset to 1 to just gather packet position without making the changes needed to actually read & return the packet

Definition at line 1237 of file avidec.c.

Referenced by avi_read_idx1(), and avi_read_packet().

◆ ni_prepare_read()

static int ni_prepare_read ( AVFormatContext s)
static

Definition at line 1391 of file avidec.c.

Referenced by avi_read_packet().

◆ avi_read_packet()

static int avi_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1463 of file avidec.c.

◆ avi_read_idx1()

static int avi_read_idx1 ( AVFormatContext s,
int  size 
)
static

Definition at line 1610 of file avidec.c.

Referenced by avi_load_index().

◆ check_stream_max_drift()

static int check_stream_max_drift ( AVFormatContext s)
static

Definition at line 1698 of file avidec.c.

Referenced by guess_ni_flag().

◆ seek_subtitle()

static void seek_subtitle ( AVStream st,
AVStream st2,
int64_t  timestamp 
)
static

Definition at line 1842 of file avidec.c.

Referenced by avi_read_seek().

◆ avi_read_seek()

static int avi_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 1852 of file avidec.c.

◆ avi_read_close()

static int avi_read_close ( AVFormatContext s)
static

Definition at line 1983 of file avidec.c.

◆ avi_probe()

static int avi_probe ( const AVProbeData p)
static

Definition at line 2006 of file avidec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "use_odml", "use odml index", 0x42, AV_OPT_TYPE_BOOL, {.i64 = 1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM},
{ NULL },
}

Definition at line 94 of file avidec.c.

◆ demuxer_class

const AVClass demuxer_class
static
Initial value:
= {
.class_name = "avi",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 99 of file avidec.c.

◆ avi_headers

const char avi_headers[][8]
static
Initial value:
= {
{ 'R', 'I', 'F', 'F', 'A', 'V', 'I', ' ' },
{ 'R', 'I', 'F', 'F', 'A', 'V', 'I', 'X' },
{ 'R', 'I', 'F', 'F', 'A', 'V', 'I', 0x19 },
{ 'O', 'N', '2', ' ', 'O', 'N', '2', 'f' },
{ 'R', 'I', 'F', 'F', 'A', 'M', 'V', ' ' },
{ 0 }
}

Definition at line 108 of file avidec.c.

Referenced by avi_probe(), and get_riff().

◆ avi_metadata_conv

const AVMetadataConv avi_metadata_conv[]
static
Initial value:
= {
{ "strn", "title" },
{ "isbj", "subject" },
{ "inam", "title" },
{ "iart", "artist" },
{ "icop", "copyright" },
{ "icmt", "comment" },
{ "ignr", "genre" },
{ "iprd", "product" },
{ "isft", "software" },
{ 0 },
}

Definition at line 117 of file avidec.c.

Referenced by avi_read_header().

◆ months

const char months[12][4]
static
Initial value:
= { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }

Definition at line 347 of file avidec.c.

Referenced by avi_metadata_creation_time().

◆ ff_avi_demuxer

const FFInputFormat ff_avi_demuxer
Initial value:
= {
.p.name = "avi",
.p.long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
.p.extensions = "avi",
.p.priv_class = &demuxer_class,
.priv_data_size = sizeof(AVIContext),
.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
}

Definition at line 2019 of file avidec.c.

options
static const AVOption options[]
Definition: avidec.c:94
demuxer_class
static const AVClass demuxer_class
Definition: avidec.c:99
avi_read_close
static int avi_read_close(AVFormatContext *s)
Definition: avidec.c:1983
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
avi_read_seek
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: avidec.c:1852
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:206
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
AVIContext
Definition: avidec.c:72
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_CLASS_CATEGORY_DEMUXER
@ AV_CLASS_CATEGORY_DEMUXER
Definition: log.h:33
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
avi_read_packet
static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: avidec.c:1463
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
size
int size
Definition: twinvq_data.h:10344
avi_probe
static int avi_probe(const AVProbeData *p)
Definition: avidec.c:2006
tag
uint32_t tag
Definition: movenc.c:1791
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:273
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
avi_read_header
static int avi_read_header(AVFormatContext *s)
Definition: avidec.c:501
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:345