libgpac
Documentation of the core library of GPAC
_FilterSession Interface Reference

import"nodejs.idl";

Public Member Functions

 FilterSession (unsigned long flags=0)
 
void on_filter_new (_Filter filter)
 
void on_filter_del (_Filter filter)
 
void run ()
 
_Filter load_src (DOMString URL, DOMString parentURL=null)
 
_Filter load_dst (DOMString URL, DOMString parentURL=null)
 
_Filter load (DOMString fname)
 
void post_task (Object task)
 
void abort (unsigned long flush=GF_FS_FLUSH_NONE)
 
_Filter get_filter (unsigned long index)
 
void lock (boolean lock)
 
void reporting (boolean do_report)
 
void print_stats ()
 
void print_graph ()
 
void fire_event (FilterEvent evt, _Filter filter=null, boolean upstream=false)
 
boolean is_supported_mime (DOMString mime)
 
boolean is_supported_source (DOMString url, DOMString parent=null)
 
CustomFilter new_filter (DOMString name="Custom", unsigned long flags=0)
 

Data Fields

attribute readonly boolean last_task
 
attribute readonly unsigned long nb_filters
 
attribute readonly unsigned long http_bitrate
 
attribute unsigned long http_max_bitrate
 

Detailed Description

FilterSession object

Member Function Documentation

◆ FilterSession()

_FilterSession::FilterSession ( unsigned long  flags = 0)

constructor for filter session - see gf_fs_new_defaults. Other options MUST be passed as libgpac options using set_args

Parameters
flagssession flags

◆ on_filter_new()

void _FilterSession::on_filter_new ( _Filter  filter)

callback used whenever a new filter is added, initially set to null

Parameters
filter_Filter object being added

◆ on_filter_del()

void _FilterSession::on_filter_del ( _Filter  filter)

callback used whenever a filter is destroyed, typically used by classes deriving from _FilterSession, initially set to null

Parameters
filter_Filter object being removed

◆ run()

void _FilterSession::run ( )

run the session - see gf_fs_run

◆ load_src()

_Filter _FilterSession::load_src ( DOMString  URL,
DOMString  parentURL = null 
)

load source filter - see gf_fs_load_source

Parameters
URLsource URL to load
parentURLURL of parent resource for relative path resolution
Returns
new _Filter object

◆ load_dst()

_Filter _FilterSession::load_dst ( DOMString  URL,
DOMString  parentURL = null 
)

load destination filter - see gf_fs_load_destination

Parameters
URLsource URL to load
parentURLURL of parent resource for relative path resolution
Returns
new _Filter object

◆ load()

_Filter _FilterSession::load ( DOMString  fname)

load a filter - see gf_fs_load_filter

Parameters
fnamefilter name and options
Returns
new _Filter object

◆ post_task()

void _FilterSession::post_task ( Object  task)

post a user task to the filter sesison - see gf_fs_post_user_task

The task object must have an execute callback with no parameter and returning false to cancel the task or the reschedule time in milliseconds

Parameters
tasktask object to post

◆ abort()

void _FilterSession::abort ( unsigned long  flush = GF_FS_FLUSH_NONE)

abort the session - see gf_fs_abort

Parameters
flushpipeline flush mode before abort

◆ get_filter()

_Filter _FilterSession::get_filter ( unsigned long  index)

get a filter by index - see gf_fs_get_filter

Parameters
indexindex of filter
Returns
_Filter object

◆ lock()

void _FilterSession::lock ( boolean  lock)

lock the session - see gf_fs_lock_filters

Parameters
lockif True, locks otherwise unlocks

◆ reporting()

void _FilterSession::reporting ( boolean  do_report)

enable status reporting by filters - see gf_fs_enable_reporting

Parameters
do_reportif True, enables reporting

◆ print_stats()

void _FilterSession::print_stats ( )

print statistics on stderr - see gf_fs_print_stats

◆ print_graph()

void _FilterSession::print_graph ( )

print graph on stderr - see gf_fs_print_connections

◆ fire_event()

void _FilterSession::fire_event ( FilterEvent  evt,
_Filter  filter = null,
boolean  upstream = false 
)

fire an event on the given filter if any, or on any filter accepting user events

Parameters
evtFilterEvent to fire
filter_Filter to use as target
upstreamif true, walks the chain towards the sink, otehrwise towards the source

◆ is_supported_mime()

boolean _FilterSession::is_supported_mime ( DOMString  mime)

checks if a given mime is supported - see gf_fs_is_supported_mime

Parameters
mimemime type to check
Returns
true or false

◆ is_supported_source()

boolean _FilterSession::is_supported_source ( DOMString  url,
DOMString  parent = null 
)

checks if a given source URL is supported - see gf_fs_is_supported_source

Parameters
urlURL to check
parentparent URL for relative URLs
Returns
true or false

◆ new_filter()

CustomFilter _FilterSession::new_filter ( DOMString  name = "Custom",
unsigned long  flags = 0 
)

creates a new custom filter to be filled by JS code - see gf_fs_new_filter

Note
Custom filters are always created with the flag GF_FS_REG_MAIN_THREAD set, so that they always run in the main thread
If the custom filter is a source, it must be initially scheduled using reschedule
Parameters
namename for the filter
flagsfilter flags
Returns
new custom filter

Field Documentation

◆ last_task

attribute readonly boolean _FilterSession::last_task

set to true if this is the last task running, readonly - see gf_fs_is_last_task

◆ nb_filters

attribute readonly unsigned long _FilterSession::nb_filters

number of filters in session, readonly - see gf_fs_get_filters_count

◆ http_bitrate

attribute readonly unsigned long _FilterSession::http_bitrate

current HTTP cumulated download rate, readonly - see gf_fs_get_http_rate

◆ http_max_bitrate

attribute unsigned long _FilterSession::http_max_bitrate

HTTP max download rate - see gf_fs_get_http_max_rate and gf_fs_set_http_max_rate