Libav
Data Structures | Macros | Enumerations | Functions | Variables
avprobe.c File Reference
#include "config.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavutil/avstring.h"
#include "libavutil/display.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/stereo3d.h"
#include "libavutil/dict.h"
#include "libavutil/libm.h"
#include "libavdevice/avdevice.h"
#include "cmdutils.h"
#include "cmdutils_common_opts.h"

Go to the source code of this file.

Data Structures

struct  InputStream
 
struct  InputFile
 
struct  PrintElement
 
struct  PrintContext
 

Macros

#define AVP_INDENT()   avio_printf(probe_out, "%*c", octx.level * 2, ' ')
 
#define AVP_BUFFSIZE   4096
 

Enumerations

enum  PrintElementType { ARRAY, OBJECT }
 

Functions

static void avprobe_cleanup (int ret)
 
static void ini_print_header (void)
 
static void ini_print_footer (void)
 
static void ini_escape_print (const char *s)
 
static void ini_print_array_header (const char *name, int plain_values)
 
static void ini_print_array_footer (const char *name, int plain_values)
 
static void ini_print_object_header (const char *name)
 
static void ini_print_integer (const char *key, int64_t value)
 
static void ini_print_string (const char *key, const char *value)
 
static void json_print_header (void)
 
static void json_print_footer (void)
 
static void json_print_array_header (const char *name, int plain_values)
 
static void json_print_array_footer (const char *name, int plain_values)
 
static void json_print_object_header (const char *name)
 
static void json_print_object_footer (const char *name)
 
static void json_print_integer (const char *key, int64_t value)
 
static void json_escape_print (const char *s)
 
static void json_print_string (const char *key, const char *value)
 
static void old_print_object_header (const char *name)
 
static void old_print_object_footer (const char *name)
 
static void old_print_string (const char *key, const char *value)
 
static void show_format_entry_integer (const char *key, int64_t value)
 
static void show_format_entry_string (const char *key, const char *value)
 
static void probe_group_enter (const char *name, int type)
 
static void probe_group_leave (void)
 
static void probe_header (void)
 
static void probe_footer (void)
 
static void probe_array_header (const char *name, int plain_values)
 
static void probe_array_footer (const char *name, int plain_values)
 
static void probe_object_header (const char *name)
 
static void probe_object_footer (const char *name)
 
static void probe_int (const char *key, int64_t value)
 
static void probe_str (const char *key, const char *value)
 
static void probe_dict (AVDictionary *dict, const char *name)
 
static char * value_string (char *buf, int buf_size, double val, const char *unit)
 
static char * time_value_string (char *buf, int buf_size, int64_t val, const AVRational *time_base)
 
static char * ts_value_string (char *buf, int buf_size, int64_t ts)
 
static char * rational_string (char *buf, int buf_size, const char *sep, const AVRational *rat)
 
static char * tag_string (char *buf, int buf_size, int tag)
 
static char * unknown_string (char *buf, int buf_size, int val)
 
static void show_packet (AVFormatContext *fmt_ctx, AVPacket *pkt)
 
static void show_packets (InputFile *ifile)
 
static void show_stream (InputFile *ifile, InputStream *ist)
 
static void show_format (InputFile *ifile)
 
static int open_input_file (InputFile *ifile, const char *filename)
 
static void close_input_file (InputFile *ifile)
 
static int probe_file (const char *filename)
 
static void show_usage (void)
 
static int opt_format (void *optctx, const char *opt, const char *arg)
 
static int opt_output_format (void *optctx, const char *opt, const char *arg)
 
static int opt_show_format_entry (void *optctx, const char *opt, const char *arg)
 
static void opt_input_file (void *optctx, const char *arg)
 
void show_help_default (const char *opt, const char *arg)
 Per-avtool specific help handler. More...
 
static int opt_pretty (void *optctx, const char *opt, const char *arg)
 
static int probe_buf_write (void *opaque, uint8_t *buf, int buf_size)
 
int main (int argc, char **argv)
 

Variables

const char program_name [] = "avprobe"
 program name, defined by the program for show_version(). More...
 
const int program_birth_year = 2007
 program birth year, defined by the program for show_banner() More...
 
static int do_show_format = 0
 
static AVDictionaryfmt_entries_to_show = NULL
 
static int nb_fmt_entries_to_show
 
static int do_show_packets = 0
 
static int do_show_streams = 0
 
static int show_value_unit = 0
 
static int use_value_prefix = 0
 
static int use_byte_value_binary_prefix = 0
 
static int use_value_sexagesimal_format = 0
 
static const OptionDefoptions
 
static const char * input_filename
 
static AVInputFormatiformat = NULL
 
static const char *const binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" }
 
static const char *const decimal_unit_prefixes [] = { "", "K" , "M" , "G" , "T" , "P" }
 
static const char unit_second_str [] = "s"
 
static const char unit_hertz_str [] = "Hz"
 
static const char unit_byte_str [] = "byte"
 
static const char unit_bit_per_second_str [] = "bit/s"
 
static AVIOContextprobe_out = NULL
 
static PrintContext octx
 
static const OptionDef real_options []
 

Macro Definition Documentation

◆ AVP_INDENT

#define AVP_INDENT ( )    avio_printf(probe_out, "%*c", octx.level * 2, ' ')

◆ AVP_BUFFSIZE

#define AVP_BUFFSIZE   4096

Definition at line 1063 of file avprobe.c.

Referenced by main().

Enumeration Type Documentation

◆ PrintElementType

Enumerator
ARRAY 
OBJECT 

Definition at line 97 of file avprobe.c.

Function Documentation

◆ avprobe_cleanup()

static void avprobe_cleanup ( int  ret)
static

Definition at line 78 of file avprobe.c.

Referenced by main().

◆ ini_print_header()

static void ini_print_header ( void  )
static

Definition at line 140 of file avprobe.c.

Referenced by main(), and opt_output_format().

◆ ini_print_footer()

static void ini_print_footer ( void  )
static

Definition at line 144 of file avprobe.c.

Referenced by main(), and opt_output_format().

◆ ini_escape_print()

static void ini_escape_print ( const char *  s)
static

Definition at line 149 of file avprobe.c.

Referenced by ini_print_array_header(), ini_print_integer(), and ini_print_string().

◆ ini_print_array_header()

static void ini_print_array_header ( const char *  name,
int  plain_values 
)
static

Definition at line 175 of file avprobe.c.

Referenced by main(), and opt_output_format().

◆ ini_print_array_footer()

static void ini_print_array_footer ( const char *  name,
int  plain_values 
)
static

Definition at line 187 of file avprobe.c.

Referenced by main(), and opt_output_format().

◆ ini_print_object_header()

static void ini_print_object_header ( const char *  name)
static

Definition at line 193 of file avprobe.c.

Referenced by main(), and opt_output_format().

◆ ini_print_integer()

static void ini_print_integer ( const char *  key,
int64_t  value 
)
static

Definition at line 216 of file avprobe.c.

Referenced by main(), and opt_output_format().

◆ ini_print_string()

static void ini_print_string ( const char *  key,
const char *  value 
)
static

Definition at line 229 of file avprobe.c.

Referenced by main(), old_print_string(), and opt_output_format().

◆ json_print_header()

static void json_print_header ( void  )
static

Definition at line 241 of file avprobe.c.

Referenced by opt_output_format().

◆ json_print_footer()

static void json_print_footer ( void  )
static

Definition at line 245 of file avprobe.c.

Referenced by opt_output_format().

◆ json_print_array_header()

static void json_print_array_header ( const char *  name,
int  plain_values 
)
static

Definition at line 250 of file avprobe.c.

Referenced by opt_output_format().

◆ json_print_array_footer()

static void json_print_array_footer ( const char *  name,
int  plain_values 
)
static

Definition at line 259 of file avprobe.c.

Referenced by opt_output_format().

◆ json_print_object_header()

static void json_print_object_header ( const char *  name)
static

Definition at line 266 of file avprobe.c.

Referenced by opt_output_format().

◆ json_print_object_footer()

static void json_print_object_footer ( const char *  name)
static

Definition at line 276 of file avprobe.c.

Referenced by opt_output_format().

◆ json_print_integer()

static void json_print_integer ( const char *  key,
int64_t  value 
)
static

Definition at line 283 of file avprobe.c.

Referenced by opt_output_format().

◆ json_escape_print()

static void json_escape_print ( const char *  s)
static

Definition at line 299 of file avprobe.c.

Referenced by json_print_string().

◆ json_print_string()

static void json_print_string ( const char *  key,
const char *  value 
)
static

Definition at line 323 of file avprobe.c.

Referenced by opt_output_format().

◆ old_print_object_header()

static void old_print_object_header ( const char *  name)
static

Definition at line 338 of file avprobe.c.

Referenced by opt_output_format().

◆ old_print_object_footer()

static void old_print_object_footer ( const char *  name)
static

Definition at line 357 of file avprobe.c.

Referenced by opt_output_format().

◆ old_print_string()

static void old_print_string ( const char *  key,
const char *  value 
)
static

Definition at line 376 of file avprobe.c.

Referenced by opt_output_format().

◆ show_format_entry_integer()

static void show_format_entry_integer ( const char *  key,
int64_t  value 
)
static

Definition at line 387 of file avprobe.c.

Referenced by opt_show_format_entry().

◆ show_format_entry_string()

static void show_format_entry_string ( const char *  key,
const char *  value 
)
static

Definition at line 396 of file avprobe.c.

Referenced by opt_show_format_entry().

◆ probe_group_enter()

static void probe_group_enter ( const char *  name,
int  type 
)
static

Definition at line 405 of file avprobe.c.

Referenced by probe_array_header(), probe_header(), and probe_object_header().

◆ probe_group_leave()

static void probe_group_leave ( void  )
static

Definition at line 427 of file avprobe.c.

Referenced by probe_array_footer(), probe_footer(), and probe_object_footer().

◆ probe_header()

static void probe_header ( void  )
static

Definition at line 432 of file avprobe.c.

Referenced by main().

◆ probe_footer()

static void probe_footer ( void  )
static

Definition at line 439 of file avprobe.c.

Referenced by main().

◆ probe_array_header()

static void probe_array_header ( const char *  name,
int  plain_values 
)
static

Definition at line 447 of file avprobe.c.

Referenced by probe_file(), show_packets(), and show_stream().

◆ probe_array_footer()

static void probe_array_footer ( const char *  name,
int  plain_values 
)
static

Definition at line 455 of file avprobe.c.

Referenced by probe_file(), show_packets(), and show_stream().

◆ probe_object_header()

static void probe_object_header ( const char *  name)
static

Definition at line 462 of file avprobe.c.

Referenced by probe_dict(), show_format(), show_packet(), and show_stream().

◆ probe_object_footer()

static void probe_object_footer ( const char *  name)
static

Definition at line 470 of file avprobe.c.

Referenced by probe_dict(), show_format(), show_packet(), and show_stream().

◆ probe_int()

static void probe_int ( const char *  key,
int64_t  value 
)
static

Definition at line 477 of file avprobe.c.

Referenced by show_format(), show_packet(), and show_stream().

◆ probe_str()

static void probe_str ( const char *  key,
const char *  value 
)
static

Definition at line 483 of file avprobe.c.

Referenced by probe_dict(), show_format(), show_packet(), and show_stream().

◆ probe_dict()

static void probe_dict ( AVDictionary dict,
const char *  name 
)
static

Definition at line 489 of file avprobe.c.

Referenced by show_format(), and show_stream().

◆ value_string()

static char* value_string ( char *  buf,
int  buf_size,
double  val,
const char *  unit 
)
static

Definition at line 501 of file avprobe.c.

Referenced by show_format(), show_packet(), show_stream(), and time_value_string().

◆ time_value_string()

static char* time_value_string ( char *  buf,
int  buf_size,
int64_t  val,
const AVRational time_base 
)
static

Definition at line 538 of file avprobe.c.

Referenced by show_format(), show_packet(), and show_stream().

◆ ts_value_string()

static char* ts_value_string ( char *  buf,
int  buf_size,
int64_t  ts 
)
static

Definition at line 550 of file avprobe.c.

Referenced by show_packet().

◆ rational_string()

static char* rational_string ( char *  buf,
int  buf_size,
const char *  sep,
const AVRational rat 
)
static

Definition at line 561 of file avprobe.c.

Referenced by show_stream().

◆ tag_string()

static char* tag_string ( char *  buf,
int  buf_size,
int  tag 
)
static

Definition at line 568 of file avprobe.c.

Referenced by show_stream().

◆ unknown_string()

static char* unknown_string ( char *  buf,
int  buf_size,
int  val 
)
static

Definition at line 574 of file avprobe.c.

Referenced by show_stream().

◆ show_packet()

static void show_packet ( AVFormatContext fmt_ctx,
AVPacket pkt 
)
static

Definition at line 580 of file avprobe.c.

Referenced by show_packets().

◆ show_packets()

static void show_packets ( InputFile ifile)
static

Definition at line 606 of file avprobe.c.

Referenced by probe_file().

◆ show_stream()

static void show_stream ( InputFile ifile,
InputStream ist 
)
static

Definition at line 620 of file avprobe.c.

Referenced by probe_file().

◆ show_format()

static void show_format ( InputFile ifile)
static

Definition at line 786 of file avprobe.c.

Referenced by probe_file().

◆ open_input_file()

static int open_input_file ( InputFile ifile,
const char *  filename 
)
static

Definition at line 816 of file avprobe.c.

Referenced by probe_file().

◆ close_input_file()

static void close_input_file ( InputFile ifile)
static

Definition at line 890 of file avprobe.c.

Referenced by probe_file().

◆ probe_file()

static int probe_file ( const char *  filename)
static

Definition at line 907 of file avprobe.c.

Referenced by main().

◆ show_usage()

static void show_usage ( void  )
static

Definition at line 933 of file avprobe.c.

Referenced by main(), and show_help_default().

◆ opt_format()

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

Definition at line 940 of file avprobe.c.

◆ opt_output_format()

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

Definition at line 950 of file avprobe.c.

◆ opt_show_format_entry()

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

Definition at line 985 of file avprobe.c.

◆ opt_input_file()

static void opt_input_file ( void optctx,
const char *  arg 
)
static

Definition at line 1002 of file avprobe.c.

Referenced by main().

◆ show_help_default()

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 1015 of file avprobe.c.

◆ opt_pretty()

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

Definition at line 1024 of file avprobe.c.

◆ probe_buf_write()

static int probe_buf_write ( void opaque,
uint8_t buf,
int  buf_size 
)
static

Definition at line 1057 of file avprobe.c.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1065 of file avprobe.c.

Variable Documentation

◆ program_name

const char program_name[] = "avprobe"

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

Definition at line 49 of file avprobe.c.

Referenced by main(), and show_usage().

◆ program_birth_year

const int program_birth_year = 2007

program birth year, defined by the program for show_banner()

Definition at line 50 of file avprobe.c.

◆ do_show_format

int do_show_format = 0
static

Definition at line 52 of file avprobe.c.

Referenced by opt_show_format_entry(), and probe_file().

◆ fmt_entries_to_show

AVDictionary* fmt_entries_to_show = NULL
static

Definition at line 53 of file avprobe.c.

◆ nb_fmt_entries_to_show

int nb_fmt_entries_to_show
static

◆ do_show_packets

int do_show_packets = 0
static

Definition at line 55 of file avprobe.c.

Referenced by probe_file().

◆ do_show_streams

int do_show_streams = 0
static

Definition at line 56 of file avprobe.c.

Referenced by probe_file().

◆ show_value_unit

int show_value_unit = 0
static

Definition at line 58 of file avprobe.c.

Referenced by opt_pretty(), and value_string().

◆ use_value_prefix

int use_value_prefix = 0
static

Definition at line 59 of file avprobe.c.

Referenced by opt_pretty(), and value_string().

◆ use_byte_value_binary_prefix

int use_byte_value_binary_prefix = 0
static

Definition at line 60 of file avprobe.c.

Referenced by opt_pretty(), and value_string().

◆ use_value_sexagesimal_format

int use_value_sexagesimal_format = 0
static

Definition at line 61 of file avprobe.c.

Referenced by opt_pretty(), and value_string().

◆ options

const OptionDef* options
static

Definition at line 64 of file avprobe.c.

◆ input_filename

const char* input_filename
static

Definition at line 67 of file avprobe.c.

Referenced by main(), and opt_input_file().

◆ iformat

AVInputFormat* iformat = NULL
static

Definition at line 68 of file avprobe.c.

Referenced by movie_init(), and stream_open().

◆ binary_unit_prefixes

const char* const binary_unit_prefixes[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" }
static

Definition at line 70 of file avprobe.c.

Referenced by value_string().

◆ decimal_unit_prefixes

const char* const decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" }
static

Definition at line 71 of file avprobe.c.

Referenced by value_string().

◆ unit_second_str

const char unit_second_str[] = "s"
static

Definition at line 73 of file avprobe.c.

Referenced by time_value_string(), and value_string().

◆ unit_hertz_str

const char unit_hertz_str[] = "Hz"
static

Definition at line 74 of file avprobe.c.

Referenced by show_stream().

◆ unit_byte_str

const char unit_byte_str[] = "byte"
static

Definition at line 75 of file avprobe.c.

Referenced by show_format(), show_packet(), and value_string().

◆ unit_bit_per_second_str

const char unit_bit_per_second_str[] = "bit/s"
static

Definition at line 76 of file avprobe.c.

Referenced by show_format(), and show_stream().

◆ probe_out

AVIOContext* probe_out = NULL
static

Definition at line 124 of file avprobe.c.

◆ octx

PrintContext octx
static

Definition at line 125 of file avprobe.c.

Referenced by avconv_parse_options().

◆ real_options

const OptionDef real_options[]
static

Definition at line 1033 of file avprobe.c.

Referenced by main().