libgpac
Documentation of the core library of GPAC
Compositor

GPAC A/V/2D/3D compositor/rendering. More...

+ Collaboration diagram for Compositor:

Typedefs

typedef struct __tag_compositor GF_Compositor
 

Enumerations

enum  { GF_ASPECT_RATIO_KEEP = 0, GF_ASPECT_RATIO_16_9, GF_ASPECT_RATIO_4_3, GF_ASPECT_RATIO_FILL_SCREEN }
 
enum  { GF_ANTIALIAS_NONE = 0, GF_ANTIALIAS_TEXT, GF_ANTIALIAS_FULL }
 
enum  { GF_STATE_PLAYING = 0, GF_STATE_PAUSED, GF_STATE_STEP_PAUSE, GF_STATE_PLAY_LIVE = 10 }
 
enum  { GF_INTERACT_NORMAL = 1, GF_INTERACT_INPUT_SENSOR = 2, GF_INTERACT_NAVIGATION = 4 }
 
enum  { GF_BOUNDS_NONE = 0, GF_BOUNDS_BOX, GF_BOUNDS_AABB }
 
enum  { GF_WIREFRAME_NONE = 0, GF_WIREFRAME_ONLY, GF_WIREFRAME_SOLID }
 
enum  { GF_NAVIGATE_TYPE_NONE, GF_NAVIGATE_TYPE_2D, GF_NAVIGATE_TYPE_3D }
 
enum  {
  GF_NAVIGATE_NONE = 0, GF_NAVIGATE_WALK, GF_NAVIGATE_FLY, GF_NAVIGATE_PAN,
  GF_NAVIGATE_GAME, GF_NAVIGATE_SLIDE, GF_NAVIGATE_EXAMINE, GF_NAVIGATE_ORBIT,
  GF_NAVIGATE_VR
}
 
enum  { GF_COLLISION_NONE, GF_COLLISION_NORMAL, GF_COLLISION_DISPLACEMENT }
 
enum  { GF_TEXTURE_TEXT_DEFAULT = 0, GF_TEXTURE_TEXT_NEVER, GF_TEXTURE_TEXT_ALWAYS }
 
enum  { GF_NORMALS_NONE = 0, GF_NORMALS_FACE, GF_NORMALS_VERTEX }
 
enum  { GF_BACK_CULL_OFF = 0, GF_BACK_CULL_ON, GF_BACK_CULL_ALPHA }
 
enum  { GF_DRAW_MODE_DEFER =0, GF_DRAW_MODE_IMMEDIATE, GF_DRAW_MODE_DEFER_DEBUG }
 
enum  {
  GF_OPT_ANTIALIAS =0, GF_OPT_HIGHSPEED, GF_OPT_FULLSCREEN, GF_OPT_ORIGINAL_VIEW,
  GF_OPT_OVERRIDE_SIZE, GF_OPT_AUDIO_VOLUME, GF_OPT_AUDIO_PAN, GF_OPT_AUDIO_MUTE,
  GF_OPT_HAS_JAVASCRIPT, GF_OPT_CAN_SELECT_STREAMS, GF_OPT_INTERACTION_LEVEL, GF_OPT_VISIBLE,
  GF_OPT_FREEZE_DISPLAY, GF_OPT_IS_FINISHED, GF_OPT_IS_OVER, GF_OPT_ASPECT_RATIO,
  GF_OPT_REFRESH, GF_OPT_STRESS_MODE, GF_OPT_DRAW_BOUNDS, GF_OPT_TEXTURE_TEXT,
  GF_OPT_RELOAD_CONFIG, GF_OPT_NAVIGATION_TYPE, GF_OPT_NAVIGATION, GF_OPT_PLAY_STATE,
  GF_OPT_MAIN_ADDON, GF_OPT_VIDEO_BENCH, GF_OPT_USE_OPENGL, GF_OPT_DRAW_MODE,
  GF_OPT_SCALABLE_ZOOM, GF_OPT_YUV_HARDWARE, GF_OPT_YUV_FORMAT, GF_OPT_VIDEO_CACHE_SIZE,
  GF_OPT_HTTP_MAX_RATE, GF_OPT_FORCE_AUDIO_CONFIG, GF_OPT_RASTER_OUTLINES, GF_OPT_EMULATE_POW2,
  GF_OPT_POLYGON_ANTIALIAS, GF_OPT_WIREFRAME, GF_OPT_NORMALS, GF_OPT_BACK_CULL,
  GF_OPT_NO_RECT_TEXTURE, GF_OPT_HEADLIGHT, GF_OPT_COLLISION, GF_OPT_GRAVITY,
  GF_OPT_NUM_STEREO_VIEWS, GF_OPT_MULTIVIEW_MODE, GF_OPT_ORIENTATION_SENSORS_ACTIVE
}
 

Functions

GF_Err gf_sc_load (GF_Compositor *compositor)
 
void gf_sc_unload (GF_Compositor *compositor)
 
void gf_sc_set_fps (GF_Compositor *compositor, GF_Fraction fps)
 
GF_Err gf_sc_set_scene (GF_Compositor *compositor, GF_SceneGraph *scene_graph)
 
Bool gf_sc_draw_frame (GF_Compositor *compositor, Bool no_video_flush, s32 *ms_till_next)
 
void gf_sc_invalidate (GF_Compositor *compositor, GF_Node *node)
 
u32 gf_sc_get_clock (GF_Compositor *compositor)
 
void gf_sc_node_destroy (GF_Compositor *compositor, GF_Node *node, GF_SceneGraph *sg)
 
void gf_sc_lock (GF_Compositor *compositor, Bool do_lock)
 
Bool gf_sc_user_event (GF_Compositor *compositor, GF_Event *event)
 
void gf_sc_map_point (GF_Compositor *compositor, s32 X, s32 Y, Fixed *bifsX, Fixed *bifsY)
 
GF_Err gf_sc_set_option (GF_Compositor *compositor, u32 type, u32 value)
 
u32 gf_sc_get_option (GF_Compositor *compositor, u32 type)
 
Double gf_sc_get_fps (GF_Compositor *compositor, Bool absoluteFPS)
 
Bool gf_sc_has_text_selection (GF_Compositor *compositor)
 
const char * gf_sc_get_selected_text (GF_Compositor *compositor)
 
GF_Err gf_sc_paste_text (GF_Compositor *compositor, const char *text)
 
GF_Err gf_sc_get_screen_buffer (GF_Compositor *compositor, GF_VideoSurface *framebuffer, GF_CompositorGrabMode depth_grab_mode)
 
GF_Err gf_sc_get_offscreen_buffer (GF_Compositor *compositor, GF_VideoSurface *framebuffer, u32 view_idx, GF_CompositorGrabMode depth_grab_mode)
 
GF_Err gf_sc_release_screen_buffer (GF_Compositor *compositor, GF_VideoSurface *framebuffer)
 
void gf_sc_reset_graphics (GF_Compositor *compositor)
 
GF_Err gf_sc_get_viewpoint (GF_Compositor *compositor, u32 viewpoint_idx, const char **out_name, Bool *is_bound)
 
GF_Err gf_sc_set_viewpoint (GF_Compositor *compositor, u32 viewpoint_idx, const char *viewpoint_name)
 
void gf_sc_traverse_subscene (GF_Compositor *compositor, GF_Node *inline_parent, GF_SceneGraph *subscene, void *rs)
 
GF_Err gf_sc_set_size (GF_Compositor *compositor, u32 new_width, u32 new_height)
 
void gf_sc_register_extra_graph (GF_Compositor *compositor, GF_SceneGraph *extra_scene, Bool do_remove)
 
GF_Compositorgf_sc_get_compositor (GF_Node *node)
 
Bool gf_sc_script_action (GF_Compositor *compositor, GF_JSAPIActionType type, GF_Node *node, GF_JSAPIParam *param)
 
Bool gf_sc_uri_is_hardcoded_proto (GF_Compositor *compositor, const char *uri)
 
void gf_sc_reload_config (GF_Compositor *compositor)
 

Detailed Description

This section documents the compositor of GPAC in charge of assembling audio, images, video, text, 2D and 3D graphics in a timed fashion. The compositor can only be run as a filter starting from GPAC 0.9.0, as it requires the filters API to fetch media data. The compositor can work in real-time mode (player) or as a regular filter. See gpac -h compositorfor more information.

This section documents the compositor of GPAC? in charge of assembling audio, images, video, text, 2D and 3D graphics with in a timed way

Typedef Documentation

◆ GF_Compositor

typedef struct __tag_compositor GF_Compositor

Compositor object

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

AspectRatio Type

Enumerator
GF_ASPECT_RATIO_KEEP 

keep AR

GF_ASPECT_RATIO_16_9 

keep 16/9

GF_ASPECT_RATIO_4_3 

keep 4/3

GF_ASPECT_RATIO_FILL_SCREEN 

none (all rendering area used)

◆ anonymous enum

anonymous enum

AntiAlias settings

Enumerator
GF_ANTIALIAS_NONE 

no antialiasing

GF_ANTIALIAS_TEXT 

only text has antialiasing

GF_ANTIALIAS_FULL 

full antialiasing

◆ anonymous enum

anonymous enum

PlayState settings

Enumerator
GF_STATE_PLAYING 

terminal is playing (get only)

GF_STATE_PAUSED 

terminal is paused (get only)

GF_STATE_STEP_PAUSE 

On set, terminal will pause after next frame (simulation tick). On get, indicates that rendering step hasn't performed yet

GF_STATE_PLAY_LIVE 

indicates resume shall restart from live point if any rather than pause point (set only)

◆ anonymous enum

anonymous enum

interaction level settings

Note
GF_INTERACT_NORMAL and GF_INTERACT_NAVIGATION filter events. If set, any event processed by these 2 modules won't be forwarded to the user
Enumerator
GF_INTERACT_NORMAL 

regular interactions enabled (touch sensors)

GF_INTERACT_INPUT_SENSOR 

InputSensor interactions enabled (mouse and keyboard)

GF_INTERACT_NAVIGATION 

all navigation interactions enabled (mouse and keyboard)

◆ anonymous enum

anonymous enum

BoundingVolume settings

Enumerator
GF_BOUNDS_NONE 

doesn't draw bounding volume

GF_BOUNDS_BOX 

draw object bounding box / rect

GF_BOUNDS_AABB 

draw object AABB tree (3D only)

◆ anonymous enum

anonymous enum

Wireframe settings

Enumerator
GF_WIREFRAME_NONE 

draw solid volumes

GF_WIREFRAME_ONLY 

draw only wireframe

GF_WIREFRAME_SOLID 

draw wireframe on solid object

◆ anonymous enum

anonymous enum

navigation type

Enumerator
GF_NAVIGATE_TYPE_NONE 

navigation is disabled by content and cannot be forced by user

GF_NAVIGATE_TYPE_2D 

2D navigation modes only can be used

GF_NAVIGATE_TYPE_3D 

3D navigation modes only can be used

◆ anonymous enum

anonymous enum

navigation modes - non-VRML ones are simply blaxxun contact ones

Enumerator
GF_NAVIGATE_NONE 

no navigation

GF_NAVIGATE_WALK 

3D navigation modes

walk navigation

GF_NAVIGATE_FLY 

fly navigation

GF_NAVIGATE_PAN 

pan navigation

GF_NAVIGATE_GAME 

game navigation

GF_NAVIGATE_SLIDE 

slide navigation, for 2D and 3D

GF_NAVIGATE_EXAMINE 

all modes below disable collision detection & gravity in 3D

GF_NAVIGATE_ORBIT 

orbit navigation - 3D only

GF_NAVIGATE_VR 

QT-VR like navigation - 3D only

◆ anonymous enum

anonymous enum

collision flags

Enumerator
GF_COLLISION_NONE 

no collision

GF_COLLISION_NORMAL 

regular collision

GF_COLLISION_DISPLACEMENT 

collision with camera displacement

◆ anonymous enum

anonymous enum

TextTexturing settings

Enumerator
GF_TEXTURE_TEXT_DEFAULT 

text drawn as texture in 3D mode, regular in 2D mode

GF_TEXTURE_TEXT_NEVER 

text never drawn as texture

GF_TEXTURE_TEXT_ALWAYS 

text always drawn

◆ anonymous enum

anonymous enum

Normal drawing settings

Enumerator
GF_NORMALS_NONE 

normals never drawn

GF_NORMALS_FACE 

normals drawn per face (at barycenter)

GF_NORMALS_VERTEX 

normals drawn per vertex

◆ anonymous enum

anonymous enum

Back-face culling mode

Enumerator
GF_BACK_CULL_OFF 

backface culling disabled

GF_BACK_CULL_ON 

backface culliong enabled

GF_BACK_CULL_ALPHA 

backface culling enabled also for transparent meshes

◆ anonymous enum

anonymous enum

2D drawing mode

Enumerator
GF_DRAW_MODE_DEFER 

defer draw mode (only modified parts of the canvas are drawn)

GF_DRAW_MODE_IMMEDIATE 

immediate draw mode (canvas always redrawn)

GF_DRAW_MODE_DEFER_DEBUG 

defer debug draw mode (only modified parts of the canvas are drawn, the rest of the canvas is erased)

◆ anonymous enum

anonymous enum

high-level options

Enumerator
GF_OPT_ANTIALIAS 

set/get antialias flag (value: one of the AntiAlias enum) - may be ignored in OpenGL mode depending on graphic cards

GF_OPT_HIGHSPEED 

set/get fast mode (value: boolean)

GF_OPT_FULLSCREEN 

set/get fullscreen flag (value: boolean)

GF_OPT_ORIGINAL_VIEW 

reset top-level transform to original (value: boolean)

GF_OPT_OVERRIDE_SIZE 

overrides BIFS size info for simple AV - this is not recommended since it will resize the window to the size of the biggest texture (thus some elements may be lost)

GF_OPT_AUDIO_VOLUME 

set / get audio volume (value is intensity between 0 and 100)

GF_OPT_AUDIO_PAN 

set / get audio pan (value is pan between 0 (all left) and 100(all right) )

GF_OPT_AUDIO_MUTE 

set / get audio mute

GF_OPT_HAS_JAVASCRIPT 

get javascript flag (no set, depends on compil) - value: boolean, true if JS enabled in build

GF_OPT_CAN_SELECT_STREAMS 

get selectable stream flag (no set) - value: boolean, true if audio/video/subtitle stream selection is possible with content (if an MPEG-4 scene description is not present). Use regular OD browsing to get streams

GF_OPT_INTERACTION_LEVEL 

set/get control interaction, OR'ed combination of interaction flags

GF_OPT_VISIBLE 

set display window visible / get show/hide state

GF_OPT_FREEZE_DISPLAY 

set freeze display on/off / get freeze state freeze_display prevents any screen updates needed when output driver uses direct video memory access

GF_OPT_IS_FINISHED 

Returns 1 if file playback is considered as done (all streams finished, no active time sensors and no user interactions in the scene)

GF_OPT_IS_OVER 

Returns 1 if file timeline is considered as done (all streams finished, no active time sensors)

GF_OPT_ASPECT_RATIO 

set/get aspect ratio (value: one of AspectRatio enum)

GF_OPT_REFRESH 

send a redraw message (SetOption only): all graphics info (display list, vectorial path) is recomputed, and textures are reloaded in HW

GF_OPT_STRESS_MODE 

set/get stress mode (value: boolean) - in stress mode a GF_OPT_FORCE_REDRAW is emulated at each frame

GF_OPT_DRAW_BOUNDS 

get/set bounding volume drawing (value: one of the above option)

GF_OPT_TEXTURE_TEXT 

get/set texture text option - when enabled and usable (that depends on content), text is first rendered to a texture and only the texture is drawn, rather than drawing all the text each time (CPU intensive)

GF_OPT_RELOAD_CONFIG 

reload config file (set only), including drivers. Plugins configs are not reloaded

GF_OPT_NAVIGATION_TYPE 

get: returns whether the content enable navigation and if it's 2D or 3D. set: reset viewpoint (whatever value is given)

GF_OPT_NAVIGATION 

get current navigation mode - set navigation mode if allowed by content - this is not a resident option (eg not stored in cfg)

GF_OPT_PLAY_STATE 

get/set Play state - cf above states for set

GF_OPT_MAIN_ADDON 

get only: returns 1 if main addon is playing, 0 if regular scene is playing

GF_OPT_VIDEO_BENCH 

get/set bench mode - if enabled, video frames are drawn as soon as possible witthout checking synchronisation

GF_OPT_USE_OPENGL 

get/set OpenGL force mode - returns error if OpenGL is not supported

GF_OPT_DRAW_MODE 

set/get draw mode

GF_OPT_SCALABLE_ZOOM 

set/get scalable zoom (value: boolean)

GF_OPT_YUV_HARDWARE 

set/get YUV acceleration (value: boolean)

GF_OPT_YUV_FORMAT 

get (set not supported yet) hardware YUV format (value: YUV 4CC)

GF_OPT_VIDEO_CACHE_SIZE 

max video cache size in kbytes

GF_OPT_HTTP_MAX_RATE 

max HTTP download rate in bits per second, 0 if no limit

GF_OPT_FORCE_AUDIO_CONFIG 

set only (value: boolean). If set, the main audio mixer can no longer be reconfigured.

GF_OPT_RASTER_OUTLINES 

3D ONLY OPTIONS

set/get raster outline flag (value: boolean) - when set, no vectorial outlining is done, only openGL raster outline

GF_OPT_EMULATE_POW2 

set/get pow2 emulation flag (value: boolean) - when set, video textures with non power of 2 dimensions are emulated as pow2 by expanding the video buffer (image is not scaled). Otherwise the entire image is rescaled. This flag does not affect image textures, which are always rescaled

GF_OPT_POLYGON_ANTIALIAS 

get/set polygon antialiasing flag (value: boolean) (may be ugly with some cards)

GF_OPT_WIREFRAME 

get/set wireframe flag (value: cf above) (may be ugly with some cards)

GF_OPT_NORMALS 

get/set wireframe flag (value: cf above) (may be ugly with some cards)

GF_OPT_BACK_CULL 

disable backface culling

GF_OPT_NO_RECT_TEXTURE 

get/set RECT Ext flag (value: boolean) - when set, GL rectangular texture extension is not used (but NPO2 texturing is if available)

GF_OPT_HEADLIGHT 

set/get headlight (value: boolean)

GF_OPT_COLLISION 

set/get collision (value: cf above)

GF_OPT_GRAVITY 

set/get gravity

GF_OPT_NUM_STEREO_VIEWS 

get the number of offscreen views in stereo mode, or 1 if no offscreen stereo views are available

GF_OPT_MULTIVIEW_MODE 

set the mode of display of HEVC multiview videos, 0 to display the two views/layers and 1 to display just the first view/layer

GF_OPT_ORIENTATION_SENSORS_ACTIVE 

get orientation sensors flag, true if sensors are activated false if not

Function Documentation

◆ gf_sc_load()

GF_Err gf_sc_load ( GF_Compositor compositor)

loads a compositor object

Parameters
compositora preallocated structure for the compositor to initialize
Returns
error if any

◆ gf_sc_unload()

void gf_sc_unload ( GF_Compositor compositor)

unloads compositor

Parameters
compositorthe compositor object to unload. The structure memory is not freed

◆ gf_sc_set_fps()

void gf_sc_set_fps ( GF_Compositor compositor,
GF_Fraction  fps 
)

sets simulation frame rate. The compositor framerate impacts the frequency at which time nodes and animations are updated, but does not impact the video objects frame rates.

Parameters
compositorthe target compositor
fpsthe desired frame rate

◆ gf_sc_set_scene()

GF_Err gf_sc_set_scene ( GF_Compositor compositor,
GF_SceneGraph scene_graph 
)

sets the root scene graph of the compositor.

Parameters
compositorthe target compositor
scene_graphthe scene graph to attach. If NULL, removes current scene and resets simulation time
Returns
error if any

◆ gf_sc_draw_frame()

Bool gf_sc_draw_frame ( GF_Compositor compositor,
Bool  no_video_flush,
s32 ms_till_next 
)

draws a single frame. If the frame is drawn, a packet is sent on the compositor vout output pi

Parameters
compositorthe target compositor
no_video_flushdisables video frame flushing to graphics card. Ignored in non-player mode
ms_till_nextset to the number of milliseconds until next expected frame
Returns
GF_TRUE if there are pending tasks (frame late, fonts pending, etc) or GF_FALSE if everything was ready while drawing the frame

◆ gf_sc_invalidate()

void gf_sc_invalidate ( GF_Compositor compositor,
GF_Node *  node 
)

notify the given node has been modified. The compositor filters object to decide whether the scene graph has to be traversed or not.

Parameters
compositorthe target compositor
nodethe node to invalidate. If NULL, this means complete traversing of the graph is requested

◆ gf_sc_get_clock()

u32 gf_sc_get_clock ( GF_Compositor compositor)

returns the compositor time. The compositor time is the time every time line is synchronized to

Parameters
compositorthe target compositor
Returns
compositor time in milliseconds

◆ gf_sc_node_destroy()

void gf_sc_node_destroy ( GF_Compositor compositor,
GF_Node *  node,
GF_SceneGraph sg 
)

signals the node or scenegraph is about to be destroyed. This should be called after the node destructor if any. This function cleans up any pending events on the target node or graph.

Parameters
compositorthe target compositor
nodethe target node. If NULL, sg shall be set to the scenegraph about to be destroyed
sgthe target scenegraph

◆ gf_sc_lock()

void gf_sc_lock ( GF_Compositor compositor,
Bool  do_lock 
)

locks/unlocks the visual scene rendering. Modifications of the scene tree shall only happen when scene compositor is locked

Parameters
compositorthe target compositor
do_lockindicates if the compositor should be locked (GF_TRUE) or released (GF_FALSE)

◆ gf_sc_user_event()

Bool gf_sc_user_event ( GF_Compositor compositor,
GF_Event event 
)

notify user input

Parameters
compositorthe target compositor
eventthe target event to notify
Returns
GF_FALSE if event hasn't been handled by the compositor, GF_TRUE otherwise

◆ gf_sc_map_point()

void gf_sc_map_point ( GF_Compositor compositor,
s32  X,
s32  Y,
Fixed bifsX,
Fixed bifsY 
)

maps screen coordinates to bifs 2D coordinates for the current zoom/pan settings. The input coordinate X and Y are point coordinates in the display expressed in BIFS-like fashion (0,0) at center of display and Y increasing from bottom to top

Parameters
compositorthe target compositor
Xhorizontal point coordinate
Yvertical point coordinate
bifsXset to the scene horizontal coordinate of the point
bifsYset to the scene vertical coordinate of the point

◆ gf_sc_set_option()

GF_Err gf_sc_set_option ( GF_Compositor compositor,
u32  type,
u32  value 
)

sets user options. Options are as defined in user.h

Parameters
compositorthe target compositor
typethe target option type
valuethe target option value
Returns
error if any

◆ gf_sc_get_option()

u32 gf_sc_get_option ( GF_Compositor compositor,
u32  type 
)

gets user options. Options are as defined in user.h

Parameters
compositorthe target compositor
typethe target option type
Returns
the option value

◆ gf_sc_get_fps()

Double gf_sc_get_fps ( GF_Compositor compositor,
Bool  absoluteFPS 
)

returns current FPS

Parameters
compositorthe target compositor
absoluteFPSif set to GF_TRUE, the return value is the absolute framerate, eg NbFrameCount/NbTimeSpent regardless of whether a frame has been drawn or not, which means the FPS returned can be much greater than the compositor FPS. If set to GF_FALSE, the return value is the FPS taking into account not drawn frames (eg, less than or equal to compositor FPS)
Returns
the current frame rate

◆ gf_sc_has_text_selection()

Bool gf_sc_has_text_selection ( GF_Compositor compositor)

checks if a text selection is in progress

Parameters
compositorthe target compositor
Returns
GF_TRUE is some text is selected, GF_FALSE otherwise

◆ gf_sc_get_selected_text()

const char* gf_sc_get_selected_text ( GF_Compositor compositor)

gets text selection

Parameters
compositorthe target compositor
Returns
the selected text as UTF8 string

◆ gf_sc_paste_text()

GF_Err gf_sc_paste_text ( GF_Compositor compositor,
const char *  text 
)

replace text selection content

Parameters
compositorthe target compositor
textthe text to paste as UTF8 string
Returns
error if any

◆ gf_sc_get_screen_buffer()

GF_Err gf_sc_get_screen_buffer ( GF_Compositor compositor,
GF_VideoSurface framebuffer,
GF_CompositorGrabMode  depth_grab_mode 
)

gets screen buffer. This locks the scene graph too until gf_sc_get_offscreen_buffer is called

Parameters
compositorthe target compositor
framebufferwill be set to the grabbed framebuffer. The pixel data is owned by the compositor and shall not be freed
depth_grab_modemode for depth grabbing in 3D
Returns
error if any

◆ gf_sc_get_offscreen_buffer()

GF_Err gf_sc_get_offscreen_buffer ( GF_Compositor compositor,
GF_VideoSurface framebuffer,
u32  view_idx,
GF_CompositorGrabMode  depth_grab_mode 
)

gets offscreen buffer in autostereo rendering modes. This locks the scene graph too until gf_sc_get_offscreen_buffer is called

Parameters
compositorthe target compositor
framebufferwill be set to the grabbed framebuffer. The pixel data is owned by the compositor and shall not be freed
view_idxindicates the 0-based index of the view to grab
depth_grab_modemode for depth grabbing in 3D
Returns
error if any

◆ gf_sc_release_screen_buffer()

GF_Err gf_sc_release_screen_buffer ( GF_Compositor compositor,
GF_VideoSurface framebuffer 
)

releases screen buffer and unlocks graph

Parameters
compositorthe target compositor
framebufferused during grab call
Returns
error if any

◆ gf_sc_reset_graphics()

void gf_sc_reset_graphics ( GF_Compositor compositor)

forces full graphics reset (deletes GL textures, FBO, 2D offscreen caches, etc ...).

Parameters
compositorthe target compositor

◆ gf_sc_get_viewpoint()

GF_Err gf_sc_get_viewpoint ( GF_Compositor compositor,
u32  viewpoint_idx,
const char **  out_name,
Bool is_bound 
)

gets viewpoints/viewports for main scene - idx is 1-based, and if greater than number of viewpoints return GF_EOS

Parameters
compositorthe target compositor
viewpoint_idxthe index of the requested viewport. This is a 1-based index, and if greater than number of viewpoints the function will return GF_EOS
out_nameset to the viewport name. May be NULL
is_boundset to GF_TRUE if the viewport is bound. May be NULL
Returns
GF_EOS if no more viewpoint, or error if any

◆ gf_sc_set_viewpoint()

GF_Err gf_sc_set_viewpoint ( GF_Compositor compositor,
u32  viewpoint_idx,
const char *  viewpoint_name 
)

sets viewpoints/viewports for main scene given its name - idx is 1-based, or 0 to retrieve by viewpoint name if only one viewpoint is present in the scene, this will bind/unbind it

Parameters
compositorthe target compositor
viewpoint_idxthe index of the viewport to bind. This is a 1-based index, and if greater than number of viewpoints the function will return GF_EOS. Use 0 to bind the viewpoint with the given name.
viewpoint_namename of the viewpoint to bind if viewpoint_idx is 0
Returns
error if any

◆ gf_sc_traverse_subscene()

void gf_sc_traverse_subscene ( GF_Compositor compositor,
GF_Node *  inline_parent,
GF_SceneGraph subscene,
void *  rs 
)

renders subscene root node. rs is the current traverse stack

Parameters
compositorthe target compositor
inline_parentthe parent node of the subscene (VRML Inline, SVG animation, ...)
subscenethe subscene tree to render
rsthe rendering state at the parent level. This is needed to handle graph metrics changes between scenes

◆ gf_sc_set_size()

GF_Err gf_sc_set_size ( GF_Compositor compositor,
u32  new_width,
u32  new_height 
)

sets output (display) size

Parameters
compositorthe target compositor
new_widththe desired new output width
new_heightthe desired new output height
Returns
error if any

◆ gf_sc_register_extra_graph()

void gf_sc_register_extra_graph ( GF_Compositor compositor,
GF_SceneGraph extra_scene,
Bool  do_remove 
)

adds or removes extra scene from compositor. Extra scenes are on-screen displays, text tracks or any other scene graphs not directly loaded by the main scene

Parameters
compositorthe target compositor
extra_scenethe scene graph to add/remove
do_removeif set to GF_TRUE, the given scene graph will be unregistered; otherwise, the given scene graph will be registered

◆ gf_sc_get_compositor()

GF_Compositor* gf_sc_get_compositor ( GF_Node *  node)

retrieves the compositor object associated with a node. Currently GPAC only handles one possible compositor per node.

Parameters
nodethe target node
Returns
the compositor used by the node

◆ gf_sc_script_action()

Bool gf_sc_script_action ( GF_Compositor compositor,
GF_JSAPIActionType  type,
GF_Node *  node,
GF_JSAPIParam param 
)

executes a script action

Parameters
compositorthe target compositor
typethe script action type
nodethe optional node on which the action takes place
paramthe parameter for this action
Returns
GF_TRUE if success

◆ gf_sc_uri_is_hardcoded_proto()

Bool gf_sc_uri_is_hardcoded_proto ( GF_Compositor compositor,
const char *  uri 
)

checks if the given URI matches a built-in GPAC VRML Prototype node

Parameters
compositorthe target compositor
urithe URI to test
Returns
GF_TRUE if the URI indicates a built-in prototype, GF_FALSE otherwise

◆ gf_sc_reload_config()

void gf_sc_reload_config ( GF_Compositor compositor)

reloads the compositor configuration from the GPAC config file

Parameters
compositorthe target compositor