libgpac
Documentation of the core library of GPAC
|
Filter. More...
Data Structures | |
struct | GF_FilterArgs |
struct | GF_FilterCapability |
struct | GF_FilterSessionCaps |
struct | GF_FilterRegister |
struct | GF_FSEventListener |
Macros | |
#define | CAP_SINT(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_SINT, .value.sint = _b}, .flags=(_f) } |
#define | CAP_UINT(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_UINT, .value.uint = _b}, .flags=(_f) } |
#define | CAP_4CC(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_4CC, .value.uint = _b}, .flags=(_f) } |
#define | CAP_LSINT(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_LSINT, .value.longsint = _b}, .flags=(_f) } |
#define | CAP_LUINT(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_LUINT, .value.longuint = _b}, .flags=(_f) } |
#define | CAP_BOOL(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_BOOL, .value.boolean = _b}, .flags=(_f) } |
#define | CAP_FIXED(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_FLOAT, .value.fnumber = _b}, .flags=(_f) } |
#define | CAP_FLOAT(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_FLOAT, .value.fnumber = FLT2FIX(_b)}, .flags=(_f) } |
#define | CAP_FRAC_INT(_f, _a, _b, _c) { .code=_a, .val={.type=GF_PROP_FRACTION, .value.frac.num = _b, .value.frac.den = _c}, .flags=(_f) } |
#define | CAP_FRAC(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_FRACTION, .value.frac = _b}, .flags=(_f) } |
#define | CAP_DOUBLE(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_DOUBLE, .value.number = _b}, .flags=(_f) } |
#define | CAP_NAME(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_NAME, .value.string = _b}, .flags=(_f) } |
#define | CAP_STRING(_f, _a, _b) { .code=_a, .val={.type=GF_PROP_STRING, .value.string = _b}, .flags=(_f) } |
#define | CAP_UINT_PRIORITY(_f, _a, _b, _p) { .code=_a, .val={.type=GF_PROP_UINT, .value.uint = _b}, .flags=(_f), .priority=_p} |
#define | GF_CAPS_INPUT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT) |
#define | GF_CAPS_INPUT_OPT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OPTIONAL) |
#define | GF_CAPS_INPUT_STATIC (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_STATIC) |
#define | GF_CAPS_INPUT_STATIC_OPT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_STATIC|GF_CAPFLAG_OPTIONAL) |
#define | GF_CAPS_INPUT_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_EXCLUDED) |
#define | GF_CAPS_INPUT_LOADED_FILTER (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_LOADED_FILTER) |
#define | GF_CAPS_OUTPUT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT) |
#define | GF_CAPS_OUTPUT_LOADED_FILTER (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_LOADED_FILTER) |
#define | GF_CAPS_OUTPUT_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_EXCLUDED) |
#define | GF_CAPS_OUTPUT_STATIC (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_STATIC) |
#define | GF_CAPS_OUTPUT_STATIC_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_EXCLUDED|GF_CAPFLAG_STATIC) |
#define | GF_CAPS_INPUT_OUTPUT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OUTPUT) |
#define | GF_CAPS_INPUT_OUTPUT_OPT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_OPTIONAL) |
#define | GF_CAPS_IN_OUT_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_EXCLUDED) |
#define | SETCAPS(__struct) .caps = __struct, .nb_caps=sizeof(__struct)/sizeof(GF_FilterCapability) |
#define | GF_FS_SET_DESCRIPTION(_desc) .description = _desc, |
#define | GF_FS_SET_AUTHOR(_author) .author = _author, |
#define | GF_FS_SET_HELP(_help) .help = _help, |
#define | GF_FS_DEF_ARG(_name, _offset, _desc, _type, _default, _enum, _flags) { _name, _offset, _desc, _type, _default, _enum, _flags } |
Functions | |
void | gf_filter_get_session_caps (GF_Filter *filter, GF_FilterSessionCaps *caps) |
void | gf_filter_set_session_caps (GF_Filter *filter, GF_FilterSessionCaps *caps) |
Bool | gf_filter_is_instance_of (GF_Filter *filter, const GF_FilterRegister *freg) |
void | gf_filter_abort (GF_Filter *filter) |
void | gf_filter_lock (GF_Filter *filter, Bool do_lock) |
void | gf_filter_lock_all (GF_Filter *filter, Bool do_lock) |
void | gf_filter_require_source_id (GF_Filter *filter) |
GF_Err | gf_filter_set_rt_udta (GF_Filter *filter, void *udta) |
void * | gf_filter_get_rt_udta (GF_Filter *filter) |
void * | gf_filter_get_udta (GF_Filter *filter) |
void | gf_filter_set_name (GF_Filter *filter, const char *name) |
Bool | gf_filter_is_temporary (GF_Filter *filter) |
const char * | gf_filter_get_name (GF_Filter *filter) |
void | gf_filter_make_sticky (GF_Filter *filter) |
u32 | gf_filter_get_num_events_queued (GF_Filter *filter) |
GF_DownloadManager * | gf_filter_get_download_manager (GF_Filter *filter) |
struct _gf_ft_mgr * | gf_filter_get_font_manager (GF_Filter *filter) |
void | gf_filter_ask_rt_reschedule (GF_Filter *filter, u32 us_until_next) |
void | gf_filter_post_process_task (GF_Filter *filter) |
GF_Err | gf_filter_post_task (GF_Filter *filter, Bool(*task_execute)(GF_Filter *filter, void *callback, u32 *reschedule_ms), void *udta, const char *task_name) |
void | gf_filter_set_setup_failure_callback (GF_Filter *filter, GF_Filter *source_filter, Bool(*on_setup_error)(GF_Filter *f, void *on_setup_error_udta, GF_Err e), void *udta) |
void | gf_filter_setup_failure (GF_Filter *filter, GF_Err reason) |
void | gf_filter_notification_failure (GF_Filter *filter, GF_Err reason, Bool force_disconnect) |
void | gf_filter_remove_src (GF_Filter *filter, GF_Filter *src_filter) |
void | gf_filter_remove (GF_Filter *filter) |
void | gf_filter_set_max_extra_input_pids (GF_Filter *filter, u32 max_extra_pids) |
u32 | gf_filter_get_max_extra_input_pids (GF_Filter *filter) |
Bool | gf_filter_block_enabled (GF_Filter *filter) |
void | gf_filter_block_eos (GF_Filter *filter, Bool do_block) |
GF_Filter * | gf_filter_connect_source (GF_Filter *filter, const char *url, const char *parent_url, Bool inherit_args, GF_Err *err) |
GF_Filter * | gf_filter_add_source (GF_Filter *filter, const char *url, const char *parent_url, Bool inherit_args, GF_Err *err) |
GF_Filter * | gf_filter_connect_destination (GF_Filter *filter, const char *url, GF_Err *err) |
GF_Filter * | gf_filter_load_filter (GF_Filter *filter, const char *name, GF_Err *err_code) |
Bool | gf_filter_is_supported_source (GF_Filter *filter, const char *url, const char *parent_url) |
Bool | gf_filter_url_is_filter (GF_Filter *filter, const char *url, Bool *act_as_source) |
u32 | gf_filter_get_ipid_count (GF_Filter *filter) |
GF_FilterPid * | gf_filter_get_ipid (GF_Filter *filter, u32 idx) |
u32 | gf_filter_get_opid_count (GF_Filter *filter) |
GF_FilterPid * | gf_filter_get_opid (GF_Filter *filter, u32 idx) |
void | gf_filter_get_output_buffer_max (GF_Filter *filter, u32 *max_buf, u32 *max_playout_buf) |
void | gf_filter_hint_single_clock (GF_Filter *filter, u64 time_in_us, GF_Fraction64 media_timestamp) |
void | gf_filter_get_clock_hint (GF_Filter *filter, u64 *time_in_us, GF_Fraction64 *media_timestamp) |
GF_Err | gf_filter_set_source (GF_Filter *filter, GF_Filter *link_from, const char *link_ext) |
GF_Err | gf_filter_set_source_restricted (GF_Filter *filter, GF_Filter *link_from, const char *link_ext) |
void | gf_filter_reset_source (GF_Filter *filter) |
GF_Err | gf_filter_assign_id (GF_Filter *filter, const char *filter_id) |
const char * | gf_filter_get_id (GF_Filter *filter) |
void | gf_filter_set_blocking (GF_Filter *filter, Bool is_blocking) |
GF_Err | gf_filter_override_caps (GF_Filter *filter, const GF_FilterCapability *caps, u32 nb_caps) |
GF_Err | gf_filter_act_as_sink (GF_Filter *filter) |
u8 | gf_filter_get_sep (GF_Filter *filter, GF_FilterSessionSepType sep_type) |
const char * | gf_filter_get_dst_args (GF_Filter *filter) |
char * | gf_filter_get_dst_name (GF_Filter *filter) |
const char * | gf_filter_get_src_args (GF_Filter *filter) |
void | gf_filter_send_event (GF_Filter *filter, GF_FilterEvent *evt, Bool upstream) |
GF_Err | gf_filter_reconnect_output (GF_Filter *filter, GF_FilterPid *for_pid) |
GF_Err | gf_filter_set_event_target (GF_Filter *filter, Bool enable_events) |
const GF_PropertyValue * | gf_filter_get_info (GF_Filter *filter, u32 prop_4cc, GF_PropertyEntry **propentry) |
const GF_PropertyValue * | gf_filter_get_info_str (GF_Filter *filter, const char *prop_name, GF_PropertyEntry **propentry) |
void | gf_filter_release_property (GF_PropertyEntry *propentry) |
void | gf_filter_send_update (GF_Filter *filter, const char *target_filter_id, const char *arg_name, const char *arg_val, GF_EventPropagateType propagate_mask) |
GF_Err | gf_filter_add_event_listener (GF_Filter *filter, GF_FSEventListener *el) |
GF_Err | gf_filter_remove_event_listener (GF_Filter *filter, GF_FSEventListener *el) |
Bool | gf_filter_forward_gf_event (GF_Filter *filter, GF_Event *evt, Bool consumed, Bool skip_user) |
Bool | gf_filter_send_gf_event (GF_Filter *filter, GF_Event *evt) |
Bool | gf_filter_all_sinks_done (GF_Filter *filter) |
const char * | gf_filter_get_arg_str (GF_Filter *filter, const char *arg_name, char dump[GF_PROP_DUMP_ARG_SIZE]) |
Bool | gf_filter_get_arg (GF_Filter *filter, const char *arg_name, GF_PropertyValue *prop) |
Bool | gf_filter_is_supported_mime (GF_Filter *filter, const char *mime) |
Bool | gf_filter_ui_event (GF_Filter *filter, GF_Event *uievt) |
void | gf_filter_register_opengl_provider (GF_Filter *filter, Bool do_register) |
GF_Err | gf_filter_request_opengl (GF_Filter *filter) |
GF_Err | gf_filter_set_active_opengl_context (GF_Filter *filter, Bool do_activate) |
u32 | gf_filter_count_source_by_protocol (GF_Filter *filter, const char *protocol_scheme, Bool expand_proto, GF_FilterPid *(*enum_pids)(void *udta, u32 *idx), void *udta) |
void | gf_filter_disable_probe (GF_Filter *filter) |
void | gf_filter_disable_inputs (GF_Filter *filter) |
Bool | gf_filter_has_pid_connection_pending (GF_Filter *filter, GF_Filter *stop_at_filter) |
Bool | gf_filter_connections_pending (GF_Filter *filter) |
GF_Err | gf_filter_prevent_blocking (GF_Filter *filter, Bool prevent_blocking_enabled) |
Bool | gf_filter_is_dynamic (GF_Filter *filter) |
Bool | gf_filter_reporting_enabled (GF_Filter *filter) |
GF_Err | gf_filter_update_status (GF_Filter *filter, u32 percent, char *szStatus) |
Bool | gf_filter_end_of_session (GF_Filter *filter) |
void | gf_filter_report_meta_option (GF_Filter *filter, const char *arg, Bool was_found, const char *sub_opt_name) |
GF_Err | gf_filter_set_description (GF_Filter *filter, const char *new_desc) |
const char * | gf_filter_get_description (GF_Filter *filter) |
GF_Err | gf_filter_set_class_hint (GF_Filter *filter, GF_ClassTypeHint class_hint) |
GF_ClassTypeHint | gf_filter_get_class_hint (GF_Filter *filter) |
GF_Err | gf_filter_set_version (GF_Filter *filter, const char *new_version) |
const char * | gf_filter_get_version (GF_Filter *filter) |
GF_Err | gf_filter_set_author (GF_Filter *filter, const char *new_author) |
const char * | gf_filter_get_author (GF_Filter *filter) |
GF_Err | gf_filter_set_help (GF_Filter *filter, const char *new_help) |
const char * | gf_filter_get_help (GF_Filter *filter) |
GF_Err | gf_filter_define_args (GF_Filter *filter, GF_FilterArgs *new_args) |
GF_FilterArgs * | gf_filter_get_args (GF_Filter *filter) |
const GF_FilterCapability * | gf_filter_get_caps (GF_Filter *filter, u32 *nb_caps) |
const char * | gf_filter_probe_data (GF_Filter *filter, u8 *data, u32 size, GF_FilterProbeScore *score) |
Bool | gf_filter_is_alias (GF_Filter *filter) |
Bool | gf_filter_in_parent_chain (GF_Filter *parent, GF_Filter *filter) |
GF_Err | gf_filter_get_stats (GF_Filter *filter, GF_FilterStats *stats) |
const GF_FilterArgs * | gf_filter_enumerate_args (GF_Filter *filter, u32 idx) |
Bool | gf_filter_relocate_url (GF_Filter *filter, const char *service_url, const char *parent_url, char *out_relocated_url, char *out_localized_url) |
GF_Err | gf_filter_probe_link (GF_Filter *filter, u32 opid_idx, const char *fname, char **result_chain) |
GF_Err | gf_filter_probe_links (GF_Filter *filter, u32 opid_idx, const char *fname, char **result_chain) |
GF_Err | gf_filter_get_possible_destinations (GF_Filter *filter, s32 opid_idx, char **result_list) |
const GF_FilterRegister * | gf_filter_get_register (GF_Filter *filter) |
void | gf_filter_print_all_connections (GF_Filter *filter, void(*print_fn)(FILE *output, GF_SysPrintArgFlags flags, const char *fmt,...)) |
void | gf_filter_force_main_thread (GF_Filter *filter, Bool do_tag) |
Bool | gf_filter_is_sink (GF_Filter *filter) |
Bool | gf_filter_is_source (GF_Filter *filter) |
GF_Err | gf_filter_tag_subsession (GF_Filter *filter, u32 subsession_id, u32 source_id) |
Bool | gf_filter_has_connect_errors (GF_Filter *filter) |
const char * | gf_filter_get_netcap_id (GF_Filter *filter) |
void | gf_filter_meta_set_instances (GF_Filter *filter, const char *instance_names_list) |
const char * | gf_filter_meta_get_instances (GF_Filter *filter) |
const char * | gf_filter_path_escape_colon (GF_Filter *filter, const char *path) |
The API for filters documents declaration of filters, their creation and functions available to interact with the filter session. The gf_filter_* functions shall only be called from within a given filter, this filter being the target of the function. This is not checked at runtime.
Calling these functions on other filters will result in unpredictable behavior, very likely crashes in multi-threading conditions.
A filter is instanciated through a filter register. The register holds entry points to a filter, arguments of a filter (basically property values) and capabilities.
Capabilities are used to check if a filter can be connected to a given input PID, or if two filters can be directly connected (capability match).
Capabilities are organized in so-called bundles, gathering the caps that shall be present or not present in the PID / connecting filter. Typically a capability bundle will contain a stream type for input a stream type for output, a codec id for input and a codec id for output.
Several capability bundles can be used if needed. A good example is the writegen filter in GPAC, which simply transforms a sequence of media frames into a raw file, hence converts stream_type/codecID to file extension and MIME type - cf gpac/src/filters/write_generic.c
When resolving a chain, PID properties are checked against these capabilities. If a property of the same type exists in the PID than in the capability, it must match the capability requirement (equal, excluded). If no property exists for a given non-optional capability type, the bundle is marked as not matching and the ext capability bundle in the filter is checked. A PID property not listed in any capability of the filter does not impact the matching.
The GF_PROP_PID_FILE_EXT and GF_PROP_PID_MIME are handled as alternate to each other, this allows matching a PID if either its MIME or extension map and avoids failing if the pid has no MIME or extension set.
struct GF_FilterArgs |
Structure holding arguments for a filter
Data Fields | ||
---|---|---|
const char * | arg_name |
argument name. Naming conventions:
|
s32 | offset_in_private |
offset of the argument in the structure, -1 means not exposed/stored in structure, in which case it is notified through the update_arg function. The offset is casted into the corresponding property value of the argument type |
const char * | arg_desc |
description of argument. Format conventions:
|
GF_PropType | arg_type |
type of argument - this is a property type |
const char * | arg_default_val |
default value of argument, can be NULL (for number types, value 0 for each dimension of the type is assumed) |
const char * | min_max_enum |
string describing an enum (unsigned integer type) or a min/max value. For min/max, the syntax is "min,max", with -I = -infinity and +I = +infinity For enum, the syntax is "a|b|...", resoling in a=0, b=1,... To skip a value insert '|' eg "|a|b" resolves to a=1, b=2, "a||b" resolves to a=0, b=2 Naming conventions for enumeration:
|
GF_FSArgumentFlags | flags |
set of argument flags |
struct GF_FilterCapability |
Filter capability description
Data Fields | ||
---|---|---|
u32 | code |
4cc of the capability listed. This shall be 0 or the type of a built-in property |
GF_PropertyValue | val |
default type and value of the capability listed |
const char * | name |
name of the capability listed, NULL if code is set. The special value * is used to indicate that the capability is solved at runtime (the filter must be loaded) |
u32 | flags |
Flags of the capability |
u8 | priority |
overrides the filter register priority for this capability. Usually 0 |
struct GF_FilterSessionCaps |
#define CAP_SINT | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_SINT, .value.sint = _b}, .flags=(_f) } |
Shortcut macro to assign singed integer capability type
#define CAP_UINT | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_UINT, .value.uint = _b}, .flags=(_f) } |
Shortcut macro to assign unsigned integer capability type
#define CAP_4CC | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_4CC, .value.uint = _b}, .flags=(_f) } |
Shortcut macro to assign unsigned integer capability type
#define CAP_LSINT | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_LSINT, .value.longsint = _b}, .flags=(_f) } |
Shortcut macro to assign signed long integer capability type
#define CAP_LUINT | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_LUINT, .value.longuint = _b}, .flags=(_f) } |
Shortcut macro to assign unsigned long integer capability type
#define CAP_BOOL | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_BOOL, .value.boolean = _b}, .flags=(_f) } |
Shortcut macro to assign boolean capability type
#define CAP_FIXED | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_FLOAT, .value.fnumber = _b}, .flags=(_f) } |
Shortcut macro to assign fixed-point number capability type
#define CAP_FLOAT | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_FLOAT, .value.fnumber = FLT2FIX(_b)}, .flags=(_f) } |
Shortcut macro to assign float capability type
#define CAP_FRAC_INT | ( | _f, | |
_a, | |||
_b, | |||
_c | |||
) | { .code=_a, .val={.type=GF_PROP_FRACTION, .value.frac.num = _b, .value.frac.den = _c}, .flags=(_f) } |
Shortcut macro to assign 32-bit fraction capability type
#define CAP_FRAC | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_FRACTION, .value.frac = _b}, .flags=(_f) } |
Shortcut macro to assign 32-bit fraction capability type from integers
#define CAP_DOUBLE | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_DOUBLE, .value.number = _b}, .flags=(_f) } |
Shortcut macro to assign double capability type
#define CAP_NAME | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_NAME, .value.string = _b}, .flags=(_f) } |
Shortcut macro to assign name (const string) capability type
#define CAP_STRING | ( | _f, | |
_a, | |||
_b | |||
) | { .code=_a, .val={.type=GF_PROP_STRING, .value.string = _b}, .flags=(_f) } |
Shortcut macro to assign string capability type
#define CAP_UINT_PRIORITY | ( | _f, | |
_a, | |||
_b, | |||
_p | |||
) | { .code=_a, .val={.type=GF_PROP_UINT, .value.uint = _b}, .flags=(_f), .priority=_p} |
Shortcut macro to assign unsigned integer capability type with capability priority
#define GF_CAPS_INPUT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT) |
Shortcut macro to set for input capability flags
#define GF_CAPS_INPUT_OPT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OPTIONAL) |
Shortcut macro to set for optional input capability flags
#define GF_CAPS_INPUT_STATIC (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_STATIC) |
Shortcut macro to set for static input capability flags
#define GF_CAPS_INPUT_STATIC_OPT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_STATIC|GF_CAPFLAG_OPTIONAL) |
Shortcut macro to set for static optional input capability flags
#define GF_CAPS_INPUT_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_EXCLUDED) |
Shortcut macro to set for excluded input capability flags
#define GF_CAPS_INPUT_LOADED_FILTER (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_LOADED_FILTER) |
Shortcut macro to set for input for loaded filter only capability flags
#define GF_CAPS_OUTPUT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT) |
Shortcut macro to set for output capability flags
#define GF_CAPS_OUTPUT_LOADED_FILTER (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_LOADED_FILTER) |
Shortcut macro to set for output for loaded filter only capability flags
#define GF_CAPS_OUTPUT_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_EXCLUDED) |
Shortcut macro to set for excluded output capability flags
#define GF_CAPS_OUTPUT_STATIC (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_STATIC) |
Shortcut macro to set for static output capability flags
#define GF_CAPS_OUTPUT_STATIC_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_EXCLUDED|GF_CAPFLAG_STATIC) |
Shortcut macro to set for excluded static output capability flags
#define GF_CAPS_INPUT_OUTPUT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OUTPUT) |
Shortcut macro to set for input and output capability flags
#define GF_CAPS_INPUT_OUTPUT_OPT (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_OPTIONAL) |
Shortcut macro to set for optional input and output capability flags
#define GF_CAPS_IN_OUT_EXCLUDED (GF_CAPFLAG_IN_BUNDLE|GF_CAPFLAG_INPUT|GF_CAPFLAG_OUTPUT|GF_CAPFLAG_EXCLUDED) |
Shortcut macro to set for excluded input capability flags
#define SETCAPS | ( | __struct | ) | .caps = __struct, .nb_caps=sizeof(__struct)/sizeof(GF_FilterCapability) |
Quick macro for assigning the capability arrays to the register structure
#define GF_FS_SET_DESCRIPTION | ( | _desc | ) | .description = _desc, |
Macro for assigning filter register description
#define GF_FS_SET_AUTHOR | ( | _author | ) | .author = _author, |
Macro for assigning filter register author
#define GF_FS_SET_HELP | ( | _help | ) | .help = _help, |
Macro for assigning filter register help
#define GF_FS_DEF_ARG | ( | _name, | |
_offset, | |||
_desc, | |||
_type, | |||
_default, | |||
_enum, | |||
_flags | |||
) | { _name, _offset, _desc, _type, _default, _enum, _flags } |
Macro for assigning filter register argument types and description
enum GF_FSArgumentFlags |
Structure holding arguments for a filter
Enumerator | |
---|---|
GF_FS_ARG_HINT_NORMAL | used for GUI config: regular argument type |
GF_FS_ARG_HINT_ADVANCED | used for GUI config: advanced argument type |
GF_FS_ARG_HINT_EXPERT | used for GUI config: expert argument type |
GF_FS_ARG_HINT_HIDE | used for GUI config: hidden argument type |
GF_FS_ARG_UPDATE | if set indicates that the argument is updatable. If so, the value will be changed if offset_in_private is valid, and the update_args function will be called if not NULL |
GF_FS_ARG_META | used by meta filters (ffmpeg & co) to indicate the parsing is handled by the filter in which case the type is overloaded to string and passed to the update_args function |
GF_FS_ARG_META_ALLOC | internal flag used by meta filters (ffmpeg & co) to indicate the description of the argument is a dynamic allocated memory |
GF_FS_ARG_SINK_ALIAS | internal flag used by filters acting as sinks (gsfmx in file mode) to allow retrieving dst url but avoid being used as direct sinks |
GF_FS_ARG_UPDATE_SYNC | if set indicates that the argument is updatable only as a direct synchronous call (typically used for shared data). If so, the value will only be updated if the update directly targets the filter, and the global filter mutex will be locked before calling update_arg. It is however recommended for the calling app to lock the target filter whenever shared data is modified (see vout filter overlay argument for example) The filter should lock itself whenever appropriate using gf_filter_lock |
GF_FS_ARG_META_ARRAY | internal flag used by meta filters (ffmpeg & co) to indicate the argument is an array of the indicated type |
anonymous enum |
Flags for filter capabilities
enum GF_FilterProbeScore |
Filter probe score, used when probing a URL/MIME or when probing formats from data
enum GF_FSRegisterFlags |
Filter register flags
Enumerator | |
---|---|
GF_FS_REG_MAIN_THREAD | when set indicates all calls shall take place in the main thread (running GL output) - to be refined |
GF_FS_REG_CONFIGURE_MAIN_THREAD | when set indicates the initial call to configure_pid will happen in the main thread. This is typically called by decoders requiring a GL context (currently only in main thread) upon init, but not requiring it for the decode. Such decoders get their GL frames mapped (through get_gl_texture callback) in the main GL thread |
GF_FS_REG_EXPLICIT_ONLY | when set indicates the filter does not take part of dynamic filter chain resolution and can only be used by explicitly loading the filter |
GF_FS_REG_HIDE_WEIGHT | when set ignores the filter weight during link resolution - this is typically needed by decoders requiring a specific reframing so that the weight of the reframer+decoder is the same as the weight of other decoders |
GF_FS_REG_ACT_AS_SOURCE | Usually set for filters acting as sources but without exposing an src argument. This prevents throwing warnings on arguments not handled by the filter |
GF_FS_REG_ALLOW_CYCLIC | Indicates the filter can connect to another instance of the same class (avoids cyclic detection in linker graph) Filters of the same class can only connect directly to each other if the destination filter is explictly loaded |
GF_FS_REG_DYNAMIC_PIDS | Indicates the filter PIDs may be dynamically added during process (e.g.M2TS, GSF, etc). This will prevent deactivating a filter when none of its output PIDs are connected |
GF_FS_REG_SCRIPT | Indicates the filter is a script-based filter. The registry is not valid until the script is loaded |
GF_FS_REG_META | Indicates the filter is a meta filter, wrapping various underlying filters (e.g. FFmpeg) |
GF_FS_REG_DYNAMIC_REDIRECT | Indicates that this filter, when dynamically loaded, allows the link resolver to redirect PID connection to this filter rather than to its next explicitly loaded filter in the chain. This is typically used by mux filters |
GF_FS_REG_REQUIRES_RESOLVER | Indicates the filter requires graph resolver (typically because it creates new destinations/sinks at run time) |
GF_FS_REG_FORCE_REMUX | For sink filters, indicates the filter forces remux of input PIDs of type GF_STREAM_FILE (prevents direct file copy) For source filters, indicates the PIDs should be remuxed to a destination filter with force remux set |
GF_FS_REG_SINGLE_THREAD | Indicates the filter must always be run by the same thread, except for the initialize and finalize methods |
GF_FS_REG_TEMP_INIT | Indicates the filter needs to be initialized even if temporary - see gf_filter_is_temporary. Always enabled if GF_FS_REG_META is set |
GF_FS_REG_USE_SYNC_READ | Indicates the filter uses libc sync file read - only needed for emscripten multithreaded support for now, translated into GF_FS_REG_MAIN_THREAD |
GF_FS_REG_BLOCK_MAIN | Indicates the filter may block the main thread (configure, process) - only needed for emscripten multithreaded support |
GF_FS_REG_ASYNC_BLOCK | Indicates the filter uses async tools (JS promises & co) blocking the calling thread until resolved - only needed for emscripten multithreaded support |
GF_FS_REG_DYNAMIC_REUSE | Indicates a dynamic instance of the filter can be reused in resolver even if the source PID already has a possible link to an explicit non-sink filter This is typically required by PID merger filters allowing implicit loading (tileagg, hevcmerge, etc) |
GF_FS_REG_CUSTOM | flag dynamically set at runtime for custom filters |
enum GF_ClassTypeHint |
Filter class type hint - these are only informative, used to generate documentation - the order of the enum corresponds to order of section in wki
Filter session separator set query
void gf_filter_get_session_caps | ( | GF_Filter * | filter, |
GF_FilterSessionCaps * | caps | ||
) |
Gets filter session capability
filter | source of the query - avoids fetching the filter session object |
caps | pointer filled with caps |
void gf_filter_set_session_caps | ( | GF_Filter * | filter, |
GF_FilterSessionCaps * | caps | ||
) |
Sets filter session capability
filter | source of the query - avoids fetching the filter session object |
caps | session capability new values - completely replace the old ones |
Bool gf_filter_is_instance_of | ( | GF_Filter * | filter, |
const GF_FilterRegister * | freg | ||
) |
Check if the filter is an instance of a filter register
filter | filter to test |
freg | filter register to test |
void gf_filter_abort | ( | GF_Filter * | filter | ) |
Aborts a filter, discarding and stopping all input PIDs and sending EOS on all output PIDs
filter | filter to abort |
void gf_filter_lock | ( | GF_Filter * | filter, |
Bool | do_lock | ||
) |
Locks a filter. A filter should only lock itself when using updatable arguments of type GF_FS_ARG_UPDATE_SYNC
filter | filter to lock |
do_lock | if GF_TRUE, locks the filter global mutex, otherwise unlocks it |
void gf_filter_lock_all | ( | GF_Filter * | filter, |
Bool | do_lock | ||
) |
Lock global filter session. This is needed when assigning source IDs after a connect source or destination to the loaded source to connect in an async way
filter | target filter |
do_lock | if GF_TRUE, locks the filter session global mutex, otherwise unlocks it |
void gf_filter_require_source_id | ( | GF_Filter * | filter | ) |
Force all output pids created for this filter to require a source ID for linking.
This is used by filters loading subchains to enforce that filters from these subchain only connect to each other or the target filter but not other filters outside this chain. Filters using this function must setup source IDs on filters of the sunchain(s) they load.
Note: This has the same effect as setting the :RSID
option on the filter
filter | target filter |
GF_Err gf_filter_set_rt_udta | ( | GF_Filter * | filter, |
void * | udta | ||
) |
Sets opaque runtime data for filter - used by bindings
filter | target filter |
udta | data to set |
void* gf_filter_get_rt_udta | ( | GF_Filter * | filter | ) |
Gets opaque runtime data for filter - used by bindings
filter | target filter |
void* gf_filter_get_udta | ( | GF_Filter * | filter | ) |
Gets filter private stack - the stack is allocated and freed by the filter session, as are any arguments. The rest is up to the filter to delete it
filter | target filter |
void gf_filter_set_name | ( | GF_Filter * | filter, |
const char * | name | ||
) |
Sets filter name - mostly used for logging purposes
filter | target filter |
name | new name to assign. If NULL, name is reset to register name |
Bool gf_filter_is_temporary | ( | GF_Filter * | filter | ) |
Checks is a filter is temporary, ie only loaded to solve caps but will not be used.
Only filter classes setting the GF_FS_REG_TEMP_INIT or GF_FS_REG_META need to check this, and only during the initialize call.
if filter is temprary, it is loaded only to probe for a filter chain setup and will be finalized immediately after. This implies that most filter resources (sockets, file handles, etc) must not be created in this case.
A temporary filter will be finalized as any other filter.
filter | target filter |
const char* gf_filter_get_name | ( | GF_Filter * | filter | ) |
Gets filter name
filter | target filter |
void gf_filter_make_sticky | ( | GF_Filter * | filter | ) |
Makes the filter sticky. A sticky filter is not removed when all its input PIDs are disconnected. Typically used by the player
filter | target filter |
u32 gf_filter_get_num_events_queued | ( | GF_Filter * | filter | ) |
Return the number of queued events on the filter. Events are not aggregated, some filter may want to wait until all events are processed before taking actions. The function recursively goes up the filter chain and count queued events.
filter | target filter |
GF_DownloadManager* gf_filter_get_download_manager | ( | GF_Filter * | filter | ) |
Returns the single instance of GPAC download manager. DO NOT DESTROY IT!!
filter | target filter |
struct _gf_ft_mgr* gf_filter_get_font_manager | ( | GF_Filter * | filter | ) |
Returns the single instance of GPAC font manager. DO NOT DESTROY IT!!
filter | target filter |
void gf_filter_ask_rt_reschedule | ( | GF_Filter * | filter, |
u32 | us_until_next | ||
) |
Asks task reschedule for a given delay. There is no guarantee that the task will be recalled at exactly the desired delay
The function can be called several times while in process, the smallest reschedule time will be kept.
filter | target filter |
us_until_next | number of microseconds to wait before recalling this task |
void gf_filter_post_process_task | ( | GF_Filter * | filter | ) |
Posts a filter process task to the parent session. This is needed for some filters not having any input packets to process but still needing to work such as decoder flushes, servers, etc... The filter session will ignore this call if the filter is already scheduled for processing
filter | target filter |
GF_Err gf_filter_post_task | ( | GF_Filter * | filter, |
Bool(*)(GF_Filter *filter, void *callback, u32 *reschedule_ms) | task_execute, | ||
void * | udta, | ||
const char * | task_name | ||
) |
Posts a task to the session scheduler. This task is not a process task but the filter will still be called by a single thread at any time (ie, might delay process)
filter | target filter |
task_execute | the callback function for the task. The callback can return GF_TRUE to reschedule the task, in which case the task will be rescheduled immediately or after reschedule_ms. |
udta | user data passed back to the task function |
task_name | name of the task for logging purposes |
void gf_filter_set_setup_failure_callback | ( | GF_Filter * | filter, |
GF_Filter * | source_filter, | ||
Bool(*)(GF_Filter *f, void *on_setup_error_udta, GF_Err e) | on_setup_error, | ||
void * | udta | ||
) |
Sets callback function on source filter setup failure
filter | target filter |
source_filter | the source filter to monitor |
on_setup_error | callback function to call upon source setup error - the callback can return GF_TRUE to cancel error reporting |
udta | user data passed back to the task function |
void gf_filter_setup_failure | ( | GF_Filter * | filter, |
GF_Err | reason | ||
) |
Notify a filter setup error. This is typically called when a source filter or a filter having accepted input PIDs detects an issue. For a source filter (no input PID), the failure callback will be called if any, and the filter will be removed. For a connected filter, all input PIDs od the filter will be disconnected and the filter removed.
filter | target filter |
reason | the failure reason code |
Notify a filter fatal error but not a connection error. Typically, a 404 in HTTP.
filter | target filter |
reason | the failure reason code |
force_disconnect | indicates if the filter chain should be disconnected or not |
void gf_filter_remove_src | ( | GF_Filter * | filter, |
GF_Filter * | src_filter | ||
) |
Disconnects a source filter chain between two filters
filter | the calling filter. This filter is NOT disconnected |
src_filter | the source filter point of the chain to disconnect. |
void gf_filter_remove | ( | GF_Filter * | filter | ) |
Disconnects a filter from fthe chain
filter | the filter to remove |
void gf_filter_set_max_extra_input_pids | ( | GF_Filter * | filter, |
u32 | max_extra_pids | ||
) |
Sets the number of additional input PID a filter can accept. This overrides the default value of the filter register
filter | the target filter |
max_extra_pids | the number of additional PIDs this filter can accept |
u32 gf_filter_get_max_extra_input_pids | ( | GF_Filter * | filter | ) |
Gets the number of additional input PID a filter can accept. This overrides the default value of the filter register
filter | the target filter |
Bool gf_filter_block_enabled | ( | GF_Filter * | filter | ) |
Queries if blocking mode is enabled for the filter
filter | the target filter |
void gf_filter_block_eos | ( | GF_Filter * | filter, |
Bool | do_block | ||
) |
Indicates the EOS status on input PIDs of this filter shall not be checked when probing for end of stream in the chain
filter | the target filter |
do_block | if GF_TRUE, prevents EOS checking on input stream, otherwise enables it (default is FALSE upon creation) |
GF_Filter* gf_filter_connect_source | ( | GF_Filter * | filter, |
const char * | url, | ||
const char * | parent_url, | ||
Bool | inherit_args, | ||
GF_Err * | err | ||
) |
Connects a source to this filter.
filter | the target filter |
url | url of source to connect to, with optional arguments. |
parent_url | url of parent if any |
inherit_args | if GF_TRUE, the source to connect will inherit arguments of the target filter's destination |
err | return code - can be NULL |
GF_Filter* gf_filter_add_source | ( | GF_Filter * | filter, |
const char * | url, | ||
const char * | parent_url, | ||
Bool | inherit_args, | ||
GF_Err * | err | ||
) |
Connects a source to the session, copying FilterID and sourceID of this filter source..
filter | the target filter |
url | url of source to connect to, with optional arguments. |
parent_url | url of parent if any |
inherit_args | if GF_TRUE, the source to connect will inherit arguments of the first source of the filter |
err | return code - can be NULL |
GF_Filter* gf_filter_connect_destination | ( | GF_Filter * | filter, |
const char * | url, | ||
GF_Err * | err | ||
) |
Connects a destination to this filter
filter | the target filter |
url | url of destination to connect to, with optional arguments. |
err | return code - can be NULL |
GF_Filter* gf_filter_load_filter | ( | GF_Filter * | filter, |
const char * | name, | ||
GF_Err * | err_code | ||
) |
Loads a new filter in the session - see gf_fs_load_filter
filter | the target filter |
name | name and arguments of the filter register to instantiate. |
err_code | error code if any |
Bool gf_filter_is_supported_source | ( | GF_Filter * | filter, |
const char * | url, | ||
const char * | parent_url | ||
) |
Checks if a source filter can handle the given URL. The source filter is not loaded.
filter | the target filter |
url | url of source to connect to, with optional arguments. |
parent_url | url of parent if any |
Checks if a URL describes a filter
filter | the target filter |
url | filter description chain, with optional arguments. |
act_as_source | set to GF_TRUE if filter described acts as a source - may be NULL. |
u32 gf_filter_get_ipid_count | ( | GF_Filter * | filter | ) |
Gets the number of input PIDs connected to a filter
filter | the target filter |
GF_FilterPid* gf_filter_get_ipid | ( | GF_Filter * | filter, |
u32 | idx | ||
) |
Gets an input PIDs connected to a filter
filter | the target filter |
idx | index of the input PID to retrieve, between 0 and gf_filter_get_ipid_count |
u32 gf_filter_get_opid_count | ( | GF_Filter * | filter | ) |
Gets the number of output PIDs connected to a filter
filter | the target filter |
GF_FilterPid* gf_filter_get_opid | ( | GF_Filter * | filter, |
u32 | idx | ||
) |
Gets an output PIDs connected to a filter
filter | the target filter |
idx | index of the output PID to retrieve, between 0 and gf_filter_get_opid_count |
Queries buffer max limits on a filter. This is the max of buffer limits on all its connected outputs
filter | the target filter |
max_buf | will be set to the maximum buffer duration in microseconds - may be NULL |
max_playout_buf | will be set to the maximum playout buffer (the one triggering play) duration in microseconds - may be NULL |
void gf_filter_hint_single_clock | ( | GF_Filter * | filter, |
u64 | time_in_us, | ||
GF_Fraction64 | media_timestamp | ||
) |
Sets a clock state at session level indicating the time / timestamp of the last rendered frame. This is used by basic audio output
filter | the target filter |
time_in_us | the system time in us, see gf_sys_clock_high_res |
media_timestamp | the media timestamp associated with this time. |
void gf_filter_get_clock_hint | ( | GF_Filter * | filter, |
u64 * | time_in_us, | ||
GF_Fraction64 * | media_timestamp | ||
) |
Retrieves the clock state at session level, as set by gf_filter_hint_single_clock
filter | the target filter |
time_in_us | will be set to the system time in us, see gf_sys_clock_high_res - may be NULL |
media_timestamp | will be set to the media timestamp associated with this time - may be NULL. |
GF_Err gf_filter_set_source | ( | GF_Filter * | filter, |
GF_Filter * | link_from, | ||
const char * | link_ext | ||
) |
Explicitly assigns a source ID to a filter. This shall be called before connecting the link_from filter If no ID is assigned to the linked filter, a dynamic one in the form of %08X (using the filter mem address) will be used
filter | the target filter |
link_from | the filter to link from |
link_ext | any link extensions allowed in link syntax: #PIDNAME: accepts only PID(s) with name PIDNAME #TYPE: accepts only PIDs of matching media type. TYPE can be 'audio' 'video' 'scene' 'text' 'font' #TYPEN: accepts only Nth PID of matching type from source #P4CC=VAL: accepts only PIDs with property matching VAL. #PName=VAL: same as above, using the built-in name corresponding to the property. #P4CC-VAL : accepts only PIDs with property strictly less than VAL (only for 1-dimension number properties). #P4CC+VAL : accepts only PIDs with property strictly greater than VAL (only for 1-dimension number properties). |
GF_Err gf_filter_set_source_restricted | ( | GF_Filter * | filter, |
GF_Filter * | link_from, | ||
const char * | link_ext | ||
) |
Similar to gf_filter_set_source This should be used on source filters when the calling filter is expected to have more possible sources added in the future, thereby dynamically changing its source IDs. Typically the compositor running the GUI is one such filter. This variant will make sure the sourceID used in the adaptation chain is always the ID of the source and not the source ID of the calling filter
filter | the target filter |
link_from | the filter to link from |
link_ext | any link extensions allowed in link syntax: |
void gf_filter_reset_source | ( | GF_Filter * | filter | ) |
Explicitly reset sourceID of a filter. This shall be called before connecting the filter (eg creating PIDs).
This is mostly used to reset a source ID of a filter created from a destination (e.g. dasher creating muxers from the MPD URL) where the destination arguments could have sourceIDs specified/
filter | the target filter |
GF_Err gf_filter_assign_id | ( | GF_Filter * | filter, |
const char * | filter_id | ||
) |
Explicitly assigns an ID to a filter. This shall be called before running the session, and cannot be called on a filter with ID assign
filter | the target filter |
filter_id | the ID to assign. If NULL, a dynmic ID is generated |
const char* gf_filter_get_id | ( | GF_Filter * | filter | ) |
Gets the ID of a filter
filter | the target filter |
void gf_filter_set_blocking | ( | GF_Filter * | filter, |
Bool | is_blocking | ||
) |
Indicates the filter is a likely to block for a long time (typically, network IO). In multithread mode, this prevents the filter to be scheduled on the main thread, blocking video or audio output. By default, all filters are created as non-blocking.
filter | the target filter |
is_blocking | if GF_TRUE, indicates the filter is likely to block |
GF_Err gf_filter_override_caps | ( | GF_Filter * | filter, |
const GF_FilterCapability * | caps, | ||
u32 | nb_caps | ||
) |
Overrides the filter caps with new caps for this instance. Typically used when an option of the filter changes the capabilities
The new caps are only taken into account for future graph resolutions, any current link from/to the target filter will not be re-solved when calling this function.
filter | the target filter |
caps | the new set of capabilities to use for the filter. These are NOT copied and shall be valid for the lifetime of the filter |
nb_caps | number of capabilities set |
GF_Err gf_filter_act_as_sink | ( | GF_Filter * | filter | ) |
Indicates this filter acts as a sink and will be used as such in graph resolution. Such filters must provide a use_alias function in their registry.
filter | the target filter |
u8 gf_filter_get_sep | ( | GF_Filter * | filter, |
GF_FilterSessionSepType | sep_type | ||
) |
Queries the character code used as a given separator type in argument names. Used for formatting arguments when loading sources and destinations from inside a filter
filter | the target filter |
sep_type | the separator type to query |
const char* gf_filter_get_dst_args | ( | GF_Filter * | filter | ) |
Queries the arguments of the destination arguments. The first output PID connected to a filter with non NULL args will be used (this is a recursive check until end of chain)
filter | the target filter |
char* gf_filter_get_dst_name | ( | GF_Filter * | filter | ) |
Queries the destination name. The first output PID connected to a filter with non NULL args will be used (this is a recursive check until end of chain)
filter | the target filter |
const char* gf_filter_get_src_args | ( | GF_Filter * | filter | ) |
Get the filter arguments.
filter | the target filter |
void gf_filter_send_event | ( | GF_Filter * | filter, |
GF_FilterEvent * | evt, | ||
Bool | upstream | ||
) |
Sends an event on all input PIDs (downstream) or on all output PIDs (upstream)
filter | the target filter |
evt | the event to send |
upstream | send the even upstream |
GF_Err gf_filter_reconnect_output | ( | GF_Filter * | filter, |
GF_FilterPid * | for_pid | ||
) |
Trigger reconnection of output PIDs of a filter. This is needed when inserting a filter in the chain while the session is running
filter | the target filter |
for_pid | reconnects only the given output PID - if NULL, reconnect all output PIDs |
Indicates that the filter accept and can process events coming from outside the filter chain, typically used by application firing events. The event is sent on the process_event function with no associated PID.
filter | the target filter |
enable_events | if GF_TRUE, the filter is considered an event target |
const GF_PropertyValue* gf_filter_get_info | ( | GF_Filter * | filter, |
u32 | prop_4cc, | ||
GF_PropertyEntry ** | propentry | ||
) |
Looks for a built-in property value marked as informative on a filter on all PIDs (inputs and output) This is a recursive call on both input and output chain. There is no guarantee that a queried property will still be valid at the setter side upon returning the call, the setter could have already reassigned it to NULL. To avoids random behavior, the property returned is reference counted so that it is not destroyed by the setter while the caller uses it.
Properties retrieved shall be released using gf_filter_release_property. Failure to do so will cause memory leaks in the program.
If the propentry pointer references a non-null value, this value will be released using gf_filter_release_property, so make sure to initialize the pointer to a NULL value on the first call. This avoids calling gf_filter_release_property after each get_info in the calling code:
filter | the target filter |
prop_4cc | the code of the built-in property to fetch |
propentry | the property reference object for later release. SHALL not be NULL |
const GF_PropertyValue* gf_filter_get_info_str | ( | GF_Filter * | filter, |
const char * | prop_name, | ||
GF_PropertyEntry ** | propentry | ||
) |
Looks for a property value on a filter on all PIDs (inputs and output). This is a recursive call on both input and output chain Properties retrieved shall be released using gf_filter_release_property. See gf_filter_pid_get_info for more details.
filter | the target filter |
prop_name | the name of the property to fetch |
propentry | the property reference object for later release. See gf_filter_pid_get_info for more details. |
void gf_filter_release_property | ( | GF_PropertyEntry * | propentry | ) |
Release a property previously queried, only used for []_get_info_[] functions. This is a recursive call on both input and output chain
propentry | the property reference object to be released |
void gf_filter_send_update | ( | GF_Filter * | filter, |
const char * | target_filter_id, | ||
const char * | arg_name, | ||
const char * | arg_val, | ||
GF_EventPropagateType | propagate_mask | ||
) |
Sends a filter argument update
filter | the target filter |
target_filter_id | if set, the target filter will be changed to the filter with this id if any. otherwise the target filter is the one specified |
arg_name | argument name |
arg_val | argument value |
propagate_mask | propagation flags - 0 means no propagation |
GF_Err gf_filter_add_event_listener | ( | GF_Filter * | filter, |
GF_FSEventListener * | el | ||
) |
Adds an event listener to the session
filter | filter object |
el | the event listener to add |
GF_Err gf_filter_remove_event_listener | ( | GF_Filter * | filter, |
GF_FSEventListener * | el | ||
) |
Removes an event listener from the session
filter | filter object |
el | the event listener to add |
Bool gf_filter_forward_gf_event | ( | GF_Filter * | filter, |
GF_Event * | evt, | ||
Bool | consumed, | ||
Bool | skip_user | ||
) |
Forwards an event to the filter session
filter | filter object |
evt | the event forwarded |
consumed | if set, indicates the event was already consumed/processed before forwarding |
skip_user | if set, indicates the event should only be dispatched to event listeners. Otherwise, if a user is assigned to the session, the event is forwarded to the user |
Forwards an event to the filter session. This is a shortcut for gf_filter_forward_gf_event(session, evt, GF_FALSE, GF_FALSE);
filter | filter object |
evt | the event forwarded |
Bool gf_filter_all_sinks_done | ( | GF_Filter * | filter | ) |
Checks if all sink filters in the session have seen end of stream.
filter | filter object |
const char* gf_filter_get_arg_str | ( | GF_Filter * | filter, |
const char * | arg_name, | ||
char | dump[GF_PROP_DUMP_ARG_SIZE] | ||
) |
Gets a filter argument value as string for a given argument name..
filter | filter object |
arg_name | name of the filter argument |
dump | buffer in which any formatting of argument value will take place |
Bool gf_filter_get_arg | ( | GF_Filter * | filter, |
const char * | arg_name, | ||
GF_PropertyValue * | prop | ||
) |
Gets a filter argument value for a given argument name..
filter | filter object |
arg_name | name of the filter argument |
prop | filled with the arguments value, do NOT modify |
Bool gf_filter_is_supported_mime | ( | GF_Filter * | filter, |
const char * | mime | ||
) |
Checks if a given mime type is supported as input in the parent session
filter | querying filter |
mime | mime type to query |
Sends UI event from video output into the session. For now only direct callback to global event handler is used, event is not forwarded down the chain
filter | triggering filter |
uievt | event to send |
void gf_filter_register_opengl_provider | ( | GF_Filter * | filter, |
Bool | do_register | ||
) |
Registers filter as an OpenGL provider. This is only used by sink filters creating a OpenGL context, to avoid creating another context. Filters registered as OpenGL providers will run on the main thread.
filter | filter providing OpenGL context |
do_register | if TRUE the filter carries a valid gl context, if FALSE the filter no longer carries a valid GL context |
GF_Err gf_filter_request_opengl | ( | GF_Filter * | filter | ) |
Requests OpenGL support for this filter. If no OpenGL providers exist, a default provider will be created (GL context creation on hidden window). Filters requiring OpenGL will run on the main thread.
filter | filter providing OpenGL context |
Sets OpenGL context active for this filter.
filter | filter asking for OpenGL context activation |
do_activate | if true, context must be activated for the calling thread, otherwise context is being released |
u32 gf_filter_count_source_by_protocol | ( | GF_Filter * | filter, |
const char * | protocol_scheme, | ||
Bool | expand_proto, | ||
GF_FilterPid *(*)(void *udta, u32 *idx) | enum_pids, | ||
void * | udta | ||
) |
Count the number of source filters for the given filter matching the given protocol type.
filter | filter to inspect |
protocol_scheme | scheme of the protocol to test, without ://, eg "http", "rtp", "https" |
expand_proto | if set to GF_TRUE, any source protocol with a name beginning like protocol_scheme will be matched. For example, use this with "http" to match all http and https schemes. |
enum_pids | user function to enumerate PIDs against which the source should be checked . If not set, all source filters will be checked. |
udta | user data for the callback function |
void gf_filter_disable_probe | ( | GF_Filter * | filter | ) |
Disables data probing on the given filter. Typically used by filters loading source filters.
filter | target filter |
void gf_filter_disable_inputs | ( | GF_Filter * | filter | ) |
Disables input connection on the filter. This is used by filters acting both as true sources or demux/processing filters depending on their options.
filter | target filter |
Bool gf_filter_has_pid_connection_pending | ( | GF_Filter * | filter, |
GF_Filter * | stop_at_filter | ||
) |
Checks if some PIDs are still not connected in the graph originating at filter. This is typically used by filters dynamically loading source filters to make sure all PIDs from the source are connected.
filter | target filter |
stop_at_filter | check connections until this filter. If NULL, connections are checked until upper (sink) end of graph |
Bool gf_filter_connections_pending | ( | GF_Filter * | filter | ) |
checks if the some PID connection tasks are still pending at the session level
This can be needed by some filters needing to make sure all their inputs are known before starting producing packets.
filter | target filter |
checks if the some PID connection tasks are still pending at the session level
filter | target filter |
Disables blocking check for a given filter
This can be needed by some filters internally managing their blocking state because one of their output is not managed by the filter session.
filter | target filter |
prevent_blocking_enabled | if GF_TRUE, filter will still be called even if one of its output is in blocking mode |
Bool gf_filter_is_dynamic | ( | GF_Filter * | filter | ) |
Checks if filter was loaded as part of a link resolution or explicitly loaded by application
filter | target filter |
Bool gf_filter_reporting_enabled | ( | GF_Filter * | filter | ) |
Checks if reporting is turned on at session level.
filter | target filter |
Updates filter status string and progress. Should not be called if reporting is turned off at session level. This allows gathering stats from filter in realtime. The status string can be anything but shall not contain '
' and should not contain any source or destination URL except for sources and sinks.
filter | target filter |
percent | percentage (from 0 to 10000) of operation status. If more than 10000 ignored |
szStatus | string giving a status of the filter |
Bool gf_filter_end_of_session | ( | GF_Filter * | filter | ) |
check if session has been scheduled for destruction
filter | target filter |
void gf_filter_report_meta_option | ( | GF_Filter * | filter, |
const char * | arg, | ||
Bool | was_found, | ||
const char * | sub_opt_name | ||
) |
used by meta-filters (ffmpeg and co) to report used/unused options. This is needed since these filters might not know the set of available options at initialize() time.
filter | target filter |
arg | name of the argument not used/found |
was_found | indicate if option was found ot not |
sub_opt_name | indicate sub-option name, or NULL for regular options. This is used to track unused values in multiple-values options |
GF_Err gf_filter_set_description | ( | GF_Filter * | filter, |
const char * | new_desc | ||
) |
used by script to set a per-instance description
filter | target filter |
new_desc | the new description to set |
const char* gf_filter_get_description | ( | GF_Filter * | filter | ) |
get a per-instance description
filter | target filter |
GF_Err gf_filter_set_class_hint | ( | GF_Filter * | filter, |
GF_ClassTypeHint | class_hint | ||
) |
used by script to set a per-instance class hint
filter | target filter |
class_hint | theclass hint to set |
GF_ClassTypeHint gf_filter_get_class_hint | ( | GF_Filter * | filter | ) |
get a per-instance class hint
filter | target filter |
GF_Err gf_filter_set_version | ( | GF_Filter * | filter, |
const char * | new_version | ||
) |
used by script to set a per-instance version
filter | target filter |
new_version | the new version to set |
const char* gf_filter_get_version | ( | GF_Filter * | filter | ) |
get a per-instance version
filter | target filter |
GF_Err gf_filter_set_author | ( | GF_Filter * | filter, |
const char * | new_author | ||
) |
used by script to set a per-instance author
filter | target filter |
new_author | the new author to set |
const char* gf_filter_get_author | ( | GF_Filter * | filter | ) |
get a per-instance author
filter | target filter |
GF_Err gf_filter_set_help | ( | GF_Filter * | filter, |
const char * | new_help | ||
) |
used by script to set a per-instance help
filter | target filter |
new_help | the new help to set |
const char* gf_filter_get_help | ( | GF_Filter * | filter | ) |
get a per-instance help
filter | target filter |
GF_Err gf_filter_define_args | ( | GF_Filter * | filter, |
GF_FilterArgs * | new_args | ||
) |
used by script to set a per-instance arguments. The passed array shall have a 0 argument at the end and shall be valid for the lifetime of the filter (not locally copied)
filter | target filter |
new_args | the new args to set |
GF_FilterArgs* gf_filter_get_args | ( | GF_Filter * | filter | ) |
get per-instance args
filter | target filter |
const GF_FilterCapability* gf_filter_get_caps | ( | GF_Filter * | filter, |
u32 * | nb_caps | ||
) |
get per-instance caps
filter | target filter |
nb_caps | set to the number of caps |
const char* gf_filter_probe_data | ( | GF_Filter * | filter, |
u8 * | data, | ||
u32 | size, | ||
GF_FilterProbeScore * | score | ||
) |
probes mime type of a given block of data (should be beginning of file )
filter | target filter |
data | buffer to probe |
size | size of buffer |
score | ste to the probing score, may be NULL |
Bool gf_filter_is_alias | ( | GF_Filter * | filter | ) |
checks if the given filter is an alias filter created by a multiple sink filter
filter | target filter |
Bool gf_filter_in_parent_chain | ( | GF_Filter * | parent, |
GF_Filter * | filter | ||
) |
checks if the given filter is in the chain ending up at parent
parent | end of filter chain to check |
filter | target filter to check |
GF_Err gf_filter_get_stats | ( | GF_Filter * | filter, |
GF_FilterStats * | stats | ||
) |
Gets statistics for filter
filter | filter session |
stats | statistics for filter |
const GF_FilterArgs* gf_filter_enumerate_args | ( | GF_Filter * | filter, |
u32 | idx | ||
) |
Enumerates default arguments of a filter
filter | filter session |
idx | the 0-based index of the argument to query |
Bool gf_filter_relocate_url | ( | GF_Filter * | filter, |
const char * | service_url, | ||
const char * | parent_url, | ||
char * | out_relocated_url, | ||
char * | out_localized_url | ||
) |
Reslves URL against locales settings
filter | filter |
service_url | URL of service to relocate |
parent_url | parent URL of service |
out_relocated_url | - must be GF_MAX_PATH size |
out_localized_url | - must be GF_MAX_PATH size |
GF_Err gf_filter_probe_link | ( | GF_Filter * | filter, |
u32 | opid_idx, | ||
const char * | fname, | ||
char ** | result_chain | ||
) |
Probes for link resolution towards a given filter description
filter | target filter |
opid_idx | output pid index of target filter |
fname | textual description of filter - If a source is used, returns an error. Destination can be identified using dst=URL pattern |
result_chain | resulting chain as comma-separated list, or NULL if error. MUST be freed by caller |
GF_Err gf_filter_probe_links | ( | GF_Filter * | filter, |
u32 | opid_idx, | ||
const char * | fname, | ||
char ** | result_chain | ||
) |
Probes for possible link resolution towards a given filter description. Same as gf_filter_probe_link but tests multiple links
The syntax for each chain is D;P,filters
with:
D
: distance between the source and target, as seen by the graph resolver (some filters may hide their distance)P
: priority of the chainfilters
: comma-separated list of filtersfilter | target filter |
opid_idx | output pid index of target filter |
fname | textual description of filter - If a source is used, returns an error. Destination can be identified using dst=URL pattern |
result_chain | resulting chains separated by a pipe character ('|') or NULL if error. MUST be freed by caller |
GF_Err gf_filter_get_possible_destinations | ( | GF_Filter * | filter, |
s32 | opid_idx, | ||
char ** | result_list | ||
) |
Gets list of possible destinations for this filter
filter | target filter |
opid_idx | output pid index of target filter. If negative, will check destinations for any of the output pids |
result_list | resulting list as comma-separated list, or NULL if error. MUST be freed by caller. An empty chain means direct connection is possible |
const GF_FilterRegister* gf_filter_get_register | ( | GF_Filter * | filter | ) |
Returns the register of a given filter
filter | target filter |
void gf_filter_print_all_connections | ( | GF_Filter * | filter, |
void(*)(FILE *output, GF_SysPrintArgFlags flags, const char *fmt,...) | print_fn | ||
) |
Prints all possible connections between filter registries for a loaded filter using
filter | filter object |
print_fn | optional callback function for print, otherwise print to stderr |
void gf_filter_force_main_thread | ( | GF_Filter * | filter, |
Bool | do_tag | ||
) |
Force a filter to run on main thread.
filter | filter object |
do_tag | if GF_TRUE, tags filter to run on main thread, otherwise untags filters |
Bool gf_filter_is_sink | ( | GF_Filter * | filter | ) |
Check if a filter is a sink, i.e. it has no output capabilities.
filter | target filter |
Bool gf_filter_is_source | ( | GF_Filter * | filter | ) |
Check if a filter is a source, i.e. it has no input capabilities
filter | target filter |
Tags a filter in a given subsession, ignored in non-implicit mode.
If sourceIDs are used on destination filter, subsession and source IDs are ignored. If filters do not have the same subsession ID, they cannot link to each If filters do not have the same sourceID, they cannot link to each other except if destination is a sink
Function does nothing if the filter is allready assigned to a subsession
filter | target filter |
subsession_id | subsession identifier |
source_id | subsession identifier |
Bool gf_filter_has_connect_errors | ( | GF_Filter * | filter | ) |
Check if connect errors happened in the filter parent session
filter | target filter |
const char* gf_filter_get_netcap_id | ( | GF_Filter * | filter | ) |
Get ID of netcap configuration associated with filter, if any
filter | target filter |
void gf_filter_meta_set_instances | ( | GF_Filter * | filter, |
const char * | instance_names_list | ||
) |
Sets names of sub-instances involved in a meta-filter instance
filter | target filter |
instance_names_list | space-separated names of meta filter instances, without meta registry name. eg "negate" for ffavf::f=negate |
const char* gf_filter_meta_get_instances | ( | GF_Filter * | filter | ) |
Gets names of sub-instances involved in a meta-filter instance
filter | target filter |
const char* gf_filter_path_escape_colon | ( | GF_Filter * | filter, |
const char * | path | ||
) |
Locates start of gpac option separator in a url path
filter | target filter |
path | path to analyze |