FFmpeg
Data Structures | Functions | Variables
ffmpeg_mux_init.c File Reference
#include <string.h>
#include "cmdutils.h"
#include "ffmpeg.h"
#include "ffmpeg_mux.h"
#include "ffmpeg_sched.h"
#include "fopen_utf8.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libavcodec/avcodec.h"
#include "libavfilter/avfilter.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/bprint.h"
#include "libavutil/dict.h"
#include "libavutil/display.h"
#include "libavutil/getenv_utf8.h"
#include "libavutil/iamf.h"

Go to the source code of this file.

Data Structures

struct  EncStatsFile
 

Functions

static int check_opt_bitexact (void *ctx, const AVDictionary *opts, const char *opt_name, int flag)
 
static int choose_encoder (const OptionsContext *o, AVFormatContext *s, OutputStream *ost, const AVCodec **enc)
 
static char * get_line (AVIOContext *s, AVBPrint *bprint)
 
static int get_preset_file_2 (const char *preset_name, const char *codec_name, AVIOContext **s)
 
static int enc_stats_get_file (AVIOContext **io, const char *path)
 
void of_enc_stats_close (void)
 
static int unescape (char **pdst, size_t *dst_len, const char **pstr, char delim)
 
static int enc_stats_init (OutputStream *ost, EncStats *es, int pre, const char *path, const char *fmt_spec)
 
static const char * output_stream_item_name (void *obj)
 
static MuxStreammux_stream_alloc (Muxer *mux, enum AVMediaType type)
 
static int ost_get_filters (const OptionsContext *o, AVFormatContext *oc, OutputStream *ost, char **dst)
 
static int parse_matrix_coeffs (void *logctx, uint16_t *dest, const char *str)
 
static int fmt_in_list (const int *formats, int format)
 
static enum AVPixelFormat choose_pixel_fmt (const AVCodec *codec, enum AVPixelFormat target)
 
static enum AVPixelFormat pix_fmt_parse (OutputStream *ost, const char *name)
 
static int new_stream_video (Muxer *mux, const OptionsContext *o, OutputStream *ost, int *keep_pix_fmt, enum VideoSyncMethod *vsync_method)
 
static int new_stream_audio (Muxer *mux, const OptionsContext *o, OutputStream *ost)
 
static int new_stream_subtitle (Muxer *mux, const OptionsContext *o, OutputStream *ost)
 
static int streamcopy_init (const Muxer *mux, OutputStream *ost)
 
static int ost_add (Muxer *mux, const OptionsContext *o, enum AVMediaType type, InputStream *ist, OutputFilter *ofilter, OutputStream **post)
 
static int map_auto_video (Muxer *mux, const OptionsContext *o)
 
static int map_auto_audio (Muxer *mux, const OptionsContext *o)
 
static int map_auto_subtitle (Muxer *mux, const OptionsContext *o)
 
static int map_auto_data (Muxer *mux, const OptionsContext *o)
 
static int map_manual (Muxer *mux, const OptionsContext *o, const StreamMap *map)
 
static int of_add_attachments (Muxer *mux, const OptionsContext *o)
 
static int create_streams (Muxer *mux, const OptionsContext *o)
 
static int setup_sync_queues (Muxer *mux, AVFormatContext *oc, int64_t buf_size_us, int shortest)
 
static int of_parse_iamf_audio_element_layers (Muxer *mux, AVStreamGroup *stg, char *ptr)
 
static int of_parse_iamf_submixes (Muxer *mux, AVStreamGroup *stg, char *ptr)
 
static int of_serialize_options (Muxer *mux, void *obj, AVBPrint *bp)
 
static int64_t get_stream_group_index_from_id (Muxer *mux, int64_t id)
 
static int of_map_group (Muxer *mux, AVDictionary **dict, AVBPrint *bp, const char *map)
 
static int of_parse_group_token (Muxer *mux, const char *token, char *ptr)
 
static int of_add_groups (Muxer *mux, const OptionsContext *o)
 
static int of_add_programs (Muxer *mux, const OptionsContext *o)
 
static int parse_meta_type (void *logctx, const char *arg, char *type, int *index, const char **stream_spec)
 Parse a metadata specifier passed as 'arg' parameter. More...
 
static int of_add_metadata (OutputFile *of, AVFormatContext *oc, const OptionsContext *o)
 
static int copy_chapters (InputFile *ifile, OutputFile *ofile, AVFormatContext *os, int copy_metadata)
 
static int copy_metadata (Muxer *mux, AVFormatContext *ic, const char *outspec, const char *inspec, int *metadata_global_manual, int *metadata_streams_manual, int *metadata_chapters_manual)
 
static int copy_meta (Muxer *mux, const OptionsContext *o)
 
static int set_dispositions (Muxer *mux, const OptionsContext *o)
 
static int compare_int64 (const void *a, const void *b)
 
static int parse_forced_key_frames (void *log, KeyframeForceCtx *kf, const Muxer *mux, const char *spec)
 
static int process_forced_keyframes (Muxer *mux, const OptionsContext *o)
 
static int validate_enc_avopt (Muxer *mux, const AVDictionary *codec_avopt)
 
static const char * output_file_item_name (void *obj)
 
static Muxermux_alloc (void)
 
int of_open (const OptionsContext *o, const char *filename, Scheduler *sch)
 

Variables

static EncStatsFileenc_stats_files
 
static int nb_enc_stats_files
 
static const AVClass output_stream_class
 
const char *const forced_keyframes_const_names []
 
static const AVClass output_file_class
 

Function Documentation

◆ check_opt_bitexact()

static int check_opt_bitexact ( void *  ctx,
const AVDictionary opts,
const char *  opt_name,
int  flag 
)
static

Definition at line 53 of file ffmpeg_mux_init.c.

Referenced by of_open(), and ost_add().

◆ choose_encoder()

static int choose_encoder ( const OptionsContext o,
AVFormatContext s,
OutputStream ost,
const AVCodec **  enc 
)
static

Definition at line 69 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ get_line()

static char* get_line ( AVIOContext s,
AVBPrint *  bprint 
)
static

Definition at line 112 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ get_preset_file_2()

static int get_preset_file_2 ( const char *  preset_name,
const char *  codec_name,
AVIOContext **  s 
)
static

Definition at line 125 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ enc_stats_get_file()

static int enc_stats_get_file ( AVIOContext **  io,
const char *  path 
)
static

Definition at line 163 of file ffmpeg_mux_init.c.

Referenced by enc_stats_init().

◆ of_enc_stats_close()

void of_enc_stats_close ( void  )

Definition at line 196 of file ffmpeg_mux_init.c.

Referenced by ffmpeg_cleanup().

◆ unescape()

static int unescape ( char **  pdst,
size_t *  dst_len,
const char **  pstr,
char  delim 
)
static

Definition at line 206 of file ffmpeg_mux_init.c.

Referenced by enc_stats_init().

◆ enc_stats_init()

static int enc_stats_init ( OutputStream ost,
EncStats es,
int  pre,
const char *  path,
const char *  fmt_spec 
)
static

Definition at line 245 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ output_stream_item_name()

static const char* output_stream_item_name ( void *  obj)
static

Definition at line 377 of file ffmpeg_mux_init.c.

◆ mux_stream_alloc()

static MuxStream* mux_stream_alloc ( Muxer mux,
enum AVMediaType  type 
)
static

Definition at line 391 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ ost_get_filters()

static int ost_get_filters ( const OptionsContext o,
AVFormatContext oc,
OutputStream ost,
char **  dst 
)
static

Definition at line 415 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ parse_matrix_coeffs()

static int parse_matrix_coeffs ( void *  logctx,
uint16_t *  dest,
const char *  str 
)
static

Definition at line 486 of file ffmpeg_mux_init.c.

Referenced by new_stream_video().

◆ fmt_in_list()

static int fmt_in_list ( const int formats,
int  format 
)
static

Definition at line 505 of file ffmpeg_mux_init.c.

Referenced by pix_fmt_parse().

◆ choose_pixel_fmt()

static enum AVPixelFormat choose_pixel_fmt ( const AVCodec codec,
enum AVPixelFormat  target 
)
static

Definition at line 514 of file ffmpeg_mux_init.c.

Referenced by pix_fmt_parse().

◆ pix_fmt_parse()

static enum AVPixelFormat pix_fmt_parse ( OutputStream ost,
const char *  name 
)
static

Definition at line 539 of file ffmpeg_mux_init.c.

Referenced by new_stream_video().

◆ new_stream_video()

static int new_stream_video ( Muxer mux,
const OptionsContext o,
OutputStream ost,
int keep_pix_fmt,
enum VideoSyncMethod vsync_method 
)
static

Definition at line 582 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ new_stream_audio()

static int new_stream_audio ( Muxer mux,
const OptionsContext o,
OutputStream ost 
)
static

Definition at line 828 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ new_stream_subtitle()

static int new_stream_subtitle ( Muxer mux,
const OptionsContext o,
OutputStream ost 
)
static

Definition at line 868 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ streamcopy_init()

static int streamcopy_init ( const Muxer mux,
OutputStream ost 
)
static

Definition at line 909 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ ost_add()

static int ost_add ( Muxer mux,
const OptionsContext o,
enum AVMediaType  type,
InputStream ist,
OutputFilter ofilter,
OutputStream **  post 
)
static

◆ map_auto_video()

static int map_auto_video ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 1491 of file ffmpeg_mux_init.c.

Referenced by create_streams().

◆ map_auto_audio()

static int map_auto_audio ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 1544 of file ffmpeg_mux_init.c.

Referenced by create_streams().

◆ map_auto_subtitle()

static int map_auto_subtitle ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 1588 of file ffmpeg_mux_init.c.

Referenced by create_streams().

◆ map_auto_data()

static int map_auto_data ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 1627 of file ffmpeg_mux_init.c.

Referenced by create_streams().

◆ map_manual()

static int map_manual ( Muxer mux,
const OptionsContext o,
const StreamMap map 
)
static

Definition at line 1650 of file ffmpeg_mux_init.c.

Referenced by create_streams().

◆ of_add_attachments()

static int of_add_attachments ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 1725 of file ffmpeg_mux_init.c.

Referenced by create_streams().

◆ create_streams()

static int create_streams ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 1805 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ setup_sync_queues()

static int setup_sync_queues ( Muxer mux,
AVFormatContext oc,
int64_t  buf_size_us,
int  shortest 
)
static

Definition at line 1929 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ of_parse_iamf_audio_element_layers()

static int of_parse_iamf_audio_element_layers ( Muxer mux,
AVStreamGroup stg,
char *  ptr 
)
static

Definition at line 2030 of file ffmpeg_mux_init.c.

Referenced by of_parse_group_token().

◆ of_parse_iamf_submixes()

static int of_parse_iamf_submixes ( Muxer mux,
AVStreamGroup stg,
char *  ptr 
)
static

Definition at line 2106 of file ffmpeg_mux_init.c.

Referenced by of_parse_group_token().

◆ of_serialize_options()

static int of_serialize_options ( Muxer mux,
void *  obj,
AVBPrint *  bp 
)
static

Definition at line 2235 of file ffmpeg_mux_init.c.

Referenced by of_map_group().

◆ get_stream_group_index_from_id()

static int64_t get_stream_group_index_from_id ( Muxer mux,
int64_t  id 
)
static

Definition at line 2276 of file ffmpeg_mux_init.c.

Referenced by of_map_group().

◆ of_map_group()

static int of_map_group ( Muxer mux,
AVDictionary **  dict,
AVBPrint *  bp,
const char *  map 
)
static

Definition at line 2287 of file ffmpeg_mux_init.c.

Referenced by of_parse_group_token().

◆ of_parse_group_token()

static int of_parse_group_token ( Muxer mux,
const char *  token,
char *  ptr 
)
static

Definition at line 2383 of file ffmpeg_mux_init.c.

Referenced by of_add_groups().

◆ of_add_groups()

static int of_add_groups ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 2525 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ of_add_programs()

static int of_add_programs ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 2552 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ parse_meta_type()

static int parse_meta_type ( void *  logctx,
const char *  arg,
char *  type,
int index,
const char **  stream_spec 
)
static

Parse a metadata specifier passed as 'arg' parameter.

Parameters
argmetadata string to parse
typemetadata type is written here – g(lobal)/s(tream)/c(hapter)/p(rogram)
indexfor type c/p, chapter/program index is written here
stream_specfor type s, the stream specifier is written here

Definition at line 2621 of file ffmpeg_mux_init.c.

Referenced by copy_metadata(), and of_add_metadata().

◆ of_add_metadata()

static int of_add_metadata ( OutputFile of,
AVFormatContext oc,
const OptionsContext o 
)
static

Definition at line 2651 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ copy_chapters()

static int copy_chapters ( InputFile ifile,
OutputFile ofile,
AVFormatContext os,
int  copy_metadata 
)
static

Definition at line 2709 of file ffmpeg_mux_init.c.

Referenced by copy_meta().

◆ copy_metadata()

static int copy_metadata ( Muxer mux,
AVFormatContext ic,
const char *  outspec,
const char *  inspec,
int metadata_global_manual,
int metadata_streams_manual,
int metadata_chapters_manual 
)
static

Definition at line 2751 of file ffmpeg_mux_init.c.

Referenced by copy_chapters(), and copy_meta().

◆ copy_meta()

static int copy_meta ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 2838 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ set_dispositions()

static int set_dispositions ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 2913 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ compare_int64()

static int compare_int64 ( const void *  a,
const void *  b 
)
static

Definition at line 2993 of file ffmpeg_mux_init.c.

Referenced by parse_forced_key_frames().

◆ parse_forced_key_frames()

static int parse_forced_key_frames ( void *  log,
KeyframeForceCtx kf,
const Muxer mux,
const char *  spec 
)
static

Definition at line 2998 of file ffmpeg_mux_init.c.

Referenced by process_forced_keyframes().

◆ process_forced_keyframes()

static int process_forced_keyframes ( Muxer mux,
const OptionsContext o 
)
static

Definition at line 3076 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ validate_enc_avopt()

static int validate_enc_avopt ( Muxer mux,
const AVDictionary codec_avopt 
)
static

Definition at line 3121 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ output_file_item_name()

static const char* output_file_item_name ( void *  obj)
static

Definition at line 3168 of file ffmpeg_mux_init.c.

◆ mux_alloc()

static Muxer* mux_alloc ( void  )
static

Definition at line 3182 of file ffmpeg_mux_init.c.

Referenced by of_open().

◆ of_open()

int of_open ( const OptionsContext o,
const char *  filename,
Scheduler sch 
)

Definition at line 3197 of file ffmpeg_mux_init.c.

Variable Documentation

◆ enc_stats_files

EncStatsFile* enc_stats_files
static

Definition at line 160 of file ffmpeg_mux_init.c.

Referenced by enc_stats_get_file(), and of_enc_stats_close().

◆ nb_enc_stats_files

int nb_enc_stats_files
static

Definition at line 161 of file ffmpeg_mux_init.c.

Referenced by enc_stats_get_file(), and of_enc_stats_close().

◆ output_stream_class

const AVClass output_stream_class
static
Initial value:
= {
.class_name = "OutputStream",
}

Definition at line 384 of file ffmpeg_mux_init.c.

Referenced by mux_stream_alloc().

◆ forced_keyframes_const_names

const char* const forced_keyframes_const_names[]
Initial value:
= {
"n",
"n_forced",
"prev_forced_n",
"prev_forced_t",
"t",
}

Definition at line 2984 of file ffmpeg_mux_init.c.

Referenced by process_forced_keyframes().

◆ output_file_class

const AVClass output_file_class
static
Initial value:
= {
.class_name = "OutputFile",
.item_name = output_file_item_name,
}

Definition at line 3175 of file ffmpeg_mux_init.c.

Referenced by mux_alloc().

output_stream_item_name
static const char * output_stream_item_name(void *obj)
Definition: ffmpeg_mux_init.c:377
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
output_file_item_name
static const char * output_file_item_name(void *obj)
Definition: ffmpeg_mux_init.c:3168
AV_CLASS_CATEGORY_MUXER
@ AV_CLASS_CATEGORY_MUXER
Definition: log.h:32