libgpac
Documentation of the core library of GPAC
JSFSFilter Interface Reference

JSFSFilter API. More...

import"filtersession.idl";

+ Collaboration diagram for JSFSFilter:

Public Member Functions

boolean is_destroyed ()
 
FilterProperty ipid_props (unsigned long idx, DOMString name)
 
void ipid_props (unsigned long idx, function fun_callback)
 
FilterProperty opid_props (unsigned long idx, DOMString name)
 
void opid_props (unsigned long idx, function fun_callback)
 
Object ipid_stats (unsigned long idx, optional unsigned int mode=0)
 
Object opid_stats (unsigned long idx, optional unsigned int mode=0)
 
void require_source_id ()
 
Array compute_link (unsigned long idx, DOMString description, optional Boolean load_args=false)
 
DOMString get_destinations (unsigned long pid_idx=-1)
 
JSFSFilter ipid_source (unsigned long idx)
 
Array opid_sinks (unsigned long idx)
 
Array all_args (optional boolean value_only=true)
 
FilterProperty get_arg (DOMString arg_name)
 
void update (DOMString arg_name, DOMString arg_val, unsigned int propagate_mask=0)
 
void remove ()
 
void insert (DOMString filter_to_add, optional DOMString link_args=null)
 
void reconnect (long pid_idx=-1)
 
void bind (Object obj)
 
void lock (boolean do_lock)
 

Data Fields

attribute readonly DOMString name
 
attribute readonly DOMString ID
 
attribute readonly DOMString type
 
attribute readonly DOMString tag
 
attribute readonly DOMString itag
 
attribute readonly unsigned long nb_ipid
 
attribute readonly unsigned long nb_opid
 
attribute readonly DOMString status
 
attribute readonly boolean alias
 
attribute readonly DOMString args
 
attribute readonly boolean dynamic
 
attribute readonly boolean done
 
attribute readonly unsigned long long time
 
attribute readonly unsigned long long pck_done
 
attribute readonly unsigned long long bytes_done
 
attribute readonly unsigned long long pck_sent
 
attribute readonly unsigned long long pck_ifce_sent
 
attribute readonly unsigned long long bytes_sent
 
attribute readonly unsigned long tasks
 
attribute readonly unsigned long errors
 
attribute readonly boolean report_updated
 
attribute readonly DOMString class
 
attribute readonly DOMString streamtype
 
attribute readonly DOMString codec
 
attribute DOMString iname
 
attribute boolean event_target
 
attribute Fraction last_ts_sent
 
attribute Fraction last_ts_drop
 

Detailed Description

The JSFSFilter interface provides tools to query and update filters in a session. It implements binding to the underlying filter object, see GF_Filter.

Member Function Documentation

◆ is_destroyed()

boolean JSFSFilter::is_destroyed ( )

Checks if a filter is valid or if it has been destroyed. Any query on a destroyed filter will raise an exception.

Returns
true if the filter has been destroyed, false otherwise

◆ ipid_props() [1/2]

FilterProperty JSFSFilter::ipid_props ( unsigned long  idx,
DOMString  name 
)

Gets properties on input pid This function accepts the following extra names (not property names) to query PID status:

  • buffer: return the PID buffer level in microsecond
  • buffer_total: return the cumulated buffer from source to PID level in microsecond
  • name: return the PID name
  • eos: return true if PID is in EOS state
Parameters
idxthe index of the input pid to query
namename of the property to query
Returns
property value, or null if not found

◆ ipid_props() [2/2]

void JSFSFilter::ipid_props ( unsigned long  idx,
function  fun_callback 
)

Enumerates properties on input pid

Parameters
idxthe index of the input pid to query
fun_callbackfunction called for each property in the input pid. The function has three parameters: name (DOMString), type (DOMString), value (FilterProperty)

◆ opid_props() [1/2]

FilterProperty JSFSFilter::opid_props ( unsigned long  idx,
DOMString  name 
)

Gets properties on output pid

Parameters
idxthe index of the output pid to query
namename of the property to query
Returns
property value, or null if not found

◆ opid_props() [2/2]

void JSFSFilter::opid_props ( unsigned long  idx,
function  fun_callback 
)

Enumerates properties on output pid

Parameters
idxthe index of the output pid to query
fun_callbackfunction called for each property in the output pid. The function has three parameters: name (DOMString), type (DOMString), value (FilterProperty)

◆ ipid_stats()

Object JSFSFilter::ipid_stats ( unsigned long  idx,
optional unsigned int  mode = 0 
)

get statistics on input pid

Parameters
idxthe index of the input pid to query
modemode used to query stats - cf GF_FilterPidStatsLocation
Returns
object matching GF_FilterPidStatistics

◆ opid_stats()

Object JSFSFilter::opid_stats ( unsigned long  idx,
optional unsigned int  mode = 0 
)

get statistics on output pid

Parameters
idxthe index of the output pid to query
modemode used to query stats - cf GF_FilterPidStatsLocation
Returns
object matching GF_FilterPidStatistics

◆ require_source_id()

void JSFSFilter::require_source_id ( )

Forces a filter to only link to filters having at least one sourceID defined - cf gf_filter_require_source_id

◆ compute_link()

Array JSFSFilter::compute_link ( unsigned long  idx,
DOMString  description,
optional Boolean  load_args = false 
)

computes link from an output pid of the filter to a given filter description - cf gf_filter_probe_link

Parameters
idxthe index of the output pid to query
descriptionfilter descrition, destination can be specified using dst=URL
load_argsif set, will load all possible arguments for each filter

If arguments are loaded, the return value is an array of object with property fname set to the registry name and args set to an array of JSFSFilterArg, including arguments of meta filters (not visible otherwise)

If arguments are not loaded, the return value is an array registry names

Returns
array of found filters, NULL if not found

◆ get_destinations()

DOMString JSFSFilter::get_destinations ( unsigned long  pid_idx = -1)

get possible direct destinations for a filter - cf gf_filter_get_possible_destinations

Parameters
pid_idxthe index of the output pid to query, -1 to consider all output pids
Returns
comma-separated string of found filters, NULL if not found

◆ ipid_source()

JSFSFilter JSFSFilter::ipid_source ( unsigned long  idx)

Gets source filter for an input pid

Parameters
idxthe index of the input pid to query
Returns
input filter or null

◆ opid_sinks()

Array JSFSFilter::opid_sinks ( unsigned long  idx)

Gets destination filter(s) for an output pid

Parameters
idxthe index of the output pid to query
Returns
array of output filters

◆ all_args()

Array JSFSFilter::all_args ( optional boolean  value_only = true)

Gets all arguments (options) of the filter

Parameters
value_onlyif true, only returns name (DOMString) and value (FilterProperty) of each argument. Otherwise returns the full argument (JSFSFilterArg)
Returns
array of JSFSFilterArg

◆ get_arg()

FilterProperty JSFSFilter::get_arg ( DOMString  arg_name)

Gets value of a given argument of the filter

Parameters
arg_nameargument name
Returns
property value, or null

◆ update()

void JSFSFilter::update ( DOMString  arg_name,
DOMString  arg_val,
unsigned int  propagate_mask = 0 
)

sends argument update to filter

Parameters
arg_namename of argument to update
arg_valvalue of argument to update. Can be a string or a native type which will be serialized based on the argument type
propagate_maskflags indicating if updates must be send to up-chain filters (2), down-chain filters (1), both (3) or only on filter (0)

◆ remove()

void JSFSFilter::remove ( )

removes filter from graph

◆ insert()

void JSFSFilter::insert ( DOMString  filter_to_add,
optional DOMString  link_args = null 
)

inserts a filter in graph linked to the current filter

Parameters
filter_to_addstring describing the filter to add, can be in the form "src=" for sources, "dst=" for sinks or regular string for filters.
link_argsspecify any additional arguments to pass to the SID option of the new filter - see gf_filter_set_source

◆ reconnect()

void JSFSFilter::reconnect ( long  pid_idx = -1)

reconnects a filter ouput(s)

Parameters
pid_idxoutput pid to reconnect, -1 for all output pids

◆ bind()

void JSFSFilter::bind ( Object  obj)

binds a JSObject with underlying filter javascript extensions, if any. Currently only dashin (see JSDASHClient) and httpout (see JSHTTPServer) filters have such an extension. This will throw an exception if failure or no JS binding available

Parameters
objthe JS object to use as interface for the underlying filter script

◆ lock()

void JSFSFilter::lock ( boolean  do_lock)

locks a filter. This should only be used when updating sync arguments of the filter - see gf_filter_lock.

Parameters
do_lockif true, locks the filter global mutex, otherwise unlocks it.

Field Documentation

◆ name

attribute readonly DOMString JSFSFilter::name

filter name - may be changed at run-time by the filter

◆ ID

attribute readonly DOMString JSFSFilter::ID

filter ID - cannot be modified by filter, but may be null

◆ type

attribute readonly DOMString JSFSFilter::type

filter registry name

◆ tag

attribute readonly DOMString JSFSFilter::tag

filter TAG

◆ itag

attribute readonly DOMString JSFSFilter::itag

filter inherited TAG

◆ nb_ipid

attribute readonly unsigned long JSFSFilter::nb_ipid

number of input PIDs for the filter

◆ nb_opid

attribute readonly unsigned long JSFSFilter::nb_opid

number of output PIDs for the filter

◆ status

attribute readonly DOMString JSFSFilter::status

status string of the filter, or null

◆ alias

attribute readonly boolean JSFSFilter::alias

set to true if the filter is an alias filter (should be ignored)

◆ args

attribute readonly DOMString JSFSFilter::args

set to the arguments passed to the filter, null if none

◆ dynamic

attribute readonly boolean JSFSFilter::dynamic

set to true if filter was dynamically loaded during graph resolution, false if filter was explicitly loaded by user/app

◆ done

attribute readonly boolean JSFSFilter::done

set to true if filter is done processing and will soon be removed

◆ time

attribute readonly unsigned long long JSFSFilter::time

time in microseconds the filter has been running

◆ pck_done

attribute readonly unsigned long long JSFSFilter::pck_done

number of input packets received

◆ bytes_done

attribute readonly unsigned long long JSFSFilter::bytes_done

number of input bytes received

◆ pck_sent

attribute readonly unsigned long long JSFSFilter::pck_sent

number of packets sent

◆ pck_ifce_sent

attribute readonly unsigned long long JSFSFilter::pck_ifce_sent

number of frame interfaces packets sent

◆ bytes_sent

attribute readonly unsigned long long JSFSFilter::bytes_sent

number of bytes sent

◆ tasks

attribute readonly unsigned long JSFSFilter::tasks

number of tasks executed

◆ errors

attribute readonly unsigned long JSFSFilter::errors

number of errors

◆ report_updated

attribute readonly boolean JSFSFilter::report_updated

set to true if report has been updated since last query

◆ class

attribute readonly DOMString JSFSFilter::class

class of filter, can be "rawin", "demuxer", "decoder", "encoder", "muxer", "rawout", "mediasink", "mediasource", "unknown"

◆ streamtype

attribute readonly DOMString JSFSFilter::streamtype

stream type (audio, visual, ...)

◆ codec

attribute readonly DOMString JSFSFilter::codec

codec name or null if unknown

◆ iname

attribute DOMString JSFSFilter::iname

internal name - this can only be set and modified by this JS and allows for filter identification from JS

◆ event_target

attribute boolean JSFSFilter::event_target

set to true if filter accepts user events

◆ last_ts_sent

attribute Fraction JSFSFilter::last_ts_sent

set to max timestamp of last packet sent by the filter, or null if not available

◆ last_ts_drop

attribute Fraction JSFSFilter::last_ts_drop

set to max timestamp of last packet dropped by the filter, or null if not available