libgpac
Documentation of the core library of GPAC
JS Filter API

JavaScript API for filters. More...

+ Collaboration diagram for JS Filter API:

Data Structures

interface  JSFilter
 JSFilter API. More...
 
interface  FilterInstance
 
interface  FilterPid
 
interface  FilterPacket
 
interface  FilterEvent
 
interface  JSArgDesc
 
interface  JSCapDesc
 

Typedefs

typedef Object FilterProperty
 

Functions

void print (DOMString log)
 
void print (long log_level, DOMString log_str)
 

Variables

attribute Array args
 
attribute JSFilter filter
 

Detailed Description

This section documents the JavaScript API used when developing JavaScript-based filters. JavaScript filters support all tools from native filters, see Filter Management.

Errors are handled through exceptions, except for callback function return values of the Filter object.


Data Structure Documentation

◆ JSArgDesc

interface JSArgDesc

interface used to describe filter arguments

Data Fields
attribute DOMString name

name of the argument

attribute DOMString desc

description of the argument

attribute unsigned long type

type of the argument

optional attribute DOMString def

default value of the argument

optional attribute DOMString minmax_enum

min/max or enum values of the argument

optional attribute DOMString hint

argument hint type: "advanced", "expert", "hide" or null

◆ JSCapDesc

interface JSCapDesc

interface used to describe filter capability

Data Fields
attribute DOMString id

PropertyID of the capability - mandatory

attribute DOMString value

value of the property - mandatory

attribute boolean inout

input and output flag of the capability - if true, the output flag is ignored

attribute boolean output

output flag of the capability - if undefined, the capability is an input one

optional attribute boolean excluded

excluded flag of the capability

optional attribute boolean loaded_filter_only

loaded filter only flag of the capability

optional attribute boolean static

static flag of the capability

optional attribute boolean optional

optional flag of the capability

Typedef Documentation

◆ FilterProperty

typedef Object FilterProperty

Properties are mapped to JavaScript values as follows:

GF_PROP_PID_CODECID: string containing the codec name
GF_PROP_PID_STREAM_TYPE: string containing the stream type name

Other properties are mapped by property type:
GF_PROP_BOOL: boolean
GF_PROP_UINT: integer
GF_PROP_4CC: string
GF_PROP_SINT: integer
GF_PROP_LUINT: large integer
GF_PROP_LSINT: large integer
GF_PROP_FLOAT: double
GF_PROP_FLOAT: double
GF_PROP_STRING: string
GF_PROP_STRING_NO_COPY: string
GF_PROP_VEC2: object with number properties "x" and "y"
GF_PROP_VEC2I: object with integer properties "x" and "y"
GF_PROP_VEC3I: object with integer properties "x", "y" and "z"
GF_PROP_VEC4I: object with integer properties "x", "y", "z" and "w"
GF_PROP_FRACTION: object with integer properties "n" and "d", representing fraction n/d
GF_PROP_FRACTION64: object with large integer properties "n" and "d", representing fraction n/d
GF_PROP_UINT_LIST: array of integers
GF_PROP_4CC_LIST: array of strings
GF_PROP_STRING_LIST: array of strings
All enumeration properties (pixel format, audio format, etc): string

Function Documentation

◆ print() [1/2]

void print ( DOMString  log)

global context function for printing

Parameters
logthe string to write

◆ print() [2/2]

void print ( long  log_level,
DOMString  log_str 
)

global context function for printing

Parameters
log_levelthe log level to use: GF_LOG_DEBUG, GF_LOG_INFO, GF_LOG_WARNING, GF_LOG_ERROR. The special value -2 means print as gf_sys_format_help without highlight, the special value -1 means print as gf_sys_format_help with hightlight of first)
log_strthe string to write

Variable Documentation

◆ args

attribute Array args

global context property containing the launch arguments

◆ filter

attribute JSFilter filter

global context property representing the one and only JSFilter object attached to the loaded filter