JSFilterSession API.
More...
import"filtersession.idl";
The JSFilterSession interface has a single instance exposed to the script under the name "session". It implements binding to the underlying filter session object, see GF_FilterSession.
◆ FilterSession() [1/2]
Constructor for creating a user-defined filter session
- Returns
- a filter session, created in blocking mode
◆ FilterSession() [2/2]
Constructor for creating a user-defined filter session
- Parameters
-
config | configuration for session |
- Returns
- a filter session
◆ post_task()
void JSFilterSession::post_task |
( |
function |
task_callback, |
|
|
optional DOMString |
task_name = null |
|
) |
| |
posts a task to the main scheduler - see gf_fs_post_user_task
- Parameters
-
task_callback | the callback function to use. This callback functions has no parameters, and returns false or an exception to abort the task, true to reschedule the task immediately or a reschedule time in milliseconds |
task_name | optional value giving a label for the task |
◆ abort() [1/2]
void JSFilterSession::abort |
( |
optional unsigned long |
flush_type = 0 | ) |
|
aborts the filter session - see gf_fs_abort
- Parameters
-
flush_type | if true, wait for all packets currently pending to be processed before closing the session |
◆ lock_filters()
void JSFilterSession::lock_filters |
( |
boolean |
do_lock | ) |
|
locks the filter session - see gf_fs_lock_filters. When the session is locked, tasks are suspended and filters cannot be destroyed. The session only needs to be locked when enumerating filters
- Parameters
-
do_lock | if true, locks the session, otherwise unlocks it |
◆ get_filter() [1/2]
JSFSFilter JSFilterSession::get_filter |
( |
unsigned long |
index | ) |
|
returns the JSFSFilter object for the given index.
- Parameters
-
index | index of filter to query. This index is only valid when session is locked |
- Returns
- the filter object, null if none found
◆ get_filter() [2/2]
returns the JSFSFilter object for a given filter iname.
- Parameters
-
iname | the iname of filter to query |
- Returns
- the filter object, null if none found
◆ enable_rmt()
void JSFilterSession::enable_rmt |
( |
| ) |
|
enable remotery - this should be called as early as possible in the session
◆ rmt_send()
void JSFilterSession::rmt_send |
( |
DOMString |
command | ) |
|
sends the given string to the remotery client(s)
- Parameters
-
command | the command to send |
- Returns
- error code if any
◆ set_rmt_fun()
void JSFilterSession::set_rmt_fun |
( |
function |
callback | ) |
|
sets callback function to use when processing remotery client request
- Parameters
-
callback | the callback function to call. This function takes one parameter which is the text being received |
- Returns
- error code if any
◆ add_filter()
inserts a filter in graph
- Parameters
-
filter_to_add | string describin the filter to add, can be in the form "src=" for sources, "dst=" for sinks or regular string for filters. |
link_from | filter used as source for the created filters - see gf_filter_set_source |
link_args | arguments for the link (used to assign new filter SID - see gf_filter_set_source). An empty string means no arguments |
relative_to_script | if false, URLs for source and sinks filters are relative to the current working directory, if true they are relative to the script path |
- Returns
- new filter created
◆ remove_filter()
void JSFilterSession::remove_filter |
( |
Object |
filter, |
|
|
Object |
src_filter = null |
|
) |
| |
removes a filter in the media session
- Parameters
-
filter | filter object to remove, can be a JSFSFilter object (in this case, function is equivalent to JSFSFilter.remove) or a JSFilter object |
src_filter | source filter. If set, disconnect the chain between the source and the filter before removing the filter. The source must be a valid source (no input pids) - cf gf_filter_remove_src |
◆ set_new_filter_fun()
void JSFilterSession::set_new_filter_fun |
( |
function |
callback | ) |
|
sets callback function to get notifications upon each new filter creation.
- Parameters
-
callback | callback function - it is passed a single parameter, the filter object |
◆ set_del_filter_fun()
void JSFilterSession::set_del_filter_fun |
( |
function |
callback | ) |
|
sets callback function to get notifications upon each filter destruction.
- Parameters
-
callback | the callback function - it is passed a single parameter, the filter object |
◆ set_event_fun()
void JSFilterSession::set_event_fun |
( |
function |
callback | ) |
|
sets callback function to get events being sent back to application (see gf_fs_set_ui_callback).
- Parameters
-
callback | callback function - it is passed a single parameter set, an event instance of FilterEvent interface. The return value of the function should be as indicated for each event type |
◆ set_auth_fun()
void JSFilterSession::set_auth_fun |
( |
function |
callback | ) |
|
sets callback function to get authentication requests (see gf_fs_set_ui_callback).
- Parameters
-
callback | callback function - the function takes 5 parameters and no return value type:
- server: name of server
- user: username
- pass: password if known
- secure: boolean indicating if connection is secured (TLS)
- auth_obj: object used to acknowledge authentication, with a single function
done() taking up to 3 parameters: user, passord and boolean indicating if credentials should be stored. If user or password are not set, authentication fails
|
◆ fire_event()
fires a given event on all registered user event if no filter is specified, or on the filter
- Parameters
-
evt | the event to send |
filter | the filter to send the event to |
upstream | if filter is not null, indicates whether the event shall be sent upstream (towards the sink) or downstream (towards the destination) |
- Returns
- true if event was fired, false if no event target was found or if the filter is not an event target
◆ reporting()
void JSFilterSession::reporting |
( |
boolean |
enable | ) |
|
◆ new_filter()
creates a new custom JS filter. This filter will share the same script context as the filter session script - see JSFilter
- Note
- A custom filter cannot use default arguments, and will not have the initialize callback function called.
- Parameters
-
name | name for the filter. Optional internal filter arguments may be set after the name, e.g. MyName:ITAG=test |
- Returns
- new filter
◆ filter_args()
Array JSFilterSession::filter_args |
( |
DOMString |
desciption | ) |
|
loads all arguments of of a filter description. This will load all arguments on meta filters (not visible otherwise)
- Parameters
-
desciption | description for the filter. Sources can be specified using src=URL , sinks can be specified using dst=URL . |
- Returns
- array of JSFSFilterArg
◆ print_connections()
void JSFilterSession::print_connections |
( |
| ) |
|
◆ print_stats()
void JSFilterSession::print_stats |
( |
| ) |
|
◆ run()
long JSFilterSession::run |
( |
| ) |
|
run a session, only valid for user-created sessions
- Returns
- error code if any
◆ stop()
long JSFilterSession::stop |
( |
| ) |
|
stop a session, only valid for user-created sessions
- Returns
- error code if any
◆ abort() [2/2]
long JSFilterSession::abort |
( |
optional unsigned long |
flush_type | ) |
|
abort a session, only valid for user-created sessions
- Parameters
-
- Returns
- error code if any
◆ nb_filters
attribute long JSFilterSession::nb_filters |
◆ last_task
readonly attribute boolean JSFilterSession::last_task |
◆ http_max_bitrate
attribute unsigned long JSFilterSession::http_max_bitrate |
max capped HTTP download rate in bps - used for DASH simulations mostly
◆ http_bitrate
readonly attribute unsigned long JSFilterSession::http_bitrate |
current http download rate averaged on all active resources in bps
◆ connected
readonly attribute boolean JSFilterSession::connected |
set to true if no PID initialization task (connections) is pending
◆ last_process_error
readonly attribute boolean JSFilterSession::last_process_error |
last process error, cf gf_fs_get_last_process_error
◆ last_connect_error
readonly attribute boolean JSFilterSession::last_connect_error |
last connection error, cf gf_fs_get_last_connect_error
◆ jspath
readonly attribute DOMString JSFilterSession::jspath |
File path of source script