libgpac
Documentation of the core library of GPAC
JS DASH Adaptation API

JavaScript API for DASH client adaptation algorithm. More...

+ Collaboration diagram for JS DASH Adaptation API:

Data Structures

interface  JSDASHClient
 JSDASHClient API. More...
 
interface  JSDASHGroup
 JSDASHGroup API. More...
 
interface  JSDASHQuality
 JSDASHQuality Object. More...
 
interface  JSDASHStats
 JSDASHStats API. More...
 
interface  JSDASHDownloadStats
 JSDASHDownloadStats API. More...
 
interface  JSDASHSRD
 JSDASHSRD. More...
 

Variables

attribute JSDASHClient dashin
 

Detailed Description

This section documents the JavaScript API available for implementing your own adaptation logic in GPAC DASH client.

The algorithm is chosen using the option algo of the dashin filter :

gpac -i source.mpd:algo=myalgo.js vout
//or
gpac -i source.mpd --algo=myalgo.js vout

The loaded JavaScript context has all JS modules available in GPAC, except WebGL.

It is also possible to bind the custom agorithm from a JSFilterSession using JSFSFilter.bind


Data Structure Documentation

◆ JSDASHGroup

interface JSDASHGroup

The JSDASHGroup object provides a description of a group (AdaptationSet in DASH), and its available qualities.

+ Collaboration diagram for JSDASHGroup:
Data Fields
attribute readonly unsigned long idx

group index, as used in rate_adaptation callback

attribute readonly unsigned long long duration

group duration in milliseconds, 0 if unknown (live)

attribute readonly JSDASHSRD SRD

Spatial Relationship Description, or null if none

attribute readonly Array qualities

list of available qualites, array of JSDASHQuality objects

◆ JSDASHQuality

interface JSDASHQuality

The JSDASHQuality object provides a description of a quality (Representation in DASH).

+ Collaboration diagram for JSDASHQuality:
Data Fields
attribute readonly DOMString ID

ID (Representation ID)

attribute readonly DOMString mime

MIME type

attribute readonly DOMString codec

codec parameter

attribute readonly unsigned long bitrate

average bitrate in bits per second

attribute readonly boolean disabled

if true, the quality is disabled (cannot be played)

attribute readonly unsigned long width

video width in pixels

attribute readonly unsigned long height

video height in pixels

attribute readonly Fraction fps

video frame rate

attribute readonly Fraction sar

video sample aspect ratio

attribute readonly unsigned long samplerate

audio samplerate

attribute readonly unsigned long channels

audio number of channels

attribute readonly double ast_offset

DASH AST offset for low-latency, 0 otherwise

attribute readonly Array sizes

size of all segments in this quality for onDemand profiles. If unknown, set to null

◆ JSDASHStats

interface JSDASHStats

The JSDASHStats object provides a description of current group state before adaptation logic

Data Fields
attribute readonly unsigned long rate

last segment download rate in bits per second

attribute readonly unsigned long filesize

last segment size in bytes

attribute readonly float speed

current playback speed

attribute readonly float max_speed

max supported playback speed computed from associated decoder runtime statistics, 0 if unknown

attribute readonly unsigned long display_width

display width of the object in pixels, 0 if no video in object

attribute readonly unsigned long display_height

display height of the object in pixels, 0 if no video in object

attribute readonly unsigned long active_quality

index of active quality at the time the algo is run, or of last downloaded quality if previous segment was skipped

attribute readonly unsigned long buffer_min

minimum buffer level in milliseconds below witch rebuffer will happen

attribute readonly unsigned long buffer_max

maximum buffer level allowed in milliseconds. Packets won't get dropped if overflow, but the algorithm should try not to overflow this buffer

attribute readonly unsigned long buffer

current buffer level in milliseconds

attribute readonly unsigned long degradation_hint

degradation hint, 0 means no degradation, 100 means tile completely hidden

attribute readonly unsigned long total_rate

cumulated download rate of all active groups in bytes per seconds - 0 means all files are local

◆ JSDASHDownloadStats

interface JSDASHDownloadStats

The JSDASHDownloadStats object provides a description of current segment download statistics for a group

Data Fields
attribute readonly unsigned long bits_per_second

current estimated download speed in bits per second

attribute readonly unsigned long long total_bytes

total bytes to download

attribute readonly unsigned long long bytes_done

bytes downloaded

attribute readonly unsigned long long us_since_start

time in microsecond since segment was scheduled for download

attribute readonly unsigned long buffer_duration

buffer duration in milliseconds

attribute readonly unsigned long current_segment_duration

duration of segment being downloaded, 0 if unknown

◆ JSDASHSRD

interface JSDASHSRD

The JSDASHSRD object provides the SRD description of a group.

Data Fields
attribute readonly unsigned long ID

ID of SRD source - all SRD with same source describe the same video composition, possibly with different grid sizes

attribute readonly long x

X coordinate of SRD for this tile

attribute readonly long y

Y coordinate of SRD for this tile

attribute readonly long w

width of SRD for this tile - 0 for tile base track

attribute readonly long h

height of SRD for this tile - 0 for tile base track

attribute readonly long fw

total width of SRD descriptor for this tile

attribute readonly long fh

total height of SRD descriptor for this tile

Variable Documentation

◆ dashin

attribute JSDASHClient dashin

global context property representing the one and only JSDASHClient object attached to the loaded script