libgpac
Documentation of the core library of GPAC
|
Interface between compositor and decoding engine for media data access. More...
Data Structures | |
struct | GF_MediaObjectVRInfo |
Enumerations | |
enum | GF_MOFetchMode { GF_MO_FETCH = 0 , GF_MO_FETCH_RESYNC , GF_MO_FETCH_PAUSED } |
enum | GF_MOUserFlags { GF_MO_DISPLAY_REMOVE = (1<<1) , GF_MO_IN_RESYNC = (1<<2) } |
Functions | |
GF_MediaObject * | gf_mo_register (GF_Node *node, MFURL *url, Bool lock_timelines, Bool force_new_res) |
void | gf_mo_unregister (GF_Node *node, GF_MediaObject *mo) |
void | gf_mo_play (GF_MediaObject *mo, Double clipBegin, Double clipEnd, Bool can_loop) |
void | gf_mo_stop (GF_MediaObject **mo) |
void | gf_mo_restart (GF_MediaObject *mo) |
void | gf_mo_pause (GF_MediaObject *mo) |
void | gf_mo_resume (GF_MediaObject *mo) |
void | gf_mo_set_speed (GF_MediaObject *mo, Fixed speed) |
Fixed | gf_mo_get_speed (GF_MediaObject *mo, Fixed in_speed) |
Bool | gf_mo_get_loop (GF_MediaObject *mo, Bool in_loop) |
Double | gf_mo_get_duration (GF_MediaObject *mo) |
Bool | gf_mo_should_deactivate (GF_MediaObject *mo) |
Bool | gf_mo_url_changed (GF_MediaObject *mo, MFURL *url) |
u32 | gf_mo_get_min_frame_dur (GF_MediaObject *mo) |
u32 | gf_mo_map_timestamp_to_sys_clock (GF_MediaObject *mo, u32 ts) |
Bool | gf_mo_is_buffering (GF_MediaObject *mo) |
u8 * | gf_mo_fetch_data (GF_MediaObject *mo, GF_MOFetchMode resync, u32 upload_time_ms, Bool *eos, u32 *timestamp, u32 *size, s32 *ms_until_pres, s32 *ms_until_next, GF_FilterFrameInterface **outFrame, u32 *planar_size) |
void | gf_mo_release_data (GF_MediaObject *mo, u32 nb_bytes, s32 drop_mode) |
void | gf_mo_get_object_time (GF_MediaObject *mo, u32 *obj_time) |
Bool | gf_mo_is_muted (GF_MediaObject *mo) |
Bool | gf_mo_is_done (GF_MediaObject *mo) |
void | gf_mo_adjust_clock (GF_MediaObject *mo, s32 ms_drift) |
Bool | gf_mo_is_started (GF_MediaObject *mo) |
Bool | gf_mo_get_visual_info (GF_MediaObject *mo, u32 *width, u32 *height, u32 *stride, u32 *pixel_ar, u32 *pixelFormat, Bool *is_flipped) |
Bool | gf_mo_get_visual_info_ex (GF_MediaObject *mo, u32 *width, u32 *height, u32 *stride, u32 *pixel_ar, u32 *pixelFormat, Bool *is_flipped, Bool for_texture) |
void | gf_mo_get_nb_views (GF_MediaObject *mo, u32 *nb_views) |
Bool | gf_mo_get_audio_info (GF_MediaObject *mo, u32 *sample_rate, u32 *afmt, u32 *num_channels, u64 *channel_config, Bool *forced_layout) |
Fixed | gf_mo_get_current_speed (GF_MediaObject *mo) |
u32 | gf_mo_has_audio (GF_MediaObject *mo) |
void | gf_mo_set_flag (GF_MediaObject *mo, GF_MOUserFlags flag, Bool set_on) |
GF_MediaObject * | gf_mo_load_xlink_resource (GF_Node *node, Bool primary_resource, Double clipBegin, Double clipEnd) |
void | gf_mo_unload_xlink_resource (GF_Node *node, GF_MediaObject *mo) |
GF_SceneGraph * | gf_mo_get_scenegraph (GF_MediaObject *mo) |
Bool | gf_mo_get_srd_info (GF_MediaObject *mo, GF_MediaObjectVRInfo *vr_info) |
void | gf_mo_hint_quality_degradation (GF_MediaObject *mo, u32 quality_degradation) |
void | gf_mo_hint_visible_rect (GF_MediaObject *mo, u32 min_x, u32 max_x, u32 min_y, u32 max_y) |
void | gf_mo_hint_gaze (GF_MediaObject *mo, u32 gaze_x, u32 gaze_y) |
void | gf_mo_del (GF_MediaObject *mo) |
GF_DOMEventTarget * | gf_mo_event_target_add_node (GF_MediaObject *mo, GF_Node *node) |
GF_Err | gf_mo_event_target_remove_by_node (GF_MediaObject *mo, GF_Node *node) |
u32 | gf_mo_event_target_count (GF_MediaObject *mo) |
GF_Err | gf_mo_event_target_remove_by_index (GF_MediaObject *mo, u32 index) |
GF_DOMEventTarget * | gf_mo_event_target_get (GF_MediaObject *mo, u32 index) |
void | gf_mo_event_target_reset (GF_MediaObject *mo) |
s32 | gf_mo_event_target_find_by_node (GF_MediaObject *mo, GF_Node *node) |
GF_Node * | gf_mo_event_target_enum_node (GF_MediaObject *mo, u32 *i) |
GF_Node * | gf_event_target_get_node (GF_DOMEventTarget *target) |
This section documents the API between the compositor of GPAC and the decoding engine (filter pids)
struct GF_MediaObjectVRInfo |
enum GF_MOFetchMode |
enum GF_MOUserFlags |
GF_MediaObject* gf_mo_register | ( | GF_Node * | node, |
MFURL * | url, | ||
Bool | lock_timelines, | ||
Bool | force_new_res | ||
) |
locates media object related to the given node - url designes the object to find - returns NULL if URL cannot be handled - note that until the mediaObject.isInit member is true, the media object is not valid (and could actually never be)
node | node querying the URL |
url | the URL to open |
lock_timelines | if GF_TRUE, forces media timelines in remote URL to be locked to the node timeline |
force_new_res | if GF_TRUE, forces loading of a new resource |
void gf_mo_unregister | ( | GF_Node * | node, |
GF_MediaObject * | mo | ||
) |
unregisters the node from the media object
node | node querying the URL |
mo | the media object to unregister - can be destroyed during this function call |
opens media object
mo | the target media object |
clipBegin | the playback start time in seconds |
clipEnd | the playback end time in seconds |
can_loop | if GF_TRUE, indicates the playback can be looped |
void gf_mo_stop | ( | GF_MediaObject ** | mo | ) |
stops media object. Object is set to null if stop triggers a removal. If not removed, video memory is not reset, last frame is kept
mo | the target media object |
void gf_mo_restart | ( | GF_MediaObject * | mo | ) |
restarts media object - shall be used for all looping media instead of stop/play for mediaControl to restart appropriated objects
mo | the target media object |
void gf_mo_pause | ( | GF_MediaObject * | mo | ) |
pauses a media object
mo | the target media object |
void gf_mo_resume | ( | GF_MediaObject * | mo | ) |
resumes a media object
mo | the target media object |
void gf_mo_set_speed | ( | GF_MediaObject * | mo, |
Fixed | speed | ||
) |
Note on mediaControl: mediaControl is the media management app responsibility, therefore
is hidden from the rendering app. Since MediaControl overrides default settings of the node (speed and loop) you must use the gf_mo_get_speed and gf_mo_get_loop in order to know whether the related field applies or not
sets speed of media - speed is not always applied, depending on media control settings.
mo | the target media object |
speed | the playback speed to set |
gets current speed of media
mo | the target media object |
in_speed | is the speed of the media as set in the node (MovieTexture, AudioClip and AudioSource) |
gets current looping flag of media
mo | the target media object |
in_loop | is the looping flag of the media as set in the node (MovieTexture, AudioClip) |
Double gf_mo_get_duration | ( | GF_MediaObject * | mo | ) |
get media object duration
mo | the target media object |
Bool gf_mo_should_deactivate | ( | GF_MediaObject * | mo | ) |
checks if object should be deactivated (stop) or not - this checks object status as well as mediaControl status
mo | the target media object |
checks whether the target object is changed - you MUST use this in order to detect url changes
mo | the target media object |
url | URL to compare to object current URL |
u32 gf_mo_get_min_frame_dur | ( | GF_MediaObject * | mo | ) |
gets minimum frame duration for an object
mo | the target media object |
map a timestamp to the object clock
mo | the target media object |
ts | a timestamp in media object clock base |
Bool gf_mo_is_buffering | ( | GF_MediaObject * | mo | ) |
checks if object is buffering
mo | the target media object |
u8* gf_mo_fetch_data | ( | GF_MediaObject * | mo, |
GF_MOFetchMode | resync, | ||
u32 | upload_time_ms, | ||
Bool * | eos, | ||
u32 * | timestamp, | ||
u32 * | size, | ||
s32 * | ms_until_pres, | ||
s32 * | ms_until_next, | ||
GF_FilterFrameInterface ** | outFrame, | ||
u32 * | planar_size | ||
) |
fetches media data
mo | the target media object |
resync | resync mode for fetch operation |
upload_time_ms | average time needed to push frame on GPU |
eos | set to end of stream status of the media |
timestamp | set to the frmae timestamp in object time |
size | set to the frame data size |
ms_until_pres | set to the number of milliseconds until presentation is due |
ms_until_next | set to the number of milliseconds until presentation of next frame is due |
outFrame | set to the associated frame interface object if any |
planar_size | set to the planar size of audio data, or 0 |
releases given amount of media data - nb_bytes is used for audio
mo | the target media object |
nb_bytes | number of audio bytes to remove (ignored for other media types) |
drop_mode | can take the following values: -1: do not drop 0: do not force drop: the unlocked frame it will be dropped based on object time (typically video) 1: force drop : the unlocked frame will be dropped if all bytes are consumed (typically audio) 2: the frame will be stated as a discraded frame |
void gf_mo_get_object_time | ( | GF_MediaObject * | mo, |
u32 * | obj_time | ||
) |
gets object clock
mo | the target media object |
obj_time | set to the object current time in milliseconds in object time base |
Bool gf_mo_is_muted | ( | GF_MediaObject * | mo | ) |
checks if object is muted. Muted media shouldn't be displayed
mo | the target media object |
Bool gf_mo_is_done | ( | GF_MediaObject * | mo | ) |
checks if a media object is done
mo | the target media object |
void gf_mo_adjust_clock | ( | GF_MediaObject * | mo, |
s32 | ms_drift | ||
) |
adjusts clock sync (only audio objects are allowed to use this)
mo | the target media object |
ms_drift | drift in milliseconds between object clock and actual rendering time |
Bool gf_mo_is_started | ( | GF_MediaObject * | mo | ) |
checks if a media object is started
mo | the target media object |
Bool gf_mo_get_visual_info | ( | GF_MediaObject * | mo, |
u32 * | width, | ||
u32 * | height, | ||
u32 * | stride, | ||
u32 * | pixel_ar, | ||
u32 * | pixelFormat, | ||
Bool * | is_flipped | ||
) |
gets visual information of a media object
mo | the target media object |
width | set to width in pixels |
height | set to height in pixels |
stride | set to stride in bytes for visual objects with data frame, 0 if unknown |
pixel_ar | set to the pixel aspect ratio as (PAR_NUM<<16)|PAR_DEN
|
pixelFormat | set to the pixel format of the video |
is_flipped | set to GF_TRUE if the pixels are vertically flipped (happens when reading back OpenGL textures) |
Bool gf_mo_get_visual_info_ex | ( | GF_MediaObject * | mo, |
u32 * | width, | ||
u32 * | height, | ||
u32 * | stride, | ||
u32 * | pixel_ar, | ||
u32 * | pixelFormat, | ||
Bool * | is_flipped, | ||
Bool | for_texture | ||
) |
gets visual information of a media object
mo | the target media object |
width | set to width in pixels |
height | set to height in pixels |
stride | set to stride in bytes for visual objects with data frame, 0 if unknown |
pixel_ar | set to the pixel aspect ratio as (PAR_NUM<<16)|PAR_DEN
|
pixelFormat | set to the pixel format of the video |
is_flipped | set to GF_TRUE if the pixels are vertically flipped (happens when reading back OpenGL textures) |
for_texture | if true check for texture dimensions otherwise for SRD dimensions |
void gf_mo_get_nb_views | ( | GF_MediaObject * | mo, |
u32 * | nb_views | ||
) |
gets number of views for 3D video object
mo | the target media object |
nb_views | set to the number of views in the object, vertically packed |
Bool gf_mo_get_audio_info | ( | GF_MediaObject * | mo, |
u32 * | sample_rate, | ||
u32 * | afmt, | ||
u32 * | num_channels, | ||
u64 * | channel_config, | ||
Bool * | forced_layout | ||
) |
gets visual information of a media object
mo | the target media object |
sample_rate | set to the sampling frequency of the object |
afmt | set to the decoded PCM audio format |
num_channels | set to the number of channels |
channel_config | set to the channel configuration |
forced_layout | set to GF_TRUE if the channel layout is forced (prevents recomputing the layout for mono/stereo setups) |
Fixed gf_mo_get_current_speed | ( | GF_MediaObject * | mo | ) |
gets current playback speed of a media object
mo | the target media object |
u32 gf_mo_has_audio | ( | GF_MediaObject * | mo | ) |
checks if the service associated withthis object has an audio stream
mo | the target media object |
void gf_mo_set_flag | ( | GF_MediaObject * | mo, |
GF_MOUserFlags | flag, | ||
Bool | set_on | ||
) |
sets flags on a media object
mo | the target media object |
flag | the flag(s) to adjust |
set_on | if GF_TRUE, set the flag(s), otherwise removes the flag(s) |
GF_MediaObject* gf_mo_load_xlink_resource | ( | GF_Node * | node, |
Bool | primary_resource, | ||
Double | clipBegin, | ||
Double | clipEnd | ||
) |
loads a new resource as indicated in the xlink:href attribute of the node. If this points to a fragment of the current document, returns NULL. This will automatically trigger a play request on the resource
node | node with xlink:href attribute to a media resource |
primary_resource | indicates if this is a primary resource (foreign object in SVG) |
clipBegin | the playback start time in seconds |
clipEnd | the playback end time in seconds |
void gf_mo_unload_xlink_resource | ( | GF_Node * | node, |
GF_MediaObject * | mo | ||
) |
unloads a media object associated with a given node through xlink:href
node | node with xlink:href attribute to the media resource |
mo | the target media object |
GF_SceneGraph* gf_mo_get_scenegraph | ( | GF_MediaObject * | mo | ) |
gets the scene graph associated with a scene/document object
mo | the target media object |
Bool gf_mo_get_srd_info | ( | GF_MediaObject * | mo, |
GF_MediaObjectVRInfo * | vr_info | ||
) |
gets SRD and VR info for a media object. Returns FALSE if no VR and no SRD info
mo | the target media object |
vr_info | set to the VR and SRD info of the media object |
void gf_mo_hint_quality_degradation | ( | GF_MediaObject * | mo, |
u32 | quality_degradation | ||
) |
sets quality degradation hint for a media object
mo | the target media object |
quality_degradation | quality hint value between 0 (max quality) and 100 (worst quality) |
sets visible rectangle for a media object, only used in 360 videos for now
mo | the target media object |
min_x | minimum horizontal coordinate of visible region, in pixel in the media frame (0 being left column) |
max_x | maximum horizontal coordinate of visible region, in pixel in the media frame (width being right column) |
min_y | minimum vertical coordinate of visible region, in pixel in the media frame (0 being top row) |
max_y | maximum vertical coordinate of visible region, in pixel in the media frame (height being bottom row) |
sets gaze position in a media object, only used in 360 videos for now
mo | the target media object |
gaze_x | minimum horizontal coordinate of visible region, in pixel in the media frame (0 being left column, width being right column) |
gaze_y | maximum horizontal coordinate of visible region, in pixel in the media frame (0 being top row, bottom row) |
void gf_mo_del | ( | GF_MediaObject * | mo | ) |
destroys a media object
mo | the target media object |
GF_DOMEventTarget* gf_mo_event_target_add_node | ( | GF_MediaObject * | mo, |
GF_Node * | node | ||
) |
adds event target node to a media object
mo | the target media object |
node | the event target node |
removes event target node from a media object
mo | the target media object |
node | the event target node |
u32 gf_mo_event_target_count | ( | GF_MediaObject * | mo | ) |
counts number of event targets associated with a media object
mo | the target media object |
removes event target node from a media object by index
mo | the target media object |
index | 0-based index of the event target to remove |
GF_DOMEventTarget* gf_mo_event_target_get | ( | GF_MediaObject * | mo, |
u32 | index | ||
) |
gets event target node of a media object by index
mo | the target media object |
index | 0-based index of the event target to get |
void gf_mo_event_target_reset | ( | GF_MediaObject * | mo | ) |
resets all event targets of a media object
mo | the target media object |
finds an even target interface of a media object associated to a given node
mo | the target media object |
node | the node associated with the event target |
enumerates event target nodes associated with a media object
mo | the target media object |
i | current index to query, incremented upon function return |
GF_Node* gf_event_target_get_node | ( | GF_DOMEventTarget * | target | ) |
gets the event target node of an event target interface
target | the target event target interface |