avprobe.c File Reference
#include "config.h"
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.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  ProbeElement
struct  OutputContext

Macros

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

Enumerations

enum  ProbeElementType { ARRAY, OBJECT }

Functions

static void exit_program (void)
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)
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)
static void json_print_array_footer (const char *name)
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)
static void probe_array_footer (const char *name)
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 const char * media_type_string (enum AVMediaType media_type)
static void show_packet (AVFormatContext *fmt_ctx, AVPacket *pkt)
static void show_packets (AVFormatContext *fmt_ctx)
static void show_stream (AVFormatContext *fmt_ctx, int stream_idx)
static void show_format (AVFormatContext *fmt_ctx)
static int open_input_file (AVFormatContext **fmt_ctx_ptr, const char *filename)
static void close_input_file (AVFormatContext **ctx_ptr)
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.
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().
const int program_birth_year = 2007
 program birth year, defined by the program for show_banner()
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 OutputContext octx
static const OptionDef real_options []

Macro Definition Documentation

#define AVP_BUFFSIZE   4096

Definition at line 925 of file avprobe.c.

Referenced by main().

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

Enumeration Type Documentation

Enumerator:
ARRAY 
OBJECT 

Definition at line 81 of file avprobe.c.

Function Documentation

static void close_input_file ( AVFormatContext **  ctx_ptr)
static

Definition at line 757 of file avprobe.c.

Referenced by probe_file().

static void exit_program ( void  )
static

Definition at line 62 of file avprobe.c.

Referenced by main().

static void ini_escape_print ( const char *  s)
static

Definition at line 133 of file avprobe.c.

Referenced by ini_print_integer(), and ini_print_string().

static void ini_print_array_header ( const char *  name)
static

Definition at line 159 of file avprobe.c.

Referenced by main(), and opt_output_format().

static void ini_print_footer ( void  )
static

Definition at line 128 of file avprobe.c.

Referenced by main(), and opt_output_format().

static void ini_print_header ( void  )
static

Definition at line 124 of file avprobe.c.

Referenced by main(), and opt_output_format().

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

Definition at line 188 of file avprobe.c.

Referenced by main(), and opt_output_format().

static void ini_print_object_header ( const char *  name)
static

Definition at line 165 of file avprobe.c.

Referenced by main(), and opt_output_format().

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

Definition at line 195 of file avprobe.c.

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

static void json_escape_print ( const char *  s)
static

Definition at line 257 of file avprobe.c.

Referenced by json_print_string().

static void json_print_array_footer ( const char *  name)
static

Definition at line 225 of file avprobe.c.

Referenced by opt_output_format().

static void json_print_array_header ( const char *  name)
static

Definition at line 216 of file avprobe.c.

Referenced by opt_output_format().

static void json_print_footer ( void  )
static

Definition at line 211 of file avprobe.c.

Referenced by opt_output_format().

static void json_print_header ( void  )
static

Definition at line 207 of file avprobe.c.

Referenced by opt_output_format().

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

Definition at line 249 of file avprobe.c.

Referenced by opt_output_format().

static void json_print_object_footer ( const char *  name)
static

Definition at line 242 of file avprobe.c.

Referenced by opt_output_format().

static void json_print_object_header ( const char *  name)
static

Definition at line 232 of file avprobe.c.

Referenced by opt_output_format().

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

Definition at line 281 of file avprobe.c.

Referenced by opt_output_format().

int main ( int  argc,
char **  argv 
)

Definition at line 927 of file avprobe.c.

static const char* media_type_string ( enum AVMediaType  media_type)
static

Definition at line 530 of file avprobe.c.

Referenced by show_packet(), and show_stream().

static void old_print_object_footer ( const char *  name)
static

Definition at line 313 of file avprobe.c.

Referenced by opt_output_format().

static void old_print_object_header ( const char *  name)
static

Definition at line 296 of file avprobe.c.

Referenced by opt_output_format().

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

Definition at line 330 of file avprobe.c.

Referenced by opt_output_format().

static int open_input_file ( AVFormatContext **  fmt_ctx_ptr,
const char *  filename 
)
static

Definition at line 710 of file avprobe.c.

Referenced by probe_file().

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

Definition at line 803 of file avprobe.c.

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

Definition at line 864 of file avprobe.c.

Referenced by main().

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

Definition at line 813 of file avprobe.c.

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

Definition at line 886 of file avprobe.c.

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

Definition at line 847 of file avprobe.c.

static void probe_array_footer ( const char *  name)
static

Definition at line 409 of file avprobe.c.

Referenced by probe_file(), and show_packets().

static void probe_array_header ( const char *  name)
static

Definition at line 401 of file avprobe.c.

Referenced by probe_file(), and show_packets().

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

Definition at line 919 of file avprobe.c.

Referenced by main().

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

Definition at line 443 of file avprobe.c.

Referenced by show_format(), and show_stream().

static int probe_file ( const char *  filename)
static

Definition at line 771 of file avprobe.c.

Referenced by main().

static void probe_footer ( void  )
static

Definition at line 393 of file avprobe.c.

Referenced by main().

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

Definition at line 359 of file avprobe.c.

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

static void probe_group_leave ( void  )
static

Definition at line 381 of file avprobe.c.

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

static void probe_header ( void  )
static

Definition at line 386 of file avprobe.c.

Referenced by main().

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

Definition at line 431 of file avprobe.c.

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

static void probe_object_footer ( const char *  name)
static

Definition at line 424 of file avprobe.c.

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

static void probe_object_header ( const char *  name)
static

Definition at line 416 of file avprobe.c.

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

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

Definition at line 437 of file avprobe.c.

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

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

Definition at line 515 of file avprobe.c.

Referenced by show_stream().

static void show_format ( AVFormatContext fmt_ctx)
static

Definition at line 681 of file avprobe.c.

Referenced by probe_file().

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

Definition at line 341 of file avprobe.c.

Referenced by opt_show_format_entry().

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

Definition at line 350 of file avprobe.c.

Referenced by opt_show_format_entry().

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

static void show_packet ( AVFormatContext fmt_ctx,
AVPacket pkt 
)
static

Definition at line 542 of file avprobe.c.

Referenced by show_packets().

static void show_packets ( AVFormatContext fmt_ctx)
static

Definition at line 568 of file avprobe.c.

Referenced by probe_file().

static void show_stream ( AVFormatContext fmt_ctx,
int  stream_idx 
)
static

Definition at line 579 of file avprobe.c.

Referenced by probe_file().

static void show_usage ( void  )
static

Definition at line 796 of file avprobe.c.

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

Definition at line 522 of file avprobe.c.

Referenced by show_stream().

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

Definition at line 492 of file avprobe.c.

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

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

Definition at line 504 of file avprobe.c.

Referenced by show_packet().

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

Definition at line 455 of file avprobe.c.

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

Variable Documentation

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

Definition at line 54 of file avprobe.c.

Referenced by value_string().

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

Definition at line 55 of file avprobe.c.

Referenced by value_string().

int do_show_format = 0
static

Definition at line 36 of file avprobe.c.

Referenced by opt_show_format_entry(), and probe_file().

int do_show_packets = 0
static

Definition at line 39 of file avprobe.c.

Referenced by probe_file().

int do_show_streams = 0
static

Definition at line 40 of file avprobe.c.

Referenced by probe_file().

AVDictionary* fmt_entries_to_show = NULL
static

Definition at line 37 of file avprobe.c.

AVInputFormat* iformat = NULL
static

Definition at line 52 of file avprobe.c.

Referenced by movie_init(), and stream_open().

const char* input_filename
static

Definition at line 51 of file avprobe.c.

Referenced by main(), and opt_input_file().

int nb_fmt_entries_to_show
static
OutputContext octx
static

Definition at line 109 of file avprobe.c.

Referenced by avconv_parse_options().

const OptionDef* options
static

Definition at line 48 of file avprobe.c.

AVIOContext* probe_out = NULL
static

Definition at line 108 of file avprobe.c.

const int program_birth_year = 2007

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

Definition at line 34 of file avprobe.c.

const char program_name[] = "avprobe"

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

Definition at line 33 of file avprobe.c.

const OptionDef real_options[]
static

Definition at line 895 of file avprobe.c.

Referenced by main().

int show_value_unit = 0
static

Definition at line 42 of file avprobe.c.

Referenced by opt_pretty(), and value_string().

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

Definition at line 60 of file avprobe.c.

Referenced by show_format(), and show_stream().

const char unit_byte_str[] = "byte"
static

Definition at line 59 of file avprobe.c.

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

const char unit_hertz_str[] = "Hz"
static

Definition at line 58 of file avprobe.c.

Referenced by show_stream().

const char unit_second_str[] = "s"
static

Definition at line 57 of file avprobe.c.

Referenced by time_value_string(), and value_string().

int use_byte_value_binary_prefix = 0
static

Definition at line 44 of file avprobe.c.

Referenced by opt_pretty(), and value_string().

int use_value_prefix = 0
static

Definition at line 43 of file avprobe.c.

Referenced by opt_pretty(), and value_string().

int use_value_sexagesimal_format = 0
static

Definition at line 45 of file avprobe.c.

Referenced by opt_pretty(), and value_string().