libgpac
Documentation of the core library of GPAC
gpac.c File Reference
#include <gpac/main.h>
#include <gpac/filters.h>
#include <gpac/thread.h>
#include <gpac/network.h>
#include "gpac.h"
#include <signal.h>
#include <gpac/token.h>
+ Include dependency graph for gpac.c:

Data Structures

struct  _gpac_key
 
struct  _logentry
 
struct  CacheInfo
 
struct  FileIOCtx
 

Macros

#define SET_CONSOLE(_code)   gf_sys_set_console_code(stderr, _code)
 
#define gpac_exit(_code)    return gpac_exit_fun(_code)
 
#define ERR_EXIT   goto exit;
 
#define DEF_LOG_ENTRIES   10
 
#define TIMEFMT   "%Y/%m/%dT%H:%M:%SZ"
 
#define PTR_INT   (u64) (u32)
 
#define UPDATE_FIELD(_prompt, _key)
 

Enumerations

enum  { CACHE_OP_DELETE , CACHE_OP_SHOW , CACHE_OP_INFO , CACHE_OP_UNFLATTEN }
 
enum  GPAC_Command {
  GPAC_COM_UNDEF = 0 , GPAC_QUIT , GPAC_EXIT , GPAC_PRINT_STATS ,
  GPAC_PRINT_GRAPH , GPAC_SEND_UPDATE , GPAC_LIST_FILTERS , GPAC_INSERT_FILTER ,
  GPAC_REMOVE_FILTER , GPAC_PRINT_HELP
}
 

Functions

static void gpac_print_report (GF_FilterSession *fsess, Bool is_init, Bool is_final)
 
static void cleanup_logs (void)
 
static Bool gpac_handle_prompt (GF_FilterSession *fsess, char char_code)
 
static void gpac_fsess_task_help (void)
 
static const char * make_fileio (const char *inargs, const char **out_arg, u32 mode, GF_Err *e)
 
static void cleanup_file_io (void)
 
static GF_Filter * load_custom_filter (GF_FilterSession *sess, char *opts, GF_Err *e)
 
static u32 gpac_unit_tests (GF_MemTrackerType mem_track)
 
static void do_cache_check (u32 op_type, char *argval)
 
static GF_Err print_pid_props (char *arg)
 
static GF_Err probe_pid_link (char *arg)
 
static GF_Err print_pid_dests (char *arg)
 
static void gpac_sig_handler (int sig)
 
static int gpac_do_creds (char *creds_args)
 
static Bool gpac_event_proc (void *opaque, GF_Event *event)
 
static Bool gpac_fsess_task (GF_FilterSession *fsess, void *callback, u32 *reschedule_ms)
 
static int gpac_exit_fun (GF_Err code)
 
u32 get_u32 (char *val, char *log_name)
 
s32 get_s32 (char *val, char *log_name)
 
static Bool enum_net_ifces (void *cbk, const char *name, const char *IP, u32 flags)
 
static void run_sess (void)
 
static GF_Err process_link_directive (char *link, GF_Filter *filter, GF_List *loaded_filters, char *ext_link)
 
static int gpac_main (int _argc, char **_argv)
 
static GPAC_Command get_cmd (u8 char_code)
 
static GF_Err extract_filter_and_pid (char *arg, GF_Filter **o_f, s32 *opid_idx, u8 *prefix_c)
 
static void gpac_on_logs (void *cbck, GF_LOG_Level log_level, GF_LOG_Tool log_tool, const char *fmt, va_list vlist)
 
static void print_date_ex (u64 time, Bool full_print)
 
static void print_date (u64 time)
 
static GFINLINE const char * format_date (u64 time, char *szDate)
 
static Bool cache_file_op (void *cbck, char *item_name, char *item_path, GF_FileEnumInfo *file_info)
 
static GF_FileIO * fio_open (GF_FileIO *fileio_ref, const char *url, const char *mode, GF_Err *out_err)
 
static GF_Err fio_seek (GF_FileIO *fileio, u64 offset, s32 whence)
 
static u32 fio_read (GF_FileIO *fileio, u8 *buffer, u32 bytes)
 
static u32 fio_write (GF_FileIO *fileio, u8 *buffer, u32 bytes)
 
static s64 fio_tell (GF_FileIO *fileio)
 
static Bool fio_eof (GF_FileIO *fileio)
 
static int fio_printf (GF_FileIO *fileio, const char *format, va_list args)
 
static GF_Err cust_configure_pid (GF_Filter *filter, GF_FilterPid *pid, Bool is_remove)
 
static GF_Err cust_process (GF_Filter *filter)
 
static void to_hex (u8 *data, u32 len, char *out)
 
static u64 creds_set_pass (GF_Config *creds, const char *user, const char *passwd)
 
static void rem_user_from_group (GF_Config *creds, const char *group, const char *user)
 

Variables

GF_FilterSession * session =NULL
 
u32 list_filters = 0
 
u32 print_filter_info = 0
 
int alias_argc = 0
 
char ** alias_argv = NULL
 
GF_List * args_used = NULL
 
GF_List * args_alloc = NULL
 
u32 gen_doc = 0
 
u32 help_flags = 0
 
FILE * helpout = NULL
 
const char * auto_gen_md_warning = "<!-- automatically generated - do not edit, patch gpac/applications/gpac/gpac.c -->\n"
 
u32 compositor_mode = 0
 
char separator_set [7] = GF_FS_DEFAULT_SEPS
 
const char * gpac_doc
 
static GF_SystemRTInfo rti
 
static Bool dump_stats = GF_FALSE
 
static Bool dump_graph = GF_FALSE
 
static Bool print_meta_filters = GF_FALSE
 
static Bool load_test_filters = GF_FALSE
 
static s32 nb_loops = 0
 
static s32 runfor = 0
 
static Bool runfor_exit = GF_FALSE
 
static Bool runfor_fast = GF_FALSE
 
static u32 exit_mode = 0
 
static Bool enable_prompt = GF_FALSE
 
static Bool exit_nocleanup = GF_FALSE
 
static u32 enable_reports = 0
 
static char * report_filter = NULL
 
static Bool do_unit_tests = GF_FALSE
 
static Bool use_step_mode = GF_FALSE
 
static u32 loops_done = 0
 
static GF_Err evt_ret_val = GF_OK
 
static Bool in_sig_handler = GF_FALSE
 
static Bool custom_event_proc =GF_FALSE
 
static u64 run_start_time = 0
 
static Bool return_gferr = GF_FALSE
 
static Bool alias_is_play = GF_FALSE
 
static u32 nb_filters = 0
 
static GF_List * links_directive =NULL
 
static GF_List * loaded_filters =NULL
 
static char * view_conn_for_filter = NULL
 
static GF_SysArgMode argmode = GF_ARGMODE_BASE
 
static u32 sflags =0
 
static Bool override_seps =GF_FALSE
 
static int argc
 
static char ** argv
 
static Bool view_filter_conn = GF_FALSE
 
static Bool dump_codecs = GF_FALSE
 
static Bool dump_formats = GF_FALSE
 
static Bool dump_proto_schemes = GF_FALSE
 
static Bool write_profile =GF_FALSE
 
static Bool write_core_opts =GF_FALSE
 
static Bool write_extensions =GF_FALSE
 
static const char * session_js =NULL
 
static Bool has_xopt = GF_FALSE
 
static Bool nothing_to_do = GF_TRUE
 
static Bool defer_mode = GF_FALSE
 
static struct _gpac_key GPAC_Keys []
 
static char szFilter [100]
 
static char szCom [2048]
 
static Bool logs_to_file =GF_FALSE
 
struct _logentrystatic_logs
 
static u32 nb_log_entries = DEF_LOG_ENTRIES
 
static u32 log_write =0
 
static char * log_buf = NULL
 
static u32 log_buf_size =0
 
static u64 last_report_clock_us = 0
 
static GF_List * all_gfio_defined = NULL
 
static Bool prev_was_cmd =GF_FALSE
 
static Bool signal_catched =GF_FALSE
 
static Bool signal_processed =GF_FALSE
 

Data Structure Documentation

◆ _gpac_key

struct _gpac_key
Data Fields
u8 char_code
GPAC_Command cmd_type
const char * cmd_help
u32 flags

◆ _logentry

struct _logentry
Data Fields
u32 tool
u32 level
u32 nb_repeat
u64 clock
char * szMsg

◆ CacheInfo

struct CacheInfo
Data Fields
u32 op_type
u32 nb_entries
u32 total_size
u32 min_size
u32 max_size
u64 min_created
u64 max_created
u64 min_expire
u64 max_expire
u64 min_hit
u64 max_hit
u32 min_nb_hit
u32 max_nb_hit
u64 date_min
u64 date_max
char * name
u64 created
u64 last_hit
u32 nb_hit
u32 size

◆ FileIOCtx

struct FileIOCtx
Data Fields
FILE * filep
char * path
Bool write
u32 io_mode
u32 nb_refs

Macro Definition Documentation

◆ SET_CONSOLE

#define SET_CONSOLE (   _code)    gf_sys_set_console_code(stderr, _code)

◆ gpac_exit

#define gpac_exit (   _code)     return gpac_exit_fun(_code)

◆ ERR_EXIT

#define ERR_EXIT   goto exit;

◆ DEF_LOG_ENTRIES

#define DEF_LOG_ENTRIES   10

◆ TIMEFMT

#define TIMEFMT   "%Y/%m/%dT%H:%M:%SZ"

◆ PTR_INT

#define PTR_INT   (u64) (u32)

◆ UPDATE_FIELD

#define UPDATE_FIELD (   _prompt,
  _key 
)
Value:
val = gf_cfg_get_key(creds, creds_args, _key);\
if (!val) val="";\
fprintf(stderr, "\nEnter %s (%s): \n", _prompt, val);\
if (gf_read_line_input(szP1, 50, 1) && szP1[0]) \
gf_cfg_set_key(creds, creds_args, _key, szP1); \
const char * gf_cfg_get_key(GF_Config *cfgFile, const char *secName, const char *keyName)
key value query
Definition: configfile.c:381
Bool gf_read_line_input(char *line, int maxSize, Bool showContent)
Reads a line of input from stdin.
Definition: os_divers.c:3333

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CACHE_OP_DELETE 
CACHE_OP_SHOW 
CACHE_OP_INFO 
CACHE_OP_UNFLATTEN 

◆ GPAC_Command

Enumerator
GPAC_COM_UNDEF 
GPAC_QUIT 
GPAC_EXIT 
GPAC_PRINT_STATS 
GPAC_PRINT_GRAPH 
GPAC_SEND_UPDATE 
GPAC_LIST_FILTERS 
GPAC_INSERT_FILTER 
GPAC_REMOVE_FILTER 
GPAC_PRINT_HELP 

Function Documentation

◆ gpac_print_report()

static void gpac_print_report ( GF_FilterSession *  fsess,
Bool  is_init,
Bool  is_final 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanup_logs()

static void cleanup_logs ( void  )
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpac_handle_prompt()

static Bool gpac_handle_prompt ( GF_FilterSession *  fsess,
char  char_code 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpac_fsess_task_help()

static void gpac_fsess_task_help ( void  )
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_fileio()

static const char * make_fileio ( const char *  inargs,
const char **  out_arg,
u32  mode,
GF_Err e 
)
static
+ Here is the call graph for this function:

◆ cleanup_file_io()

static void cleanup_file_io ( void  )
static
+ Here is the call graph for this function:

◆ load_custom_filter()

static GF_Filter * load_custom_filter ( GF_FilterSession *  sess,
char *  opts,
GF_Err e 
)
static
+ Here is the call graph for this function:

◆ gpac_unit_tests()

static u32 gpac_unit_tests ( GF_MemTrackerType  mem_track)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_cache_check()

static void do_cache_check ( u32  op_type,
char *  argval 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_pid_props()

static GF_Err print_pid_props ( char *  arg)
static
+ Here is the call graph for this function:

◆ probe_pid_link()

static GF_Err probe_pid_link ( char *  arg)
static
+ Here is the call graph for this function:

◆ print_pid_dests()

static GF_Err print_pid_dests ( char *  arg)
static
+ Here is the call graph for this function:

◆ gpac_sig_handler()

static void gpac_sig_handler ( int  sig)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpac_do_creds()

static int gpac_do_creds ( char *  creds_args)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpac_event_proc()

static Bool gpac_event_proc ( void *  opaque,
GF_Event event 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpac_fsess_task()

static Bool gpac_fsess_task ( GF_FilterSession *  fsess,
void *  callback,
u32 reschedule_ms 
)
static
+ Here is the call graph for this function:

◆ gpac_exit_fun()

static int gpac_exit_fun ( GF_Err  code)
static
+ Here is the call graph for this function:

◆ get_u32()

u32 get_u32 ( char *  val,
char *  log_name 
)
+ Here is the caller graph for this function:

◆ get_s32()

s32 get_s32 ( char *  val,
char *  log_name 
)
+ Here is the caller graph for this function:

◆ enum_net_ifces()

static Bool enum_net_ifces ( void *  cbk,
const char *  name,
const char *  IP,
u32  flags 
)
static
+ Here is the caller graph for this function:

◆ run_sess()

static void run_sess ( void  )
static
+ Here is the call graph for this function:

◆ process_link_directive()

static GF_Err process_link_directive ( char *  link,
GF_Filter *  filter,
GF_List *  loaded_filters,
char *  ext_link 
)
static
+ Here is the call graph for this function:

◆ gpac_main()

static int gpac_main ( int  _argc,
char **  _argv 
)
static
+ Here is the call graph for this function:

◆ get_cmd()

static GPAC_Command get_cmd ( u8  char_code)
static
+ Here is the caller graph for this function:

◆ extract_filter_and_pid()

static GF_Err extract_filter_and_pid ( char *  arg,
GF_Filter **  o_f,
s32 opid_idx,
u8 prefix_c 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpac_on_logs()

static void gpac_on_logs ( void *  cbck,
GF_LOG_Level  log_level,
GF_LOG_Tool  log_tool,
const char *  fmt,
va_list  vlist 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_date_ex()

static void print_date_ex ( u64  time,
Bool  full_print 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_date()

static void print_date ( u64  time)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format_date()

static GFINLINE const char* format_date ( u64  time,
char *  szDate 
)
static
+ Here is the caller graph for this function:

◆ cache_file_op()

static Bool cache_file_op ( void *  cbck,
char *  item_name,
char *  item_path,
GF_FileEnumInfo file_info 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fio_open()

static GF_FileIO * fio_open ( GF_FileIO *  fileio_ref,
const char *  url,
const char *  mode,
GF_Err out_err 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fio_seek()

static GF_Err fio_seek ( GF_FileIO *  fileio,
u64  offset,
s32  whence 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fio_read()

static u32 fio_read ( GF_FileIO *  fileio,
u8 buffer,
u32  bytes 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fio_write()

static u32 fio_write ( GF_FileIO *  fileio,
u8 buffer,
u32  bytes 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fio_tell()

static s64 fio_tell ( GF_FileIO *  fileio)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fio_eof()

static Bool fio_eof ( GF_FileIO *  fileio)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fio_printf()

static int fio_printf ( GF_FileIO *  fileio,
const char *  format,
va_list  args 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cust_configure_pid()

static GF_Err cust_configure_pid ( GF_Filter *  filter,
GF_FilterPid *  pid,
Bool  is_remove 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cust_process()

static GF_Err cust_process ( GF_Filter *  filter)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ to_hex()

static void to_hex ( u8 data,
u32  len,
char *  out 
)
static
+ Here is the caller graph for this function:

◆ creds_set_pass()

static u64 creds_set_pass ( GF_Config *  creds,
const char *  user,
const char *  passwd 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rem_user_from_group()

static void rem_user_from_group ( GF_Config *  creds,
const char *  group,
const char *  user 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ list_filters

u32 list_filters = 0

◆ print_filter_info

u32 print_filter_info = 0

◆ alias_argc

int alias_argc = 0

◆ alias_argv

char** alias_argv = NULL

◆ args_used

GF_List* args_used = NULL

◆ args_alloc

GF_List* args_alloc = NULL

◆ gen_doc

u32 gen_doc = 0

◆ help_flags

u32 help_flags = 0

◆ helpout

FILE* helpout = NULL

◆ auto_gen_md_warning

const char* auto_gen_md_warning = "<!-- automatically generated - do not edit, patch gpac/applications/gpac/gpac.c -->\n"

◆ compositor_mode

u32 compositor_mode = 0

◆ separator_set

char separator_set[7] = GF_FS_DEFAULT_SEPS

◆ gpac_doc

const char* gpac_doc
extern

◆ rti

GF_SystemRTInfo rti
static

◆ dump_stats

Bool dump_stats = GF_FALSE
static

◆ dump_graph

Bool dump_graph = GF_FALSE
static

◆ print_meta_filters

Bool print_meta_filters = GF_FALSE
static

◆ load_test_filters

Bool load_test_filters = GF_FALSE
static

◆ nb_loops

s32 nb_loops = 0
static

◆ runfor

s32 runfor = 0
static

◆ runfor_exit

Bool runfor_exit = GF_FALSE
static

◆ runfor_fast

Bool runfor_fast = GF_FALSE
static

◆ exit_mode

u32 exit_mode = 0
static

◆ enable_prompt

Bool enable_prompt = GF_FALSE
static

◆ exit_nocleanup

Bool exit_nocleanup = GF_FALSE
static

◆ enable_reports

u32 enable_reports = 0
static

◆ report_filter

char* report_filter = NULL
static

◆ do_unit_tests

Bool do_unit_tests = GF_FALSE
static

◆ use_step_mode

Bool use_step_mode = GF_FALSE
static

◆ loops_done

u32 loops_done = 0
static

◆ evt_ret_val

GF_Err evt_ret_val = GF_OK
static

◆ in_sig_handler

Bool in_sig_handler = GF_FALSE
static

◆ custom_event_proc

Bool custom_event_proc =GF_FALSE
static

◆ run_start_time

u64 run_start_time = 0
static

◆ return_gferr

Bool return_gferr = GF_FALSE
static

◆ alias_is_play

Bool alias_is_play = GF_FALSE
static

◆ nb_filters

u32 nb_filters = 0
static

◆ links_directive

GF_List* links_directive =NULL
static

◆ loaded_filters

GF_List* loaded_filters =NULL
static

◆ view_conn_for_filter

char* view_conn_for_filter = NULL
static

◆ argmode

GF_SysArgMode argmode = GF_ARGMODE_BASE
static

◆ sflags

u32 sflags =0
static

◆ override_seps

Bool override_seps =GF_FALSE
static

◆ argc

int argc
static

◆ argv

char** argv
static

◆ view_filter_conn

Bool view_filter_conn = GF_FALSE
static

◆ dump_codecs

Bool dump_codecs = GF_FALSE
static

◆ dump_formats

Bool dump_formats = GF_FALSE
static

◆ dump_proto_schemes

Bool dump_proto_schemes = GF_FALSE
static

◆ write_profile

Bool write_profile =GF_FALSE
static

◆ write_core_opts

Bool write_core_opts =GF_FALSE
static

◆ write_extensions

Bool write_extensions =GF_FALSE
static

◆ session_js

const char* session_js =NULL
static

◆ has_xopt

Bool has_xopt = GF_FALSE
static

◆ nothing_to_do

Bool nothing_to_do = GF_TRUE
static

◆ defer_mode

Bool defer_mode = GF_FALSE
static

◆ GPAC_Keys

struct _gpac_key GPAC_Keys[]
static
Initial value:
= {
{'q', GPAC_QUIT, "flush all streams and exit", 0},
{'x', GPAC_EXIT, "exit with no flush (may break output files)", 0},
{'s', GPAC_PRINT_STATS, "print statistics", 0},
{'g', GPAC_PRINT_GRAPH, "print filter graph", 0},
{'l', GPAC_LIST_FILTERS, "list filters", 0},
{'u', GPAC_SEND_UPDATE, "update argument of filter", 0},
{'i', GPAC_INSERT_FILTER, "insert a filter in the chain", 0},
{'r', GPAC_REMOVE_FILTER, "remove a filter from the chain", 0},
{'h', GPAC_PRINT_HELP, "print this help", 0},
{0}
}
@ GPAC_PRINT_GRAPH
Definition: gpac.c:1897
@ GPAC_REMOVE_FILTER
Definition: gpac.c:1901
@ GPAC_PRINT_HELP
Definition: gpac.c:1902
@ GPAC_INSERT_FILTER
Definition: gpac.c:1900
@ GPAC_EXIT
Definition: gpac.c:1895
@ GPAC_QUIT
Definition: gpac.c:1894
@ GPAC_PRINT_STATS
Definition: gpac.c:1896
@ GPAC_LIST_FILTERS
Definition: gpac.c:1899
@ GPAC_SEND_UPDATE
Definition: gpac.c:1898

◆ szFilter

char szFilter[100]
static

◆ szCom

char szCom[2048]
static

◆ logs_to_file

Bool logs_to_file =GF_FALSE
static

◆ static_logs

struct _logentry * static_logs

◆ nb_log_entries

u32 nb_log_entries = DEF_LOG_ENTRIES
static

◆ log_write

u32 log_write =0
static

◆ log_buf

char* log_buf = NULL
static

◆ log_buf_size

u32 log_buf_size =0
static

◆ last_report_clock_us

u64 last_report_clock_us = 0
static

◆ all_gfio_defined

GF_List* all_gfio_defined = NULL
static

◆ prev_was_cmd

Bool prev_was_cmd =GF_FALSE
static

◆ signal_catched

Bool signal_catched =GF_FALSE
static

◆ signal_processed

Bool signal_processed =GF_FALSE
static