FFmpeg
Data Structures | Macros | Functions | Variables
avienc.c File Reference
#include <math.h>
#include "avformat.h"
#include "internal.h"
#include "avi.h"
#include "avio_internal.h"
#include "config_components.h"
#include "riff.h"
#include "mpegts.h"
#include "mux.h"
#include "rawutils.h"
#include "libavformat/avlanguage.h"
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/internal.h"
#include "libavutil/dict.h"
#include "libavutil/avassert.h"
#include "libavutil/timestamp.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavcodec/raw.h"

Go to the source code of this file.

Data Structures

struct  AVIIentry
 
struct  AVIIndex
 
struct  AVIContext
 
struct  AVIStream
 

Macros

#define AVI_INDEX_CLUSTER_SIZE   16384
 
#define AVI_MASTER_INDEX_PREFIX_SIZE   (8+2+1+1+4+8+4+4)
 
#define AVI_MASTER_INDEX_ENTRY_SIZE   16 /* bytes per entry */
 
#define AVI_MASTER_INDEX_SIZE_DEFAULT   256 /* number of entries */
 
#define OFFSET(x)   offsetof(AVIContext, x)
 
#define ENC   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int avi_write_packet_internal (AVFormatContext *s, AVPacket *pkt)
 
static AVIIentryavi_get_ientry (const AVIIndex *idx, int ent_id)
 
static int avi_add_ientry (AVFormatContext *s, int stream_index, char *tag, unsigned int flags, unsigned int size)
 
static av_cold int avi_init (struct AVFormatContext *s)
 
static int64_t avi_start_new_riff (AVFormatContext *s, AVIOContext *pb, const char *riff_tag, const char *list_tag)
 
static char * avi_stream2fourcc (char *tag, int index, enum AVMediaType type)
 
static int avi_write_counters (AVFormatContext *s, int riff_id)
 
static void write_odml_master (AVFormatContext *s, int stream_index)
 
static int avi_write_header (AVFormatContext *s)
 
static void update_odml_entry (AVFormatContext *s, int stream_index, int64_t ix, int size)
 
static int avi_write_ix (AVFormatContext *s)
 
static int avi_write_idx1 (AVFormatContext *s)
 
static int write_skip_frames (AVFormatContext *s, int stream_index, int64_t dts)
 
static int avi_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int avi_write_trailer (AVFormatContext *s)
 
static void avi_deinit (AVFormatContext *s)
 

Variables

static const AVOption options []
 
static const AVClass avi_muxer_class
 
const FFOutputFormat ff_avi_muxer
 

Macro Definition Documentation

◆ AVI_INDEX_CLUSTER_SIZE

#define AVI_INDEX_CLUSTER_SIZE   16384

Definition at line 56 of file avienc.c.

◆ AVI_MASTER_INDEX_PREFIX_SIZE

#define AVI_MASTER_INDEX_PREFIX_SIZE   (8+2+1+1+4+8+4+4)

Definition at line 57 of file avienc.c.

◆ AVI_MASTER_INDEX_ENTRY_SIZE

#define AVI_MASTER_INDEX_ENTRY_SIZE   16 /* bytes per entry */

Definition at line 58 of file avienc.c.

◆ AVI_MASTER_INDEX_SIZE_DEFAULT

#define AVI_MASTER_INDEX_SIZE_DEFAULT   256 /* number of entries */

Definition at line 59 of file avienc.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(AVIContext, x)

Definition at line 991 of file avienc.c.

◆ ENC

#define ENC   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 992 of file avienc.c.

Function Documentation

◆ avi_write_packet_internal()

static int avi_write_packet_internal ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 860 of file avienc.c.

Referenced by avi_write_packet(), and write_skip_frames().

◆ avi_get_ientry()

static AVIIentry* avi_get_ientry ( const AVIIndex idx,
int  ent_id 
)
inlinestatic

Definition at line 103 of file avienc.c.

Referenced by avi_write_idx1(), and avi_write_ix().

◆ avi_add_ientry()

static int avi_add_ientry ( AVFormatContext s,
int  stream_index,
char *  tag,
unsigned int  flags,
unsigned int  size 
)
static

Definition at line 110 of file avienc.c.

Referenced by avi_write_packet(), and avi_write_packet_internal().

◆ avi_init()

static av_cold int avi_init ( struct AVFormatContext s)
static

Definition at line 147 of file avienc.c.

◆ avi_start_new_riff()

static int64_t avi_start_new_riff ( AVFormatContext s,
AVIOContext pb,
const char *  riff_tag,
const char *  list_tag 
)
static

Definition at line 162 of file avienc.c.

Referenced by avi_write_header(), and avi_write_packet_internal().

◆ avi_stream2fourcc()

static char* avi_stream2fourcc ( char *  tag,
int  index,
enum AVMediaType  type 
)
static

◆ avi_write_counters()

static int avi_write_counters ( AVFormatContext s,
int  riff_id 
)
static

Definition at line 202 of file avienc.c.

Referenced by avi_write_idx1(), and avi_write_trailer().

◆ write_odml_master()

static void write_odml_master ( AVFormatContext s,
int  stream_index 
)
static

Definition at line 235 of file avienc.c.

Referenced by avi_write_header(), and avi_write_ix().

◆ avi_write_header()

static int avi_write_header ( AVFormatContext s)
static

Definition at line 260 of file avienc.c.

◆ update_odml_entry()

static void update_odml_entry ( AVFormatContext s,
int  stream_index,
int64_t  ix,
int  size 
)
static

Definition at line 597 of file avienc.c.

Referenced by avi_write_ix().

◆ avi_write_ix()

static int avi_write_ix ( AVFormatContext s)
static

Definition at line 629 of file avienc.c.

Referenced by avi_write_packet_internal(), and avi_write_trailer().

◆ avi_write_idx1()

static int avi_write_idx1 ( AVFormatContext s)
static

Definition at line 687 of file avienc.c.

Referenced by avi_write_packet_internal(), and avi_write_trailer().

◆ write_skip_frames()

static int write_skip_frames ( AVFormatContext s,
int  stream_index,
int64_t  dts 
)
static

Definition at line 742 of file avienc.c.

Referenced by avi_write_packet(), and avi_write_trailer().

◆ avi_write_packet()

static int avi_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 765 of file avienc.c.

◆ avi_write_trailer()

static int avi_write_trailer ( AVFormatContext s)
static

Definition at line 911 of file avienc.c.

◆ avi_deinit()

static void avi_deinit ( AVFormatContext s)
static

Definition at line 978 of file avienc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "reserve_index_space", "reserve space (in bytes) at the beginning of the file for each stream index", OFFSET(reserve_index_space), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, ENC },
{ "write_channel_mask", "write channel mask into wave format header", OFFSET(write_channel_mask), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, ENC },
{ "flipped_raw_rgb", "Raw RGB bitmaps are stored bottom-up", OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
{ NULL },
}

Definition at line 993 of file avienc.c.

◆ avi_muxer_class

const AVClass avi_muxer_class
static
Initial value:
= {
.class_name = "AVI muxer",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 1000 of file avienc.c.

◆ ff_avi_muxer

const FFOutputFormat ff_avi_muxer
Initial value:
= {
.p.name = "avi",
.p.long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
.p.mime_type = "video/x-msvideo",
.p.extensions = "avi",
.priv_data_size = sizeof(AVIContext),
.p.audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_AC3,
.p.video_codec = AV_CODEC_ID_MPEG4,
.init = avi_init,
.deinit = avi_deinit,
.write_header = avi_write_header,
.write_packet = avi_write_packet,
.write_trailer = avi_write_trailer,
.p.codec_tag = ff_riff_codec_tags_list,
.p.priv_class = &avi_muxer_class,
}

Definition at line 1007 of file avienc.c.

options
static const AVOption options[]
Definition: avienc.c:993
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:443
AV_CODEC_ID_MPEG4
@ AV_CODEC_ID_MPEG4
Definition: codec_id.h:64
avi_muxer_class
static const AVClass avi_muxer_class
Definition: avienc.c:1000
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:441
avi_write_trailer
static int avi_write_trailer(AVFormatContext *s)
Definition: avienc.c:911
AVIContext
Definition: avidec.c:72
avi_write_header
static int avi_write_header(AVFormatContext *s)
Definition: avienc.c:260
avi_write_packet
static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: avienc.c:765
avi_init
static av_cold int avi_init(struct AVFormatContext *s)
Definition: avienc.c:147
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
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_deinit
static void avi_deinit(AVFormatContext *s)
Definition: avienc.c:978
OFFSET
#define OFFSET(x)
Definition: avienc.c:991
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
ENC
#define ENC
Definition: avienc.c:992
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
ff_riff_codec_tags_list
const AVCodecTag *const ff_riff_codec_tags_list[]