avconv_opt.c File Reference
#include <stdint.h>
#include "avconv.h"
#include "cmdutils.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/avfiltergraph.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/fifo.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
#include "cmdutils_common_opts.h"

Go to the source code of this file.

Macros

#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)
#define METADATA_CHECK_INDEX(index, nb_elems, desc)
#define SET_DICT(type, meta, context, index)
#define NEW_STREAM(type, index)
#define OFFSET(x)   offsetof(OptionsContext, x)

Enumerations

enum  OptGroup { GROUP_OUTFILE, GROUP_INFILE }

Functions

static void uninit_options (OptionsContext *o)
static void init_options (OptionsContext *o)
static double parse_frame_aspect_ratio (const char *arg)
static int opt_audio_codec (void *optctx, const char *opt, const char *arg)
static int opt_video_codec (void *optctx, const char *opt, const char *arg)
static int opt_subtitle_codec (void *optctx, const char *opt, const char *arg)
static int opt_data_codec (void *optctx, const char *opt, const char *arg)
static int opt_map (void *optctx, const char *opt, const char *arg)
static int opt_attach (void *optctx, const char *opt, const char *arg)
static void parse_meta_type (char *arg, char *type, int *index, const char **stream_spec)
 Parse a metadata specifier passed as 'arg' parameter.
static int copy_metadata (char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
static AVCodecfind_codec_or_die (const char *name, enum AVMediaType type, int encoder)
static AVCodecchoose_decoder (OptionsContext *o, AVFormatContext *s, AVStream *st)
static void add_input_streams (OptionsContext *o, AVFormatContext *ic)
static void assert_file_overwrite (const char *filename)
static void dump_attachment (AVStream *st, const char *filename)
static int open_input_file (OptionsContext *o, const char *filename)
static uint8_tget_line (AVIOContext *s)
static int get_preset_file_2 (const char *preset_name, const char *codec_name, AVIOContext **s)
static void choose_encoder (OptionsContext *o, AVFormatContext *s, OutputStream *ost)
static OutputStreamnew_output_stream (OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
static void parse_matrix_coeffs (uint16_t *dest, const char *str)
static OutputStreamnew_video_stream (OptionsContext *o, AVFormatContext *oc)
static OutputStreamnew_audio_stream (OptionsContext *o, AVFormatContext *oc)
static OutputStreamnew_data_stream (OptionsContext *o, AVFormatContext *oc)
static OutputStreamnew_attachment_stream (OptionsContext *o, AVFormatContext *oc)
static OutputStreamnew_subtitle_stream (OptionsContext *o, AVFormatContext *oc)
static int opt_streamid (void *optctx, const char *opt, const char *arg)
static int copy_chapters (InputFile *ifile, OutputFile *ofile, int copy_metadata)
static void init_output_filter (OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc)
static int configure_complex_filters (void)
static int open_output_file (OptionsContext *o, const char *filename)
static int opt_target (void *optctx, const char *opt, const char *arg)
static int opt_vstats_file (void *optctx, const char *opt, const char *arg)
static int opt_vstats (void *optctx, const char *opt, const char *arg)
static int opt_video_frames (void *optctx, const char *opt, const char *arg)
static int opt_audio_frames (void *optctx, const char *opt, const char *arg)
static int opt_data_frames (void *optctx, const char *opt, const char *arg)
static int opt_video_tag (void *optctx, const char *opt, const char *arg)
static int opt_audio_tag (void *optctx, const char *opt, const char *arg)
static int opt_subtitle_tag (void *optctx, const char *opt, const char *arg)
static int opt_video_filters (void *optctx, const char *opt, const char *arg)
static int opt_audio_filters (void *optctx, const char *opt, const char *arg)
static int opt_vsync (void *optctx, const char *opt, const char *arg)
static int opt_deinterlace (void *optctx, const char *opt, const char *arg)
int opt_cpuflags (void *optctx, const char *opt, const char *arg)
static int opt_channel_layout (void *optctx, const char *opt, const char *arg)
static int opt_audio_qscale (void *optctx, const char *opt, const char *arg)
static int opt_filter_complex (void *optctx, const char *opt, const char *arg)
void show_help_default (const char *opt, const char *arg)
 Per-avtool specific help handler.
void show_usage (void)
static int open_files (OptionGroupList *l, const char *inout, int(*open_file)(OptionsContext *, const char *))
int avconv_parse_options (int argc, char **argv)

Variables

char * vstats_filename
float audio_drift_threshold = 0.1
float dts_delta_threshold = 10
int audio_volume = 256
int audio_sync_method = 0
int video_sync_method = VSYNC_AUTO
int do_deinterlace = 0
int do_benchmark = 0
int do_hex_dump = 0
int do_pkt_dump = 0
int copy_ts = 0
int copy_tb = 1
int exit_on_error = 0
int print_stats = 1
int qp_hist = 0
static int file_overwrite = 0
static int video_discard = 0
static int intra_dc_precision = 8
static int using_stdin = 0
static int input_sync
static const OptionGroupDef groups []
const OptionDef options []

Macro Definition Documentation

#define MATCH_PER_STREAM_OPT (   name,
  type,
  outvar,
  fmtctx,
  st 
)
Value:
{\
int i, ret;\
for (i = 0; i < o->nb_ ## name; i++) {\
char *spec = o->name[i].specifier;\
if ((ret = check_stream_specifier(fmtctx, st, spec)) > 0)\
outvar = o->name[i].u.type;\
else if (ret < 0)\
exit(1);\
}\
}

Definition at line 45 of file avconv_opt.c.

Referenced by add_input_streams(), choose_decoder(), choose_encoder(), new_audio_stream(), new_output_stream(), and new_video_stream().

#define METADATA_CHECK_INDEX (   index,
  nb_elems,
  desc 
)
Value:
if ((index) < 0 || (index) >= (nb_elems)) {\
av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps.\n",\
(desc), (index));\
exit(1);\
}
#define NEW_STREAM (   type,
  index 
)
Value:
if (index >= 0) {\
ost = new_ ## type ## _stream(o, oc);\
ost->source_index = index;\
ost->sync_ist = input_streams[index];\
input_streams[index]->discard = 0;\
input_streams[index]->st->discard = AVDISCARD_NONE;\
}

Referenced by open_output_file().

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

Definition at line 1945 of file avconv_opt.c.

#define SET_DICT (   type,
  meta,
  context,
  index 
)
Value:
switch (type) {\
case 'g':\
meta = &context->metadata;\
break;\
case 'c':\
METADATA_CHECK_INDEX(index, context->nb_chapters, "chapter")\
meta = &context->chapters[index]->metadata;\
break;\
case 'p':\
METADATA_CHECK_INDEX(index, context->nb_programs, "program")\
meta = &context->programs[index]->metadata;\
break;\
case 's':\
break; /* handled separately below */ \
default: av_assert0(0);\
}\

Referenced by copy_metadata().

Enumeration Type Documentation

enum OptGroup
Enumerator:
GROUP_OUTFILE 
GROUP_INFILE 

Definition at line 1856 of file avconv_opt.c.

Function Documentation

static void add_input_streams ( OptionsContext o,
AVFormatContext ic 
)
static

Definition at line 431 of file avconv_opt.c.

Referenced by open_input_file().

static void assert_file_overwrite ( const char *  filename)
static

Definition at line 493 of file avconv_opt.c.

Referenced by dump_attachment(), and open_output_file().

int avconv_parse_options ( int  argc,
char **  argv 
)

Definition at line 1899 of file avconv_opt.c.

Referenced by main().

static AVCodec* choose_decoder ( OptionsContext o,
AVFormatContext s,
AVStream st 
)
static

Definition at line 416 of file avconv_opt.c.

Referenced by add_input_streams(), and open_input_file().

static void choose_encoder ( OptionsContext o,
AVFormatContext s,
OutputStream ost 
)
static

Definition at line 729 of file avconv_opt.c.

Referenced by new_output_stream().

static int configure_complex_filters ( void  )
static

Definition at line 1157 of file avconv_opt.c.

Referenced by open_output_file().

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

Definition at line 1081 of file avconv_opt.c.

Referenced by open_output_file().

static int copy_metadata ( char *  outspec,
char *  inspec,
AVFormatContext oc,
AVFormatContext ic,
OptionsContext o 
)
static

Definition at line 307 of file avconv_opt.c.

Referenced by open_output_file().

static void dump_attachment ( AVStream st,
const char *  filename 
)
static

Definition at line 515 of file avconv_opt.c.

Referenced by open_input_file().

static AVCodec* find_codec_or_die ( const char *  name,
enum AVMediaType  type,
int  encoder 
)
static

Definition at line 387 of file avconv_opt.c.

Referenced by choose_decoder(), and choose_encoder().

static uint8_t* get_line ( AVIOContext s)
static

Definition at line 684 of file avconv_opt.c.

Referenced by new_output_stream().

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

Definition at line 703 of file avconv_opt.c.

Referenced by new_output_stream().

static void init_options ( OptionsContext o)
static

Definition at line 112 of file avconv_opt.c.

Referenced by open_files().

static void init_output_filter ( OutputFilter ofilter,
OptionsContext o,
AVFormatContext oc 
)
static

Definition at line 1123 of file avconv_opt.c.

Referenced by open_output_file().

static OutputStream* new_attachment_stream ( OptionsContext o,
AVFormatContext oc 
)
static

Definition at line 1036 of file avconv_opt.c.

Referenced by open_output_file().

static OutputStream* new_audio_stream ( OptionsContext o,
AVFormatContext oc 
)
static

Definition at line 989 of file avconv_opt.c.

Referenced by init_output_filter(), and open_output_file().

static OutputStream* new_data_stream ( OptionsContext o,
AVFormatContext oc 
)
static

Definition at line 1023 of file avconv_opt.c.

Referenced by open_output_file().

static OutputStream* new_output_stream ( OptionsContext o,
AVFormatContext oc,
enum AVMediaType  type 
)
static
static OutputStream* new_subtitle_stream ( OptionsContext o,
AVFormatContext oc 
)
static

Definition at line 1043 of file avconv_opt.c.

Referenced by open_output_file().

static OutputStream* new_video_stream ( OptionsContext o,
AVFormatContext oc 
)
static

Definition at line 870 of file avconv_opt.c.

Referenced by init_output_filter(), and open_output_file().

static int open_files ( OptionGroupList l,
const char *  inout,
int(*)(OptionsContext *, const char *)  open_file 
)
static

Definition at line 1866 of file avconv_opt.c.

Referenced by avconv_parse_options().

static int open_input_file ( OptionsContext o,
const char *  filename 
)
static

Definition at line 547 of file avconv_opt.c.

Referenced by avconv_parse_options().

static int open_output_file ( OptionsContext o,
const char *  filename 
)
static

Definition at line 1168 of file avconv_opt.c.

Referenced by avconv_parse_options().

static int opt_attach ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 265 of file avconv_opt.c.

static int opt_audio_codec ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 146 of file avconv_opt.c.

Referenced by opt_target().

static int opt_audio_filters ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1698 of file avconv_opt.c.

static int opt_audio_frames ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1662 of file avconv_opt.c.

static int opt_audio_qscale ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1769 of file avconv_opt.c.

static int opt_audio_tag ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1680 of file avconv_opt.c.

static int opt_channel_layout ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1733 of file avconv_opt.c.

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

Definition at line 1722 of file avconv_opt.c.

static int opt_data_codec ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 164 of file avconv_opt.c.

static int opt_data_frames ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1668 of file avconv_opt.c.

static int opt_deinterlace ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1715 of file avconv_opt.c.

static int opt_filter_complex ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1775 of file avconv_opt.c.

static int opt_map ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 170 of file avconv_opt.c.

static int opt_streamid ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1059 of file avconv_opt.c.

static int opt_subtitle_codec ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 158 of file avconv_opt.c.

static int opt_subtitle_tag ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1686 of file avconv_opt.c.

static int opt_target ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1501 of file avconv_opt.c.

static int opt_video_codec ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 152 of file avconv_opt.c.

Referenced by opt_target().

static int opt_video_filters ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1692 of file avconv_opt.c.

static int opt_video_frames ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1656 of file avconv_opt.c.

static int opt_video_tag ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1674 of file avconv_opt.c.

static int opt_vstats ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1645 of file avconv_opt.c.

static int opt_vstats_file ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1638 of file avconv_opt.c.

Referenced by opt_vstats().

static int opt_vsync ( void optctx,
const char *  opt,
const char *  arg 
)
static

Definition at line 1704 of file avconv_opt.c.

static double parse_frame_aspect_ratio ( const char *  arg)
static

Definition at line 122 of file avconv_opt.c.

Referenced by new_video_stream().

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

Definition at line 853 of file avconv_opt.c.

Referenced by new_video_stream().

static void parse_meta_type ( 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 280 of file avconv_opt.c.

Referenced by copy_metadata(), and open_output_file().

void show_help_default ( const char *  opt,
const char *  arg 
)

Per-avtool specific help handler.

Implemented in each avtool, called by show_help().

Definition at line 1785 of file avconv_opt.c.

Referenced by show_help().

void show_usage ( void  )

Definition at line 1849 of file avconv_opt.c.

Referenced by main(), and show_help_default().

static void uninit_options ( OptionsContext o)
static

Definition at line 81 of file avconv_opt.c.

Referenced by open_files().

Variable Documentation

float audio_drift_threshold = 0.1

Definition at line 59 of file avconv_opt.c.

Referenced by configure_input_audio_filter().

int audio_sync_method = 0

Definition at line 63 of file avconv_opt.c.

Referenced by configure_input_audio_filter(), and do_audio_out().

int audio_volume = 256

Definition at line 62 of file avconv_opt.c.

Referenced by configure_input_audio_filter(), and transcode_init().

int copy_tb = 1

Definition at line 70 of file avconv_opt.c.

Referenced by transcode_init().

int copy_ts = 0

Definition at line 69 of file avconv_opt.c.

Referenced by open_input_file(), and process_input().

int do_benchmark = 0

Definition at line 66 of file avconv_opt.c.

Referenced by main().

int do_deinterlace = 0

Definition at line 65 of file avconv_opt.c.

Referenced by decode_video(), opt_deinterlace(), and pre_process_video_frame().

int do_hex_dump = 0

Definition at line 67 of file avconv_opt.c.

Referenced by process_input().

int do_pkt_dump = 0

Definition at line 68 of file avconv_opt.c.

Referenced by process_input().

float dts_delta_threshold = 10

Definition at line 60 of file avconv_opt.c.

Referenced by process_input().

int exit_on_error = 0

Definition at line 71 of file avconv_opt.c.

Referenced by do_subtitle_out(), process_input(), and write_frame().

int file_overwrite = 0
static

Definition at line 75 of file avconv_opt.c.

Referenced by assert_file_overwrite().

const OptionGroupDef groups[]
static
Initial value:
{
[GROUP_OUTFILE] = { "output file", NULL },
[GROUP_INFILE] = { "input file", "i" },
}

Definition at line 1861 of file avconv_opt.c.

int input_sync
static

Definition at line 79 of file avconv_opt.c.

int intra_dc_precision = 8
static

Definition at line 77 of file avconv_opt.c.

Referenced by new_video_stream().

int print_stats = 1

Definition at line 72 of file avconv_opt.c.

Referenced by print_report().

int qp_hist = 0

Definition at line 73 of file avconv_opt.c.

Referenced by print_report().

int using_stdin = 0
static

Definition at line 78 of file avconv_opt.c.

Referenced by assert_file_overwrite(), and open_input_file().

int video_discard = 0
static

Definition at line 76 of file avconv_opt.c.

int video_sync_method = VSYNC_AUTO

Definition at line 64 of file avconv_opt.c.

Referenced by do_video_out(), opt_vsync(), and transcode_init().

char* vstats_filename

Definition at line 57 of file avconv_opt.c.

Referenced by do_video_stats(), exit_program(), opt_vstats_file(), and poll_filter().