# FFmpegKit Linux API: fftools_opt_common.c File Reference

fftools_opt_common.c File Reference

Go to the source code of this file.

## Macros

#define | INDENT 1
#define | SHOW_VERSION 2
#define | SHOW_CONFIG 4
#define | SHOW_COPYRIGHT 8
#define | PRINT_LIB_INFO(libname, LIBNAME, flags, level)
#define | PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name)
#define | sws_isSupportedInput(x) 0
#define | sws_isSupportedOutput(x) 0

## Enumerations

enum | show_muxdemuxers { SHOW_DEFAULT , SHOW_DEMUXERS , SHOW_MUXERS }

## Functions

void | ffmpegkit_log_callback_function (void *ptr, int level, const char *format, va_list vargs)
int | show_license (void *optctx, const char *opt, const char *arg)
static void | print_all_libs_info (int flags, int level)
static void | print_program_info (int flags, int level)
static void | print_buildconf (int flags, int level)
void | show_banner (int argc, char **argv, const OptionDef *options)
int | show_version (void *optctx, const char *opt, const char *arg)
int | show_buildconf (void *optctx, const char *opt, const char *arg)
static void | print_codec (const AVCodec *c)
static const AVCodec * | next_codec_for_id (enum AVCodecID id, void **iter, int encoder)
static void | show_help_codec (const char *name, int encoder)
static void | show_help_demuxer (const char *name)
static void | show_help_protocol (const char *name)
static void | show_help_muxer (const char *name)
static void | show_help_bsf (const char *name)
int | show_help (void *optctx, const char *opt, const char *arg)
static void | print_codecs_for_id (enum AVCodecID id, int encoder)
static int | compare_codec_desc (const void *a, const void *b)
static unsigned | get_codecs_sorted (const AVCodecDescriptor ***rcodecs)
static char | get_media_type_char (enum AVMediaType type)
int | show_codecs (void *optctx, const char *opt, const char *arg)
static void | print_codecs (int encoder)
int | show_decoders (void *optctx, const char *opt, const char *arg)
int | show_encoders (void *optctx, const char *opt, const char *arg)
int | show_bsfs (void *optctx, const char *opt, const char *arg)
int | show_filters (void *optctx, const char *opt, const char *arg)
static int | is_device (const AVClass *avclass)
static int | show_formats_devices (void *optctx, const char *opt, const char *arg, int device_only, int muxdemuxers)
int | show_formats (void *optctx, const char *opt, const char *arg)
int | show_muxers (void *optctx, const char *opt, const char *arg)
int | show_demuxers (void *optctx, const char *opt, const char *arg)
int | show_devices (void *optctx, const char *opt, const char *arg)
int | show_protocols (void *optctx, const char *opt, const char *arg)
int | show_colors (void *optctx, const char *opt, const char *arg)
int | show_pix_fmts (void *optctx, const char *opt, const char *arg)
int | show_layouts (void *optctx, const char *opt, const char *arg)
int | show_sample_fmts (void *optctx, const char *opt, const char *arg)
int | show_dispositions (void *optctx, const char *opt, const char *arg)
int | opt_cpuflags (void *optctx, const char *opt, const char *arg)
int | opt_cpucount (void *optctx, const char *opt, const char *arg)
static void | expand_filename_template (AVBPrint *bp, const char *template, struct tm *tm)
static void | log_callback_report (void *ptr, int level, const char *fmt, va_list vl)
int | init_report (const char *env, FILE **file)
int | opt_report (void *optctx, const char *opt, const char *arg)
int | opt_max_alloc (void *optctx, const char *opt, const char *arg)
int | opt_loglevel (void *optctx, const char *opt, const char *arg)

## Variables

static __thread FILE * | report_file = NULL
static __thread int | report_file_level = AV_LOG_DEBUG
void(* | report_callback )(int, float, float, int64_t, int, double, double)
__thread char * | program_name
__thread int | warned_cfg = 0

## Macro Definition Documentation

## INDENT

#define INDENT 1

Definition at line 170 of file fftools_opt_common.c.

## PRINT_CODEC_SUPPORTED

#define PRINT_CODEC_SUPPORTED | ( |  | codec,
|  |  | field,
|  |  | type,
|  |  | list_name,
|  |  | term,
|  |  | get_name
| ) |  |

Value:
if (codec->field) { \
const type *p = codec->field; \
\
av_log(NULL, AV_LOG_ERROR, " Supported " list_name ":"); \
while (*p != term) { \
get_name(*p); \
av_log(NULL, AV_LOG_ERROR, " %s", name); \
p++; \
} \
av_log(NULL, AV_LOG_ERROR, "\n"); \
} \

Definition at line 281 of file fftools_opt_common.c.

## PRINT_LIB_INFO

#define PRINT_LIB_INFO | ( |  | libname,
|  |  | LIBNAME,
|  |  | flags,
|  |  | level
| ) |  |

Value:
if (CONFIG_##LIBNAME) { \
const char *indent = flags & INDENT? " " : ""; \
if (flags & SHOW_VERSION) { \
unsigned int version = libname##_version(); \
av_log(NULL, level, \
"%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n", \
indent, #libname, \
LIB##LIBNAME##_VERSION_MAJOR, \
LIB##LIBNAME##_VERSION_MINOR, \
LIB##LIBNAME##_VERSION_MICRO, \
AV_VERSION_MAJOR(version), AV_VERSION_MINOR(version),\
AV_VERSION_MICRO(version)); \
} \
if (flags & SHOW_CONFIG) { \
const char *cfg = libname##_configuration(); \
if (strcmp(FFMPEG_CONFIGURATION, cfg)) { \
if (!warned_cfg) { \
av_log(NULL, level, \
"%sWARNING: library configuration mismatch\n", \
indent); \
warned_cfg = 1; \
} \
av_log(NULL, level, "%s%-11s configuration: %s\n", \
indent, #libname, cfg); \
} \
} \
} \
SHOW_CONFIG
#define SHOW_CONFIG
Definition: fftools_opt_common.c:172
SHOW_VERSION
#define SHOW_VERSION
Definition: fftools_opt_common.c:171
INDENT
#define INDENT
Definition: fftools_opt_common.c:170
warned_cfg
__thread int warned_cfg
Definition: fftools_opt_common.c:168

Definition at line 175 of file fftools_opt_common.c.

## SHOW_CONFIG

#define SHOW_CONFIG 4

Definition at line 172 of file fftools_opt_common.c.

## SHOW_COPYRIGHT

#define SHOW_COPYRIGHT 8

Definition at line 173 of file fftools_opt_common.c.

## SHOW_VERSION

#define SHOW_VERSION 2

Definition at line 171 of file fftools_opt_common.c.

## sws_isSupportedInput

#define sws_isSupportedInput | ( |  | x | ) | 0

## sws_isSupportedOutput

#define sws_isSupportedOutput | ( |  | x | ) | 0

## Enumeration Type Documentation

## show_muxdemuxers

enum show_muxdemuxers

Enumerator
SHOW_DEFAULT |
SHOW_DEMUXERS |
SHOW_MUXERS |

Definition at line 81 of file fftools_opt_common.c.

## Function Documentation

## compare_codec_desc()

static int compare_codec_desc | ( | const void * | a,
|  | const void * | b
| ) |  |

static

Definition at line 648 of file fftools_opt_common.c.

## expand_filename_template()

static void expand_filename_template | ( | AVBPrint * | bp,
|  | const char * | template,
|  | struct tm * | tm
| ) |  |

static

Definition at line 1107 of file fftools_opt_common.c.

## ffmpegkit_log_callback_function()

void ffmpegkit_log_callback_function | ( | void * | ptr,
|  | int | level,
|  | const char * | format,
|  | va_list | vargs
| ) |  |

Callback function for FFmpeg/FFprobe logs.

Parameters

  ptr | pointer to AVClass struct
  level | log level
  format | format string
  vargs | arguments

Definition at line 470 of file FFmpegKitConfig.cpp.

## get_codecs_sorted()

static unsigned get_codecs_sorted | ( | const AVCodecDescriptor *** | rcodecs | ) |

static

Definition at line 657 of file fftools_opt_common.c.

## get_media_type_char()

static char get_media_type_char | ( | enum AVMediaType | type | ) |

static

Definition at line 678 of file fftools_opt_common.c.

## init_report()

int init_report | ( | const char * | env,
|  | FILE ** | file
| ) |  |

Definition at line 1155 of file fftools_opt_common.c.

## is_device()

static int is_device | ( | const AVClass * | avclass | ) |

static

Definition at line 860 of file fftools_opt_common.c.

## log_callback_report()

static void log_callback_report | ( | void * | ptr,
|  | int | level,
|  | const char * | fmt,
|  | va_list | vl
| ) |  |

static

Definition at line 1135 of file fftools_opt_common.c.

## next_codec_for_id()

static const AVCodec * next_codec_for_id | ( | enum AVCodecID | id,
|  | void ** | iter,
|  | int | encoder
| ) |  |

static

Definition at line 398 of file fftools_opt_common.c.

## opt_cpucount()

int opt_cpucount | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Override the cpucount.

Definition at line 1081 of file fftools_opt_common.c.

## opt_cpuflags()

int opt_cpuflags | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Override the cpuflags.

Definition at line 1069 of file fftools_opt_common.c.

## opt_loglevel()

int opt_loglevel | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Set the libav* libraries log level.

Definition at line 1256 of file fftools_opt_common.c.

## opt_max_alloc()

int opt_max_alloc | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Definition at line 1242 of file fftools_opt_common.c.

## opt_report()

int opt_report | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Definition at line 1237 of file fftools_opt_common.c.

## print_all_libs_info()

static void print_all_libs_info | ( | int | flags,
|  | int | level
| ) |  |

static

Definition at line 204 of file fftools_opt_common.c.

## print_buildconf()

static void print_buildconf | ( | int | flags,
|  | int | level
| ) |  |

static

Definition at line 229 of file fftools_opt_common.c.

## print_codec()

static void print_codec | ( | const AVCodec * | c | ) |

static

Definition at line 294 of file fftools_opt_common.c.

## print_codecs()

static void print_codecs | ( | int | encoder | ) |

static

Definition at line 748 of file fftools_opt_common.c.

## print_codecs_for_id()

static void print_codecs_for_id | ( | enum AVCodecID | id,
|  | int | encoder
| ) |  |

static

Definition at line 635 of file fftools_opt_common.c.

## print_program_info()

static void print_program_info | ( | int | flags,
|  | int | level
| ) |  |

static

Definition at line 215 of file fftools_opt_common.c.

## show_banner()

void show_banner | ( | int | argc,
|  | char ** | argv,
|  | const OptionDef * | options
| ) |  |

Print the program banner to stderr. The banner contents depend on the current version of the repository and of the libav* libraries used by the program.

Definition at line 255 of file fftools_opt_common.c.

## show_bsfs()

int show_bsfs | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the bit stream filters supported by the program. This option processing function does not utilize the arguments.

Definition at line 799 of file fftools_opt_common.c.

## show_buildconf()

int show_buildconf | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print the build configuration of the program to stdout. The contents depend on the definition of FFMPEG_CONFIGURATION. This option processing function does not utilize the arguments.

Definition at line 274 of file fftools_opt_common.c.

## show_codecs()

int show_codecs | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the codecs supported by the program. This option processing function does not utilize the arguments.

Definition at line 690 of file fftools_opt_common.c.

## show_colors()

int show_colors | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the color names and values recognized by the program.

Definition at line 965 of file fftools_opt_common.c.

## show_decoders()

int show_decoders | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the decoders supported by the program.

Definition at line 787 of file fftools_opt_common.c.

## show_demuxers()

int show_demuxers | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the demuxer supported by the program (including devices). This option processing function does not utilize the arguments.

Definition at line 940 of file fftools_opt_common.c.

## show_devices()

int show_devices | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the devices supported by the program. This option processing function does not utilize the arguments.

Definition at line 945 of file fftools_opt_common.c.

## show_dispositions()

int show_dispositions | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all supported stream dispositions.

Definition at line 1059 of file fftools_opt_common.c.

## show_encoders()

int show_encoders | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the encoders supported by the program.

Definition at line 793 of file fftools_opt_common.c.

## show_filters()

int show_filters | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the filters supported by the program. This option processing function does not utilize the arguments.

Definition at line 811 of file fftools_opt_common.c.

## show_formats()

int show_formats | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the formats supported by the program (including devices). This option processing function does not utilize the arguments.

Definition at line 930 of file fftools_opt_common.c.

## show_formats_devices()

static int show_formats_devices | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg,
|  | int | device_only,
|  | int | muxdemuxers
| ) |  |

static

Definition at line 867 of file fftools_opt_common.c.

## show_help()

int show_help | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Generic -h handler common to all fftools.

Definition at line 590 of file fftools_opt_common.c.

## show_help_bsf()

static void show_help_bsf | ( | const char * | name | ) |

static

Definition at line 571 of file fftools_opt_common.c.

## show_help_codec()

static void show_help_codec | ( | const char * | name,
|  | int | encoder
| ) |  |

static

Definition at line 410 of file fftools_opt_common.c.

## show_help_demuxer()

static void show_help_demuxer | ( | const char * | name | ) |

static

Definition at line 446 of file fftools_opt_common.c.

## show_help_muxer()

static void show_help_muxer | ( | const char * | name | ) |

static

Definition at line 482 of file fftools_opt_common.c.

## show_help_protocol()

static void show_help_protocol | ( | const char * | name | ) |

static

Definition at line 464 of file fftools_opt_common.c.

## show_layouts()

int show_layouts | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the standard channel layouts supported by the program. This option processing function does not utilize the arguments.

Definition at line 1017 of file fftools_opt_common.c.

## show_license()

int show_license | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print the license of the program to stdout. The license depends on the license of the libraries compiled into the program. This option processing function does not utilize the arguments.

Definition at line 94 of file fftools_opt_common.c.

## show_muxers()

int show_muxers | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the muxers supported by the program (including devices). This option processing function does not utilize the arguments.

Definition at line 935 of file fftools_opt_common.c.

## show_pix_fmts()

int show_pix_fmts | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the pixel formats supported by the program. This option processing function does not utilize the arguments.

Definition at line 979 of file fftools_opt_common.c.

## show_protocols()

int show_protocols | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the protocols supported by the program. This option processing function does not utilize the arguments.

Definition at line 950 of file fftools_opt_common.c.

## show_sample_fmts()

int show_sample_fmts | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print a listing containing all the sample formats supported by the program.

Definition at line 1050 of file fftools_opt_common.c.

## show_version()

int show_version | ( | void * | optctx,
|  | const char * | opt,
|  | const char * | arg
| ) |  |

Print the version of the program to stdout. The version message depends on the current versions of the repository and of the libav* libraries. This option processing function does not utilize the arguments.

Definition at line 266 of file fftools_opt_common.c.

## Variable Documentation

## program_name

__thread char* program_name

extern

program name, defined by the program for show_version().

Definition at line 98 of file fftools_cmdutils.c.

## report_callback

void(* report_callback) (int, float, float, int64_t, int, double, double) | ( | int | ,
|  | float | ,
|  | float | ,
|  | int64_t | ,
|  | int | ,
|  | double | ,
|  | double |
| ) |  |

extern

Definition at line 217 of file fftools_ffmpeg.c.

## report_file

__thread FILE* report_file = NULL

static

Definition at line 87 of file fftools_opt_common.c.

## report_file_level

__thread int report_file_level = AV_LOG_DEBUG

static

Definition at line 88 of file fftools_opt_common.c.

## warned_cfg

__thread int warned_cfg = 0

Definition at line 168 of file fftools_opt_common.c.