libgpac
Documentation of the core library of GPAC
|
GPAC A/V/2D/3D compositor/rendering. More...
Typedefs | |
typedef struct __tag_compositor | GF_Compositor |
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 compositor
for more information.
The compositor object is the private data of the compositor filter and can be retrieved using gf_filter_get_udta
The compositor object will look for the following variables in the temp section of the GPAC config:
typedef struct __tag_compositor GF_Compositor |
Compositor object
anonymous enum |
anonymous enum |
anonymous enum |
PlayState settings
anonymous enum |
interaction level settings
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
navigation modes - non-VRML ones are simply blaxxun contact ones
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
2D drawing mode
enum GF_CompositorOption |
compositor options
GF_Err gf_sc_load | ( | GF_Compositor * | compositor | ) |
loads a compositor object
compositor | a preallocated structure for the compositor to initialize |
void gf_sc_unload | ( | GF_Compositor * | compositor | ) |
unloads compositor
compositor | the compositor object to unload. The structure memory is not freed |
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.
compositor | the target compositor |
fps | the desired frame rate |
GF_Err gf_sc_set_scene | ( | GF_Compositor * | compositor, |
GF_SceneGraph * | scene_graph | ||
) |
sets the root scene graph of the compositor.
compositor | the target compositor |
scene_graph | the scene graph to attach. If NULL, removes current scene and resets simulation time |
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
compositor | the target compositor |
no_video_flush | disables video frame flushing to graphics card. Ignored in non-player mode |
ms_till_next | set to the number of milliseconds until next expected frame |
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.
compositor | the target compositor |
node | the node to invalidate. If NULL, this means complete traversing of the graph is requested |
void gf_sc_invalidate_next_frame | ( | GF_Compositor * | compositor | ) |
mark next frame as required to be refreshed
compositor | the target compositor |
Bool gf_sc_frame_was_produced | ( | GF_Compositor * | compositor | ) |
checks if a frame has been produced since last call to gf_sc_invalidate_next_frame. This is typically used when the caller app has no control over flush
compositor | the target compositor |
u32 gf_sc_get_clock | ( | GF_Compositor * | compositor | ) |
returns the compositor time. The compositor time is the time every time line is synchronized to
compositor | the target compositor |
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.
compositor | the target compositor |
node | the target node. If NULL, sg shall be set to the scenegraph about to be destroyed |
sg | the target scenegraph |
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
compositor | the target compositor |
do_lock | indicates if the compositor should be locked (GF_TRUE) or released (GF_FALSE) |
Bool gf_sc_user_event | ( | GF_Compositor * | compositor, |
GF_Event * | event | ||
) |
notify user input
compositor | the target compositor |
event | the target event to notify |
void gf_sc_disconnect | ( | GF_Compositor * | compositor | ) |
disconnects the current url
compositor | the target compositor |
void gf_sc_connect_from_time | ( | GF_Compositor * | compositor, |
const char * | URL, | ||
u64 | startTime, | ||
u32 | pause_at_first_frame, | ||
Bool | secondary_scene, | ||
const char * | parent_path | ||
) |
connects a given url
compositor | the target compositor |
URL | the target URL |
startTime | start time in milliseconds |
pause_at_first_frame | indicate if compositor should pause once first frame is reached
|
secondary_scene | indicate this is a secondary scene (subs, etc) |
parent_path | parent path of URL, may be NULL |
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
compositor | the target compositor |
X | horizontal point coordinate |
Y | vertical point coordinate |
bifsX | set to the scene horizontal coordinate of the point |
bifsY | set to the scene vertical coordinate of the point |
Double gf_sc_get_fps | ( | GF_Compositor * | compositor, |
Bool | absoluteFPS | ||
) |
returns current FPS
compositor | the target compositor |
absoluteFPS | if 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) |
Bool gf_sc_has_text_selection | ( | GF_Compositor * | compositor | ) |
checks if a text selection is in progress
compositor | the target compositor |
const char* gf_sc_get_selected_text | ( | GF_Compositor * | compositor | ) |
gets text selection
compositor | the target compositor |
GF_Err gf_sc_paste_text | ( | GF_Compositor * | compositor, |
const char * | text | ||
) |
replace text selection content
compositor | the target compositor |
text | the text to paste as UTF8 string |
GF_Err gf_sc_add_object | ( | GF_Compositor * | compositor, |
const char * | url, | ||
Bool | auto_play | ||
) |
adds an object to the scene - only possible if scene has selectable streams (cf GF_OPT_CAN_SELECT_STREAMS option)
compositor | the target compositor |
url | the URL of the object to inject |
auto_play | selcts the object for playback when inserting it |
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
compositor | the target compositor |
framebuffer | will be set to the grabbed framebuffer. The pixel data is owned by the compositor and shall not be freed |
depth_grab_mode | mode for depth grabbing in 3D |
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
compositor | the target compositor |
framebuffer | will be set to the grabbed framebuffer. The pixel data is owned by the compositor and shall not be freed |
view_idx | indicates the 0-based index of the view to grab |
depth_grab_mode | mode for depth grabbing in 3D |
GF_Err gf_sc_release_screen_buffer | ( | GF_Compositor * | compositor, |
GF_VideoSurface * | framebuffer | ||
) |
releases screen buffer and unlocks graph
compositor | the target compositor |
framebuffer | used during grab call |
void gf_sc_reset_graphics | ( | GF_Compositor * | compositor | ) |
forces full graphics reset (deletes GL textures, FBO, 2D offscreen caches, etc ...).
compositor | the target compositor |
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
compositor | the target compositor |
viewpoint_idx | the 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_name | set to the viewport name. May be NULL |
is_bound | set to GF_TRUE if the viewport is bound. May be NULL |
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
compositor | the target compositor |
viewpoint_idx | the 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_name | name of the viewpoint to bind if viewpoint_idx is 0 |
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
compositor | the target compositor |
inline_parent | the parent node of the subscene (VRML Inline, SVG animation, ...) |
subscene | the subscene tree to render |
rs | the rendering state at the parent level. This is needed to handle graph metrics changes between scenes |
GF_Err gf_sc_set_size | ( | GF_Compositor * | compositor, |
u32 | new_width, | ||
u32 | new_height | ||
) |
sets output (display) size
compositor | the target compositor |
new_width | the desired new output width |
new_height | the desired new output height |
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
compositor | the target compositor |
extra_scene | the scene graph to add/remove |
do_remove | if set to GF_TRUE, the given scene graph will be unregistered; otherwise, the given scene graph will be registered |
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.
node | the target node |
Bool gf_sc_script_action | ( | GF_Compositor * | compositor, |
GF_JSAPIActionType | type, | ||
GF_Node * | node, | ||
GF_JSAPIParam * | param | ||
) |
executes a script action
compositor | the target compositor |
type | the script action type |
node | the optional node on which the action takes place |
param | the parameter for this action |
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
compositor | the target compositor |
uri | the URI to test |
void gf_sc_reload_config | ( | GF_Compositor * | compositor | ) |
reloads the compositor configuration from the GPAC config file
compositor | the target compositor |
u32 gf_sc_get_time_in_ms | ( | GF_Compositor * | compositor | ) |
gets main scene current time
compositor | the target compositor |
void gf_sc_switch_quality | ( | GF_Compositor * | compositor, |
Bool | up | ||
) |
switches quality up or down - can be called several time in the same direction this will call all decoders to adjust their quality levels
compositor | the target compositor |
up | if GF_TRUE, switches quality up,otherwise down |
void gf_sc_toggle_addons | ( | GF_Compositor * | compositor, |
Bool | show_addons | ||
) |
sets addon on or off (only one addon possible for now). When OFF, the associated service is shut down
compositor | the target compositor |
show_addons | if GF_TRUE, displays addons otheriwse hides the addons |
GF_Err gf_sc_set_speed | ( | GF_Compositor * | compositor, |
Fixed | speed | ||
) |
sets playback speed
compositor | the target compositor |
speed | the requested speed |
Bool gf_sc_is_supported_url | ( | GF_Compositor * | compositor, |
const char * | URL, | ||
Bool | use_parent_url | ||
) |
checks if given URL is understood by client.
compositor | the target compositor |
URL | the URL to check |
use_parent_url | if GF_TRUE, relative URLs are solved against the current presentation URL |
void gf_sc_navigate_to | ( | GF_Compositor * | compositor, |
const char * | toURL | ||
) |
navigates to a given destination or shutdown/restart the current one if any. This is the only safe way of restarting/jumping a presentation from inside the EventProc where doing a disconnect/connect could deadlock if toURL is NULL, uses the current URL
compositor | the target compositor |
toURL | the new target URL |
u32 gf_sc_play_from_time | ( | GF_Compositor * | compositor, |
u64 | from_time, | ||
u32 | pause_at_first_frame | ||
) |
restarts url from given time (in ms).
compositor | the target compositor |
from_time | restart time in milliseconds |
pause_at_first_frame | if 1, pauses at the first frame. If 2, pauses at the first frame only if the compositor is in paused state. |
GF_Err gf_sc_dump_scene | ( | GF_Compositor * | compositor, |
char * | rad_name, | ||
char ** | filename, | ||
Bool | xml_dump, | ||
Bool | skip_proto | ||
) |
dumps scene graph in specified file, in BT or XMT format
compositor | the target compositor |
rad_name | file radical (NULL for stdout) - if not NULL MUST BE GF_MAX_PATH length |
filename | sets to the complete filename (rad + ext) and shall be destroyed by caller (optional can be NULL) |
xml_dump | if GF_TRUE, duimps using XML format (XMT-A, X3D) for scene graphs having both XML and simple text representations |
skip_proto | is GF_TRUE, proto declarations are not dumped |
GF_Err gf_sc_scene_update | ( | GF_Compositor * | compositor, |
char * | type, | ||
char * | com | ||
) |
sends a set of scene commands (BT, XMT, X3D, LASeR+XML) to the scene
compositor | the target compositor |
type | indicates the language used - accepted values are "model/x3d+xml" or "x3d": commands is an X3D+XML scene "model/x3d+vrml" or "xrdv": commands is an X3D+VRML scene "model/vrml" or "vrml": commands is an VRML scene "application/x-xmt" or "xmt": commands is an XMT-A scene or a list of XMT-A updates "application/x-bt" or "bt": commands is a BT scene or a list of BT updates "image/svg+xml" or "svg": commands is an SVG scene "application/x-laser+xml" or "laser": commands is an SVG/LASeR+XML scene or a list of LASeR+XML updates if not specified, the type will be guessed from the current root node if any |
com | the textual update |
void gf_sc_select_service | ( | GF_Compositor * | compositor, |
u32 | service_id | ||
) |
selects service by given ID for multiplexed services (MPEG-2 TS)
compositor | the target compositor |
service_id | the service ID to select |
const char* gf_sc_get_url | ( | GF_Compositor * | compositor | ) |
gets URL of main scene
compositor | the target compositor |
const void* gf_sc_get_main_pid | ( | GF_Compositor * | compositor | ) |
gets main pid in scene
compositor | the target compositor |
const char* gf_sc_get_world_info | ( | GF_Compositor * | compositor, |
GF_List * | descriptions | ||
) |
gets world info of root scene
compositor | the target compositor |
descriptions | filled with descriptions strings (do not free) |
u32 gf_sc_get_current_service_id | ( | GF_Compositor * | compositor | ) |
gets service ID of root scene
compositor | the target compositor |
Double gf_sc_get_simulation_frame_rate | ( | GF_Compositor * | compositor, |
u32 * | nb_frames_drawn | ||
) |
gets simulation frame rate
compositor | the target compositor |
nb_frames_drawn | set to the number of frames drawn |
GF_Err gf_sc_set_option | ( | GF_Compositor * | compositor, |
GF_CompositorOption | type, | ||
u32 | value | ||
) |
sets compositor run-time option
compositor | the target compositor |
type | the target option type |
value | the target option value |
u32 gf_sc_get_option | ( | GF_Compositor * | compositor, |
GF_CompositorOption | type | ||
) |
gets compositor run-time option.
compositor | the target compositor |
type | the target option type |