ffmpeg_opt.c File Reference

#include <stdint.h>
#include "ffmpeg.h"
#include "cmdutils.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/avfiltergraph.h"
#include "libavutil/audioconvert.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/avutil.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.

Defines

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

Functions

void reset_options (OptionsContext *o, int is_input)
static int opt_frame_crop (void *optctx, const char *opt, const char *arg)
static int opt_pad (void *optctx, const char *opt, const char *arg)
static int opt_video_channel (void *optctx, const char *opt, const char *arg)
static int opt_video_standard (void *optctx, const char *opt, 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 int opt_map_channel (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 in arg.
static int copy_metadata (char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o)
static int opt_recording_timestamp (void *optctx, const char *opt, const char *arg)
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)
 Add all the streams from the given input file to the global list of input streams.
static void assert_file_overwrite (const char *filename)
static void dump_attachment (AVStream *st, const char *filename)
static int opt_input_file (void *optctx, const char *opt, 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, int source_index)
static void parse_matrix_coeffs (uint16_t *dest, const char *str)
static OutputStreamnew_video_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_audio_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_data_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_attachment_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static OutputStreamnew_subtitle_stream (OptionsContext *o, AVFormatContext *oc, int source_index)
static int opt_streamid (void *optctx, const char *opt, const char *arg)
static int copy_chapters (InputFile *ifile, OutputFile *ofile, int copy_metadata)
static int read_ffserver_streams (OptionsContext *o, AVFormatContext *s, const char *filename)
static void init_output_filter (OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc)
static int configure_complex_filters (void)
void opt_output_file (void *optctx, 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_preset (void *optctx, const char *opt, const char *arg)
static int opt_old2new (void *optctx, const char *opt, const char *arg)
static int opt_bitrate (void *optctx, const char *opt, const char *arg)
static int opt_qscale (void *optctx, const char *opt, const char *arg)
static int opt_profile (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)
static int opt_timecode (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 opt_progress (void *optctx, const char *opt, const char *arg)

Variables

char * vstats_filename
float audio_drift_threshold = 0.1
float dts_delta_threshold = 10
float dts_error_threshold = 3600*30
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_benchmark_all = 0
int do_hex_dump = 0
int do_pkt_dump = 0
int copy_ts = 0
int copy_tb = -1
int debug_ts = 0
int exit_on_error = 0
int print_stats = 1
int qp_hist = 0
int same_quant = 0
int stdin_interaction = 1
int frame_bits_per_raw_sample = 0
static int intra_only = 0
static int file_overwrite = 0
static int no_file_overwrite = 0
static int video_discard = 0
static int intra_dc_precision = 8
static int do_psnr = 0
static int input_sync
const OptionDef options []


Define 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_program(1);\
    }\
}

Definition at line 45 of file ffmpeg_opt.c.

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

#define MATCH_PER_TYPE_OPT ( name,
type,
outvar,
fmtctx,
mediatype   ) 

Value:

{\
    int i;\
    for (i = 0; i < o->nb_ ## name; i++) {\
        char *spec = o->name[i].specifier;\
        if (!strcmp(spec, mediatype))\
            outvar = o->name[i].u.type;\
    }\
}

Definition at line 57 of file ffmpeg_opt.c.

Referenced by opt_input_file(), opt_output_file(), and opt_preset().

#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_program(1);\
    }

#define OFFSET (  )     offsetof(OptionsContext, x)

Definition at line 2238 of file ffmpeg_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;\
        default: av_assert0(0);\
        case 's':\
            break;\
        }\

Referenced by copy_metadata().


Function Documentation

static void add_input_streams ( OptionsContext o,
AVFormatContext ic 
) [static]

Add all the streams from the given input file to the global list of input streams.

Definition at line 543 of file ffmpeg_opt.c.

Referenced by opt_input_file().

static void assert_file_overwrite ( const char *  filename  )  [static]

Definition at line 627 of file ffmpeg_opt.c.

Referenced by dump_attachment(), and opt_output_file().

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

Definition at line 526 of file ffmpeg_opt.c.

Referenced by add_input_streams(), and opt_input_file().

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

Definition at line 881 of file ffmpeg_opt.c.

Referenced by new_output_stream().

static int configure_complex_filters ( void   )  [static]

Definition at line 1409 of file ffmpeg_opt.c.

Referenced by opt_output_file().

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

Definition at line 1295 of file ffmpeg_opt.c.

Referenced by opt_output_file().

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

Definition at line 397 of file ffmpeg_opt.c.

Referenced by opt_output_file().

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

Definition at line 652 of file ffmpeg_opt.c.

Referenced by opt_input_file().

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

Definition at line 497 of file ffmpeg_opt.c.

Referenced by choose_decoder(), choose_encoder(), and opt_input_file().

static uint8_t* get_line ( AVIOContext s  )  [static]

Definition at line 836 of file ffmpeg_opt.c.

Referenced by new_output_stream(), read_chapter(), and read_header().

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

Definition at line 855 of file ffmpeg_opt.c.

Referenced by new_output_stream().

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

Definition at line 1375 of file ffmpeg_opt.c.

Referenced by opt_output_file().

static OutputStream* new_attachment_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 1238 of file ffmpeg_opt.c.

Referenced by opt_output_file().

static OutputStream* new_audio_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 1173 of file ffmpeg_opt.c.

Referenced by init_output_filter(), and opt_output_file().

static OutputStream* new_data_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 1225 of file ffmpeg_opt.c.

Referenced by opt_output_file().

static OutputStream* new_output_stream ( OptionsContext o,
AVFormatContext oc,
enum AVMediaType  type,
int  source_index 
) [static]

static OutputStream* new_subtitle_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 1245 of file ffmpeg_opt.c.

Referenced by opt_output_file().

static OutputStream* new_video_stream ( OptionsContext o,
AVFormatContext oc,
int  source_index 
) [static]

Definition at line 1031 of file ffmpeg_opt.c.

Referenced by init_output_filter(), and opt_output_file().

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

Definition at line 294 of file ffmpeg_opt.c.

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

Definition at line 173 of file ffmpeg_opt.c.

Referenced by ffserver_opt_preset(), opt_preset(), opt_target(), and parse_ffconfig().

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

Definition at line 2058 of file ffmpeg_opt.c.

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

Definition at line 1947 of file ffmpeg_opt.c.

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

Definition at line 2130 of file ffmpeg_opt.c.

static int opt_bitrate ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 2016 of file ffmpeg_opt.c.

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

Definition at line 2094 of file ffmpeg_opt.c.

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

Definition at line 191 of file ffmpeg_opt.c.

Referenced by opt_preset().

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

Definition at line 1953 of file ffmpeg_opt.c.

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

Definition at line 2076 of file ffmpeg_opt.c.

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

Definition at line 2136 of file ffmpeg_opt.c.

static int opt_frame_crop ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 149 of file ffmpeg_opt.c.

static int opt_input_file ( void *  optctx,
const char *  opt,
const char *  filename 
) [static]

Definition at line 684 of file ffmpeg_opt.c.

Referenced by main(), and opt_input_file_i().

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

Definition at line 197 of file ffmpeg_opt.c.

static int opt_map_channel ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 303 of file ffmpeg_opt.c.

static int opt_old2new ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 2007 of file ffmpeg_opt.c.

void opt_output_file ( void *  optctx,
const char *  filename 
)

Definition at line 1420 of file ffmpeg_opt.c.

Referenced by main().

static int opt_pad ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 155 of file ffmpeg_opt.c.

static int opt_preset ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 1959 of file ffmpeg_opt.c.

static int opt_profile ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 2041 of file ffmpeg_opt.c.

static int opt_progress ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 2221 of file ffmpeg_opt.c.

static int opt_qscale ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 2026 of file ffmpeg_opt.c.

static int opt_recording_timestamp ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 483 of file ffmpeg_opt.c.

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

Definition at line 1273 of file ffmpeg_opt.c.

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

Definition at line 185 of file ffmpeg_opt.c.

Referenced by opt_preset().

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

Definition at line 1785 of file ffmpeg_opt.c.

static int opt_timecode ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 2083 of file ffmpeg_opt.c.

static int opt_video_channel ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 161 of file ffmpeg_opt.c.

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

Definition at line 179 of file ffmpeg_opt.c.

Referenced by ffserver_opt_preset(), opt_preset(), opt_target(), and parse_ffconfig().

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

Definition at line 2052 of file ffmpeg_opt.c.

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

Definition at line 1941 of file ffmpeg_opt.c.

static int opt_video_standard ( void *  optctx,
const char *  opt,
const char *  arg 
) [static]

Definition at line 167 of file ffmpeg_opt.c.

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

Definition at line 1930 of file ffmpeg_opt.c.

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

Definition at line 1923 of file ffmpeg_opt.c.

Referenced by opt_vstats().

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

Definition at line 2064 of file ffmpeg_opt.c.

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

Definition at line 1014 of file ffmpeg_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 in arg.

Parameters:
type metadata type is written here -- g(lobal)/s(tream)/c(hapter)/p(rogram)
index for type c/p, chapter/program index is written here
stream_spec for type s, the stream specifier is written here

Definition at line 370 of file ffmpeg_opt.c.

Referenced by copy_metadata(), and opt_output_file().

static int read_ffserver_streams ( OptionsContext o,
AVFormatContext s,
const char *  filename 
) [static]

Definition at line 1335 of file ffmpeg_opt.c.

Referenced by opt_output_file().

void reset_options ( OptionsContext o,
int  is_input 
)

Definition at line 99 of file ffmpeg_opt.c.

Referenced by main(), opt_input_file(), and opt_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 2147 of file ffmpeg_opt.c.

void show_usage ( void   ) 

Definition at line 2213 of file ffmpeg_opt.c.

Referenced by main(), and show_help_default().


Variable Documentation

float audio_drift_threshold = 0.1

Definition at line 68 of file ffmpeg_opt.c.

Referenced by configure_input_audio_filter().

Definition at line 73 of file ffmpeg_opt.c.

Referenced by configure_input_audio_filter(), do_audio_out(), and write_frame().

int copy_tb = -1

Definition at line 81 of file ffmpeg_opt.c.

Referenced by transcode_init().

int copy_ts = 0

Definition at line 80 of file ffmpeg_opt.c.

Referenced by opt_input_file(), and process_input().

Definition at line 82 of file ffmpeg_opt.c.

Referenced by decode_video(), do_audio_out(), do_video_out(), process_input(), and write_frame().

Definition at line 76 of file ffmpeg_opt.c.

Referenced by main().

Definition at line 77 of file ffmpeg_opt.c.

Referenced by update_benchmark().

Definition at line 75 of file ffmpeg_opt.c.

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

Definition at line 78 of file ffmpeg_opt.c.

Referenced by check_keyboard_interaction(), and process_input().

Definition at line 79 of file ffmpeg_opt.c.

Referenced by check_keyboard_interaction(), and process_input().

int do_psnr = 0 [static]

Definition at line 96 of file ffmpeg_opt.c.

Referenced by new_video_stream().

float dts_delta_threshold = 10

Definition at line 69 of file ffmpeg_opt.c.

Referenced by process_input().

float dts_error_threshold = 3600*30

Definition at line 70 of file ffmpeg_opt.c.

Referenced by do_video_out(), and process_input().

Definition at line 83 of file ffmpeg_opt.c.

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

int file_overwrite = 0 [static]

Definition at line 92 of file ffmpeg_opt.c.

Referenced by assert_file_overwrite().

Definition at line 88 of file ffmpeg_opt.c.

Referenced by new_video_stream(), and transcode_init().

int input_sync [static]

Definition at line 97 of file ffmpeg_opt.c.

int intra_dc_precision = 8 [static]

Definition at line 95 of file ffmpeg_opt.c.

Referenced by new_video_stream().

int intra_only = 0 [static]

Definition at line 91 of file ffmpeg_opt.c.

Referenced by build_frame_code(), and new_video_stream().

int no_file_overwrite = 0 [static]

Definition at line 93 of file ffmpeg_opt.c.

Referenced by assert_file_overwrite().

const OptionDef options[]

int print_stats = 1

Definition at line 84 of file ffmpeg_opt.c.

Referenced by print_report(), and request_frame().

int qp_hist = 0

Definition at line 85 of file ffmpeg_opt.c.

Referenced by check_keyboard_interaction(), and print_report().

Definition at line 86 of file ffmpeg_opt.c.

Referenced by decode_video(), new_output_stream(), and reap_filters().

Definition at line 87 of file ffmpeg_opt.c.

Referenced by assert_file_overwrite(), opt_input_file(), and transcode().

int video_discard = 0 [static]

Definition at line 94 of file ffmpeg_opt.c.

int video_sync_method = VSYNC_AUTO

Definition at line 74 of file ffmpeg_opt.c.

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

Definition at line 66 of file ffmpeg_opt.c.

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


Generated on Fri Oct 26 02:50:03 2012 for FFmpeg by  doxygen 1.5.8