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, MuxStream *ms, 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 AVCodecContext *avctx, 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 ost_bind_filter (const Muxer *mux, MuxStream *ms, OutputFilter *ofilter, const OptionsContext *o, AVRational enc_tb, enum VideoSyncMethod vsync_method, int keep_pix_fmt, int autoscale, int threads_manual, const ViewSpecifier *vs, SchedulerNode *src)
 
static int streamcopy_init (const OptionsContext *o, const Muxer *mux, OutputStream *ost, AVDictionary **encoder_opts)
 
static int set_encoder_id (OutputStream *ost, const AVCodec *codec)
 
static int ost_add (Muxer *mux, const OptionsContext *o, enum AVMediaType type, InputStream *ist, OutputFilter *ofilter, const ViewSpecifier *vs, 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 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
 
static 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().

◆ choose_encoder()

static int choose_encoder ( const OptionsContext o,
AVFormatContext s,
MuxStream ms,
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 113 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 126 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 164 of file ffmpeg_mux_init.c.

Referenced by enc_stats_init().

◆ of_enc_stats_close()

void of_enc_stats_close ( void  )

Definition at line 197 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 207 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 246 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 378 of file ffmpeg_mux_init.c.

◆ mux_stream_alloc()

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

Definition at line 392 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 416 of file ffmpeg_mux_init.c.

Referenced by ost_bind_filter().

◆ parse_matrix_coeffs()

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

Definition at line 466 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 485 of file ffmpeg_mux_init.c.

Referenced by pix_fmt_parse().

◆ choose_pixel_fmt()

static enum AVPixelFormat choose_pixel_fmt ( const AVCodecContext avctx,
enum AVPixelFormat  target 
)
static

Definition at line 494 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 525 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 574 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 817 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 856 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ ost_bind_filter()

static int ost_bind_filter ( const Muxer mux,
MuxStream ms,
OutputFilter ofilter,
const OptionsContext o,
AVRational  enc_tb,
enum VideoSyncMethod  vsync_method,
int  keep_pix_fmt,
int  autoscale,
int  threads_manual,
const ViewSpecifier vs,
SchedulerNode src 
)
static

Definition at line 898 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ streamcopy_init()

static int streamcopy_init ( const OptionsContext o,
const Muxer mux,
OutputStream ost,
AVDictionary **  encoder_opts 
)
static

Definition at line 1014 of file ffmpeg_mux_init.c.

Referenced by ost_add().

◆ set_encoder_id()

static int set_encoder_id ( OutputStream ost,
const AVCodec codec 
)
static

Definition at line 1158 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,
const ViewSpecifier vs,
OutputStream **  post 
)
static

◆ map_auto_video()

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

Definition at line 1592 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 1645 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 1689 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 1728 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 1751 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 1836 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 1919 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 2043 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 2144 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 2220 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 2349 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 2390 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 2401 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 2497 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 2639 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 2666 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 2735 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 2765 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 2823 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 2865 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 2952 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 3024 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 3104 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 3109 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 3187 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 3233 of file ffmpeg_mux_init.c.

◆ mux_alloc()

static Muxer* mux_alloc ( void  )
static

Definition at line 3247 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 3262 of file ffmpeg_mux_init.c.

Variable Documentation

◆ enc_stats_files

EncStatsFile* 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().

◆ nb_enc_stats_files

int nb_enc_stats_files
static

Definition at line 162 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 385 of file ffmpeg_mux_init.c.

Referenced by mux_stream_alloc().

◆ forced_keyframes_const_names

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

Definition at line 3095 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 3240 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:378
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:3233
AV_CLASS_CATEGORY_MUXER
@ AV_CLASS_CATEGORY_MUXER
Definition: log.h:32