+++ /dev/null
-/*\r
- * GPAC - Multimedia Framework C SDK\r
- *\r
- * Copyright (c) Jean Le Feuvre 2000-2005\r
- * All rights reserved\r
- *\r
- * This file is part of GPAC / Scene Graph sub-project\r
- *\r
- * GPAC is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU Lesser General Public License as published by\r
- * the Free Software Foundation; either version 2, or (at your option)\r
- * any later version.\r
- * \r
- * GPAC is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; see the file COPYING. If not, write to\r
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
- *\r
- */\r
-\r
-\r
-\r
-#ifndef _GF_SCENEGRAPH_DEV_H_\r
-#define _GF_SCENEGRAPH_DEV_H_\r
-\r
-/*defined this macro to enable cyclic render*/\r
-#define GF_CYCLIC_TRAVERSE_ON\r
-\r
-/*defined this macro to enable scene replacement from inside (through conditional)*/\r
-//#define GF_SELF_REPLACE_ENABLE\r
-\r
-/*for vrml base types, ROUTEs and PROTOs*/\r
-#include <gpac/scenegraph_vrml.h>\r
-\r
-#include <gpac/scenegraph_svg.h>\r
-\r
-#ifdef GPAC_HAS_SPIDERMONKEY\r
-\r
-/*WIN32 and WinCE config (no configure script)*/\r
-#if defined(WIN32) || defined(_WIN32_WCE) || defined(__SYMBIAN32__)\r
-#ifndef XP_PC\r
-#define XP_PC\r
-#endif\r
-#ifndef XP_WIN\r
-#define XP_WIN\r
-#endif\r
-/*WINCE specific config*/\r
-#if defined(_WIN32_WCE)\r
-#include <windows.h>\r
-#define XP_WINCE\r
-#endif\r
-#endif\r
-\r
-/*other platforms should be setup through configure*/\r
-\r
-#endif\r
-\r
-\r
-void gf_node_setup(GF_Node *p, u32 tag);\r
-\r
-typedef struct _parent_list\r
-{\r
- struct _parent_list *next;\r
- GF_Node *node;\r
-} GF_ParentList;\r
-\r
-\r
-/*internal flag reserved for NodeID*/\r
-#define GF_NODE_IS_DEF 0x80000000 // 1<<31\r
-/*internal flag reserved for activate/deactivate*/\r
-#define GF_NODE_IS_DEACTIVATED 0x40000000 // 1<<30\r
-/*internal flag reserved for node with scripting bindings*/\r
-#define GF_NODE_HAS_BINDING 0x20000000 // 1<<29\r
-\r
-#ifdef GF_CYCLIC_TRAVERSE_ON\r
-#define GF_NODE_IN_TRAVERSE 0x10000000 // 1<<28\r
-#define GF_NODE_INTERNAL_FLAGS 0xF0000000\r
-#else\r
-#define GF_NODE_INTERNAL_FLAGS 0xE0000000\r
-#endif\r
-\r
-struct _node_interactive_ext\r
-{\r
- /*routes on eventOut, ISed routes, ... for VRML-based scene graphs\r
- THIS IS DYNAMICALLY CREATED*/\r
- GF_List *routes;\r
-\r
-#ifdef GPAC_HAS_SPIDERMONKEY\r
- /*JS bindings if any - THIS IS DYNAMICALLY CREATED\r
- This speeds up field modif notification (script bindings are listed here)*/\r
- GF_List *bindings;\r
-#endif\r
-\r
-#ifndef GPAC_DISABLE_SVG\r
- /*event listeners - THIS IS DYNAMICALLY CREATED*/\r
- GF_DOMEventTarget *dom_evt;\r
-\r
- /* SVG animations are registered in the target node - THIS IS DYNAMICALLY CREATED*/\r
- GF_List *animations;\r
-#endif\r
-\r
-};\r
-\r
-typedef struct _nodepriv\r
-{\r
- /*node type*/\r
- u16 tag;\r
- /*number of instances of this node in the graph*/\r
- u16 num_instances;\r
- /*node flags*/\r
- u32 flags;\r
- /*scenegraph holding the node*/\r
- struct __tag_scene_graph *scenegraph;\r
-\r
- /*user defined callback function */\r
- void (*UserCallback)(struct _base_node *node, void *render_stack, Bool node_destroy);\r
- /*user defined stack*/\r
- void *UserPrivate;\r
-\r
- /*list of all parent nodes (needed to invalidate parent tree)*/\r
- GF_ParentList *parents;\r
- \r
- /*holder for all interactive stuff - THIS IS DYNAMICALLY CREATED*/\r
- struct _node_interactive_ext *interact;\r
-} NodePriv;\r
-\r
-\r
-typedef struct __tag_node_id\r
-{\r
- struct __tag_node_id *next;\r
- GF_Node *node;\r
-\r
- /*node ID*/\r
- u32 NodeID;\r
- /*node def name*/\r
- char *NodeName;\r
-} NodeIDedItem;\r
-\r
-typedef struct\r
-{\r
- char *name;\r
- char *qname;\r
- u32 xmlns_id;\r
-} GF_XMLNS;\r
-\r
-struct __tag_scene_graph \r
-{\r
- /*used to discriminate between node and scenegraph*/\r
- u64 __reserved_null;\r
-\r
- /*all DEF nodes (explicit)*/\r
- NodeIDedItem *id_node, *id_node_last;\r
-\r
- /*all routes available*/\r
- GF_List *Routes;\r
-\r
- /*all routes available*/\r
- GF_List *exported_nodes;\r
-\r
- /*when a proto is instanciated it creates its own scene graph. BIFS/VRML specify that the namespace is the same \r
- (eg cannot reuse a NodeID or route name/ID), but this could be done differently by some other stds\r
- if NULL this is the main scenegraph*/\r
- struct _proto_instance *pOwningProto;\r
-\r
- /*all first-level protos of the graph (the only ones that can be instanciated in this graph)*/\r
- GF_List *protos;\r
- /*all first-level protos of the graph not currently registered - memory handling of graph only*/\r
- GF_List *unregistered_protos;\r
-\r
- /*pointer to the root node*/\r
- GF_Node *RootNode;\r
-\r
- /*routes to be activated (cascade model). This is used at the top-level graph only (eg\r
- proto routes use that too, ecept ISed fields). It is the app responsability to \r
- correctly connect or browse scene graphs connected through Inline*/\r
- GF_List *routes_to_activate;\r
-\r
- /*since events may trigger deletion of objects we use a 2 step delete*/\r
- GF_List *routes_to_destroy;\r
-\r
- u32 simulation_tick;\r
-\r
- /*user private data*/\r
- void *userpriv;\r
-\r
- /*callback routines*/\r
- /*node callback*/\r
- void (*NodeCallback)(void *user_priv, u32 type, GF_Node *node, void *ctxdata);\r
- /*real scene time callback*/\r
- Double (*GetSceneTime)(void *userpriv);\r
-\r
- GF_SceneGraph *(*GetExternProtoLib)(void *userpriv, MFURL *lib_url);\r
-\r
- /*parent scene if any*/\r
- struct __tag_scene_graph *parent_scene;\r
-\r
- /*size info and pixel metrics - this is not used internally, however it helps when rendering\r
- and decoding modules don't know each-other (as in MPEG4)*/\r
- u32 width, height;\r
- Bool usePixelMetrics;\r
-\r
- Bool modified;\r
-\r
- /*application interface for javascript*/\r
- gf_sg_script_action script_action;\r
- void *script_action_cbck;\r
-\r
- /*script loader*/\r
- void (*script_load)(GF_Node *node);\r
- /*callback to JS upon node modif*/\r
- void (*on_node_modified)(struct __tag_scene_graph *sg, GF_Node *node, GF_FieldInfo *info, GF_Node *script);\r
-\r
- u32 max_defined_route_id;\r
-\r
- /*namespaces list. This list is used while parsing/dumping the tree to store the hierarchy of xmlns attributes in subtrees.\r
- It is a stack of GF_XMLNS structures pushed/popped at each element*/\r
- GF_List *ns;\r
-\r
-#ifdef GF_SELF_REPLACE_ENABLE\r
- /*to detect replace scene from within conditionals*/\r
- Bool graph_has_been_reset;\r
-#endif\r
- /*global qp used in BIFS coding*/\r
- GF_Node *global_qp;\r
-\r
- /*use stack as used in the dom_fire_event - this is only valid during an event fire, and may be NULL*/\r
- GF_List *use_stack;\r
-\r
- /*temp storage for name conversions*/\r
- char szNameBuffer[100];\r
-\r
-#ifndef GPAC_DISABLE_SVG\r
- GF_DOMEventTarget dom_evt;\r
- u32 nb_evts_focus;\r
- u32 nb_evts_mouse;\r
- u32 nb_evts_key;\r
- u32 nb_evts_ui;\r
- u32 nb_evts_text;\r
- u32 nb_evts_smil;\r
- u32 nb_evts_mutation;\r
- u32 nb_evts_laser;\r
- u32 nb_evts_mae;\r
- u32 nb_evts_svg;\r
- u32 dom_evt_filter;\r
-\r
- GF_List *xlink_hrefs;\r
- GF_List *smil_timed_elements;\r
- GF_List *modified_smil_timed_elements;\r
- Bool update_smil_timing;\r
-\r
- /*listeners to add*/\r
- GF_List *listeners_to_add;\r
-\r
-#ifdef GPAC_HAS_SPIDERMONKEY\r
- struct __tag_svg_script_ctx *svg_js;\r
-#endif\r
-\r
-#endif\r
-\r
-#ifdef GPAC_HAS_SPIDERMONKEY\r
- GF_List *scripts;\r
- /*\r
- Note about reference counter\r
-\r
- A DOM document (<=> scenegraph) may be created through javascript, and the JS object having created the \r
- document may be destroyed while the document is still in use. Moreover with XMLHttpRequest, the\r
- "associated" doc is re-created at each request, but the script may still refer to the original document.\r
- Since the document doesn't have a fixed owner, a reference counter is use and the scenegraph is kept alive \r
- until the last object using it is destroyed.\r
-\r
- If this counter is set to 0 when creating DOM Elements/..., this means the scenegraph is hold by an external\r
- entity (typically the player), and cannot be destroyed from the scripting engine\r
- */\r
- u32 reference_count;\r
- /*DOM nodes*/\r
- GF_List *objects;\r
- /*DOM document*/\r
- struct JSObject *document;\r
-\r
- Bool dcci_doc;\r
-#endif\r
-};\r
-\r
-void gf_sg_parent_setup(GF_Node *pNode);\r
-void gf_sg_parent_reset(GF_Node *pNode);\r
-\r
-void *gf_node_get_name_address(GF_Node*node);\r
-\r
-void gf_node_changed_internal(GF_Node *node, GF_FieldInfo *field, Bool notify_scripts);\r
-\r
-struct _route\r
-{\r
- u8 is_setup;\r
- /*set to true for proto IS fields*/\r
- u8 IS_route;\r
-\r
- u32 ID;\r
- char *name;\r
-\r
- GF_Node *FromNode;\r
- GF_FieldInfo FromField;\r
-\r
- GF_Node *ToNode;\r
- GF_FieldInfo ToField;\r
-\r
- /*scope of this route*/\r
- GF_SceneGraph *graph;\r
- u32 lastActivateTime;\r
-};\r
-\r
-void gf_sg_route_unqueue(GF_SceneGraph *sg, GF_Route *r);\r
-/*returns TRUE if route modified destination node*/\r
-Bool gf_sg_route_activate(GF_Route *r);\r
-void gf_sg_route_queue(GF_SceneGraph *pSG, GF_Route *r);\r
-\r
-void gf_sg_destroy_routes(GF_SceneGraph *sg);\r
-\r
-void gf_sg_route_setup(GF_Route *r);\r
-\r
-\r
-/*MPEG4 def*/\r
-GF_Node *gf_sg_mpeg4_node_new(u32 NodeTag);\r
-u32 gf_sg_mpeg4_node_get_child_ndt(GF_Node *node);\r
-GF_Err gf_sg_mpeg4_node_get_field_index(GF_Node *node, u32 inField, u8 code_mode, u32 *fieldIndex);\r
-GF_Err gf_sg_mpeg4_node_get_field(GF_Node *node, GF_FieldInfo *field);\r
-u32 gf_sg_mpeg4_node_get_field_count(GF_Node *node, u8 code_mode);\r
-void gf_sg_mpeg4_node_del(GF_Node *node);\r
-const char *gf_sg_mpeg4_node_get_class_name(u32 NodeTag);\r
-Bool gf_sg_mpeg4_node_get_aq_info(GF_Node *node, u32 FieldIndex, u8 *QType, u8 *AType, Fixed *b_min, Fixed *b_max, u32 *QT13_bits);\r
-s32 gf_sg_mpeg4_node_get_field_index_by_name(GF_Node *node, char *name);\r
-\r
-/*X3D def*/\r
-GF_Node *gf_sg_x3d_node_new(u32 NodeTag);\r
-GF_Err gf_sg_x3d_node_get_field(GF_Node *node, GF_FieldInfo *field);\r
-u32 gf_sg_x3d_node_get_field_count(GF_Node *node);\r
-void gf_sg_x3d_node_del(GF_Node *node);\r
-const char *gf_sg_x3d_node_get_class_name(u32 NodeTag);\r
-s32 gf_sg_x3d_node_get_field_index_by_name(GF_Node *node, char *name);\r
-\r
-Bool gf_x3d_get_node_type(u32 NDT_Tag, u32 NodeTag);\r
-\r
-void gf_sg_mfint32_del(MFInt32 par);\r
-void gf_sg_mffloat_del(MFFloat par);\r
-void gf_sg_mfdouble_del(MFDouble par);\r
-void gf_sg_mfbool_del(MFBool par);\r
-void gf_sg_mfcolor_del(MFColor par);\r
-void gf_sg_mfcolor_rgba_del(MFColorRGBA par);\r
-void gf_sg_mfrotation_del(MFRotation par);\r
-void gf_sg_mfstring_del(MFString par);\r
-void gf_sg_mftime_del(MFTime par);\r
-void gf_sg_mfvec2f_del(MFVec2f par);\r
-void gf_sg_mfvec3f_del(MFVec3f par);\r
-void gf_sg_mfvec4f_del(MFVec4f par);\r
-void gf_sg_mfvec2d_del(MFVec2d par);\r
-void gf_sg_mfvec3d_del(MFVec3d par);\r
-void gf_sg_sfimage_del(SFImage im);\r
-void gf_sg_sfstring_del(SFString par);\r
-void gf_sg_mfscript_del(MFScript sc);\r
-void gf_sg_sfcommand_del(SFCommandBuffer cb);\r
-void gf_sg_sfurl_del(SFURL url);\r
-\r
-Bool gf_sg_vrml_node_init(GF_Node *node);\r
-Bool gf_sg_vrml_node_changed(GF_Node *node, GF_FieldInfo *field);\r
-\r
-\r
-/*specialized node unregister for Memory Commands - checks if the node(s) used in the command have been destroyed\r
-during the reset. If so don't attempt to unregister the node*/\r
-GF_Err gf_node_try_destroy(GF_SceneGraph *sg, GF_Node *pNode, GF_Node *parentNode);\r
-\r
-\r
-#ifndef GPAC_DISABLE_SVG\r
-\r
-\r
-/* reset functions for SVG types */\r
-void gf_svg_reset_path(SVG_PathData path);\r
-void gf_svg_reset_iri(GF_SceneGraph *sg, XMLRI*iri);\r
-/* delete functions for SVG types */\r
-void gf_svg_delete_paint (GF_SceneGraph *sg, SVG_Paint *paint);\r
-void gf_smil_delete_times (GF_List *l);\r
-void gf_svg_delete_points (GF_List *l);\r
-void gf_svg_delete_coordinates (GF_List *l);\r
-/*for keyTimes, keyPoints and keySplines*/\r
-void gf_smil_delete_key_types (GF_List *l);\r
-\r
-u32 gf_node_get_attribute_count(GF_Node *node);\r
-GF_Err gf_node_get_attribute_info(GF_Node *node, GF_FieldInfo *info) ;\r
-\r
-\r
-/*SMIL anim tools*/\r
-\r
-typedef struct __xlink_attrip_ptrs {\r
- XMLRI *href;\r
- SVG_ContentType *type;\r
- SVG_String *title;\r
- XMLRI *arcrole; \r
- XMLRI *role;\r
- SVG_String *show;\r
- SVG_String *actuate;\r
-} XLinkAttributesPointers;\r
-\r
-typedef struct __smil_time_attrip_ptrs {\r
- SMIL_Times *begin, *end;\r
- SVG_Clock *clipBegin, *clipEnd;\r
- SMIL_Duration *dur;\r
- SMIL_RepeatCount *repeatCount;\r
- SMIL_Duration *repeatDur;\r
- SMIL_Restart *restart;\r
- SMIL_Fill *fill;\r
- SMIL_Duration *max;\r
- SMIL_Duration *min;\r
- struct _smil_timing_rti *runtime; /* contains values for runtime handling of the SMIL timing */\r
-} SMILTimingAttributesPointers;\r
-\r
-typedef struct __smil_sync_attrip_ptrs {\r
- SMIL_SyncBehavior *syncBehavior, *syncBehaviorDefault;\r
- SMIL_SyncTolerance *syncTolerance, *syncToleranceDefault;\r
- SVG_Boolean *syncMaster;\r
- XMLRI *syncReference;\r
-} SMILSyncAttributesPointers;\r
-\r
-typedef struct __smil_anim_attrip_ptrs {\r
- SMIL_AttributeName *attributeName; \r
- SMIL_AttributeType *attributeType;\r
- SMIL_AnimateValue *to, *by, *from;\r
- SMIL_AnimateValues *values;\r
- SMIL_CalcMode *calcMode;\r
- SMIL_Accumulate *accumulate;\r
- SMIL_Additive *additive;\r
- SMIL_KeySplines *keySplines;\r
- SMIL_KeyTimes *keyTimes;\r
- SVG_TransformType *type;\r
- SVG_Boolean *lsr_enabled;\r
-\r
- SMIL_KeyPoints *keyPoints;\r
- SVG_String *origin;\r
- SVG_Rotate *rotate;\r
- SVG_PathData *path;\r
-} SMILAnimationAttributesPointers;\r
-\r
-\r
-typedef struct {\r
- GF_DOM_BASE_NODE\r
-\r
- /*shortcuts for xlink, anim, timing attributes*/\r
- XLinkAttributesPointers *xlinkp;\r
- SMILAnimationAttributesPointers *animp;\r
- SMILTimingAttributesPointers *timingp;\r
-} SVGTimedAnimBaseElement;\r
-\r
-GF_Err gf_node_animation_add(GF_Node *node, void *animation);\r
-GF_Err gf_node_animation_del(GF_Node *node);\r
-u32 gf_node_animation_count(GF_Node *node);\r
-void *gf_node_animation_get(GF_Node *node, u32 i);\r
-Bool gf_svg_is_inherit(GF_FieldInfo *a);\r
-Bool gf_svg_is_current_color(GF_FieldInfo *a);\r
-\r
-void gf_svg_reset_animate_values(SMIL_AnimateValues anim_values, GF_SceneGraph *sg);\r
-void gf_svg_reset_animate_value(SMIL_AnimateValue anim_value, GF_SceneGraph *sg);\r
-\r
-Bool gf_svg_is_timing_tag(u32 tag);\r
-Bool gf_svg_is_animation_tag(u32 tag);\r
-u32 gf_svg_get_modification_flags(SVG_Element *n, GF_FieldInfo *info);\r
-\r
-Bool gf_svg_resolve_smil_times(GF_Node *anim, void *event_base_element, GF_List *smil_times, Bool is_end, const char *node_name);\r
-\r
-\r
-/* SMIL Timing structures */\r
-/* status of an SMIL timed element */ \r
-enum {\r
- SMIL_STATUS_WAITING_TO_BEGIN = 0,\r
- SMIL_STATUS_ACTIVE,\r
- SMIL_STATUS_POST_ACTIVE,\r
- SMIL_STATUS_FROZEN,\r
- SMIL_STATUS_DONE\r
-};\r
-\r
-typedef struct {\r
- u32 activation_cycle;\r
- u32 nb_iterations;\r
-\r
- /* for the case where min > simple duration*/\r
- Bool min_active;\r
-\r
- /* negative values mean indefinite */\r
- Double begin, \r
- end,\r
- simple_duration, \r
- active_duration,\r
- repeat_duration;\r
-\r
-} SMIL_Interval;\r
-\r
-struct _smil_timing_rti\r
-{\r
- GF_Node *timed_elt;\r
- SMILTimingAttributesPointers *timingp;\r
-\r
- Double scene_time;\r
- Fixed normalized_simple_time;\r
- Bool force_reevaluation;\r
-\r
- /* SMIL element life-cycle status */\r
- u8 status;\r
-\r
- SMIL_Interval *current_interval;\r
- SMIL_Interval *next_interval;\r
-\r
- /* Evaluation of animations is postponed untill tree traversal, so that inherit values can be computed\r
- Other timed elements (audio, video, animation) are evaluated directly and do not require\r
- scene tree traversal.*/\r
- Bool postpone;\r
-\r
- void (*evaluate)(struct _smil_timing_rti *rti, Fixed normalized_simple_time, u32 state);\r
- u32 evaluate_status;\r
-\r
-#if 0\r
- /* is called only when the timed element is active */\r
- void (*activation)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);\r
-\r
- /* is called (possibly many times) when the timed element is frozen */\r
- void (*freeze)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);\r
-\r
- /* is called (only once) when the timed element is restored */\r
- void (*restore)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);\r
-\r
- /* is called only when the timed element is inactive and receives a fraction event, the second parameter is ignored */\r
- void (*fraction_activation)(struct _smil_timing_rti *rti, Fixed normalized_simple_time);\r
-#endif\r
- /* simulated normalized simple time */\r
- Fixed fraction;\r
-\r
- Bool paused;\r
- Double media_duration;\r
-\r
- /* shortcut when this rti corresponds to an animation */\r
- struct _smil_anim_rti *rai;\r
-};\r
-\r
-void gf_smil_timing_init_runtime_info(GF_Node *timed_elt);\r
-void gf_smil_timing_delete_runtime_info(GF_Node *timed_elt, SMIL_Timing_RTI *rti);\r
-Fixed gf_smil_timing_get_normalized_simple_time(SMIL_Timing_RTI *rti, Double scene_time, Bool *force_end);\r
-/*returns 1 if an animation changed a value in the rendering tree */\r
-s32 gf_smil_timing_notify_time(SMIL_Timing_RTI *rti, Double scene_time);\r
-\r
-\r
-/* SMIL Animation Structures */\r
-/* This structure is used per animated attribute,\r
- it contains:\r
- - all the animations applying to the same attribute,\r
- - the specified value before any inheritance has been applied nor any animation started \r
- (as specified in the SVG document),\r
- - the presentation value passed from one animation to the next one, at the same level in the tree\r
- - a boolean indicating if the animated attribute is in fact a property\r
- \r
- and if the attribute is a property:\r
- - a pointer to presentation value passed from the previous level in the tree\r
- - a pointer to the value of the color property (for handling of 'currentColor'), from previous level in the tree\r
- - the location of the attribute in the elt structure when it was created \r
- (used for fast comparison of SVG properties when animating from/to/by/values/... inherited values)\r
-*/\r
-typedef struct {\r
- GF_List *anims;\r
- GF_FieldInfo specified_value;\r
- GF_FieldInfo presentation_value;\r
- Bool is_property;\r
- GF_FieldInfo parent_presentation_value;\r
- GF_FieldInfo current_color_value;\r
- void *orig_dom_ptr;\r
- /* flag set by any animation to inform other animations that there base value has changed */\r
- Bool presentation_value_changed;\r
- /* flag used for rendering */\r
- u32 dirty_flags;\r
- Bool dirty_parents;\r
-} SMIL_AttributeAnimations;\r
-\r
-/* This structure is per animation element, \r
- it holds the result of the animation and \r
- some info to make animation computation faster */\r
-typedef struct _smil_anim_rti {\r
- SMIL_AttributeAnimations *owner;\r
-\r
- Bool is_first_anim;\r
-\r
- /* animation element */\r
- GF_Node *anim_elt;\r
- SMILAnimationAttributesPointers *animp;\r
- SMILTimingAttributesPointers *timingp;\r
- XLinkAttributesPointers *xlinkp;\r
-\r
- /* in case of animateTransform without from or to, the underlying value is the identity transform */\r
- GF_Matrix2D identity;\r
- GF_FieldInfo default_transform_value;\r
-\r
- /* result of the animation */\r
- GF_FieldInfo interpolated_value;\r
-\r
- /* last value of the animation, used in accumulation phase */\r
- /* normally the far pointer in the last specified value is a pointer to a real attribute value,\r
- and there's no need to allocate a new value. Except if the last specified value is the last \r
- point in a path (animateMotion) in which case we allocate a matrix as last spec value,\r
- which we need to delete (see animate-elem-202-t.svg). This is signaled if rai->path is not NULL*/\r
- GF_FieldInfo last_specified_value;\r
-\r
- /* temporary value needed when the type of \r
- the key values is different from the target attribute type */\r
- GF_FieldInfo tmp_value;\r
-\r
- /* the number of values in animations should be constant (unless updated with LASeR commands) \r
- we can store them to avoid computing them at each cycle */\r
- u32 values_count;\r
- u32 key_times_count;\r
- u32 key_points_count;\r
- u32 key_splines_count;\r
-\r
-\r
- /* In change detection mode, we test previous animation parameters to determine \r
- if a new evaluation of the animation will produce a different result. \r
- The result of these test is stored in interpolated_value_changed */\r
- Bool change_detection_mode;\r
- Bool interpolated_value_changed;\r
- s32 previous_key_index;\r
- u32 previous_keytime_index;\r
- Fixed previous_coef;\r
- s32 previous_iteration;\r
- Bool anim_done;\r
-\r
- GF_Path *path;\r
- u8 rotate;\r
- GF_PathIterator *path_iterator;\r
- Fixed length;\r
-\r
-} SMIL_Anim_RTI;\r
-\r
-void gf_smil_anim_init_node(GF_Node *node);\r
-void gf_smil_anim_init_discard(GF_Node *node);\r
-void gf_smil_anim_init_runtime_info(GF_Node *node);\r
-void gf_smil_anim_delete_runtime_info(SMIL_Anim_RTI *rai);\r
-void gf_smil_anim_delete_animations(GF_Node *e);\r
-void gf_smil_anim_remove_from_target(GF_Node *anim, GF_Node *target);\r
-\r
-void gf_sg_handle_dom_event(GF_Node *hdl, GF_DOM_Event *event, GF_Node *observer);\r
-void gf_smil_setup_events(GF_Node *node);\r
-\r
-void gf_smil_anim_reset_variables(SMIL_Anim_RTI *rai);\r
-void gf_smil_anim_set_anim_runtime_in_timing(GF_Node *n);\r
-\r
-void gf_smil_timing_pause(GF_Node *node);\r
-void gf_smil_timing_resume(GF_Node *node);\r
-\r
-#endif\r
-\r
-\r
-//\r
-// MF Fields tools\r
-// WARNING: MF / SF Nodes CANNOT USE THESE FUNCTIONS\r
-//\r
-\r
-//return the size (in bytes) of fixed fields (buffers are handled as a char ptr , 1 byte)\r
-u32 gf_sg_vrml_get_sf_size(u32 FieldType);\r
-\r
-\r
-/*BASE node (GF_Node) destructor*/\r
-void gf_node_free(GF_Node *node);\r
-\r
-/*node destructor dispatcher: redirects destruction for each graph type: VRML/MPEG4, X3D, SVG...)*/\r
-void gf_node_del(GF_Node *node);\r
-\r
-/*creates an undefined GF_Node - for parsing only*/\r
-GF_Node *gf_sg_new_base_node();\r
-\r
-/*returns field type from its name*/\r
-u32 gf_sg_field_type_by_name(char *fieldType);\r
-\r
-\r
-\r
-/*\r
- Proto node\r
-\r
-*/\r
-\r
-/*field interface to codec. This is used to do the node decoding, index translation\r
-and all QP/BIFS Anim parsing. */\r
-struct _protofield\r
-{\r
- u8 EventType;\r
- u8 FieldType;\r
- /*if UseName, otherwise fieldN*/\r
- char *FieldName;\r
-\r
- /*default field value*/\r
- void *def_value;\r
- \r
- GF_Node *def_sfnode_value;\r
- GF_ChildNodeItem *def_mfnode_value;\r
-\r
- /*coding indexes*/\r
- u32 IN_index, OUT_index, DEF_index, ALL_index;\r
-\r
- /*Quantization*/\r
- u32 QP_Type, hasMinMax;\r
- void *qp_min_value, *qp_max_value;\r
- /*this is for QP=13 only*/\r
- u32 NumBits;\r
-\r
- /*Animation*/\r
- u32 Anim_Type;\r
-\r
- void *userpriv;\r
- void (*OnDelete)(void *ptr);\r
-};\r
-\r
-GF_ProtoFieldInterface *gf_sg_proto_new_field_interface(u32 FieldType);\r
-\r
-/*set QP and anim info for a proto field (BIFS allows for that in proto coding)*/\r
-GF_Err gf_bifs_proto_field_set_aq_info(GF_ProtoFieldInterface *field, u32 QP_Type, u32 hasMinMax, u32 QPSFType, void *qp_min_value, void *qp_max_value, u32 QP13_NumBits);\r
-\r
-/*proto field instance. since it is useless to duplicate all coding info, names and the like\r
-we seperate proto declaration and proto instanciation*/\r
-typedef struct \r
-{\r
- u8 EventType;\r
- u8 FieldType;\r
- u8 has_been_accessed;\r
- void *field_pointer;\r
-} GF_ProtoField;\r
-\r
-\r
-struct _proto\r
-{\r
- /*1 - Prototype interface*/\r
- u32 ID;\r
- char *Name;\r
- GF_List *proto_fields;\r
-\r
- /*pointer to parent scene graph*/\r
- struct __tag_scene_graph *parent_graph;\r
- /*pointer to proto scene graph*/\r
- struct __tag_scene_graph *sub_graph;\r
-\r
- /*2 - proto implementation as declared in the bitstream*/\r
- GF_List *node_code;\r
-\r
- /*num fields*/\r
- u32 NumIn, NumOut, NumDef, NumDyn;\r
-\r
- void *userpriv;\r
- void (*OnDelete)(void *ptr);\r
-\r
- /*URL of extern proto lib (if none, URL is empty)*/\r
- MFURL ExternProto;\r
-\r
- /*list of instances*/\r
- GF_List *instances;\r
-};\r
-\r
-/*proto field API*/\r
-u32 gf_sg_proto_get_num_fields(GF_Node *node, u8 code_mode);\r
-GF_Err gf_sg_proto_get_field(GF_Proto *proto, GF_Node *node, GF_FieldInfo *field);\r
-\r
-\r
-typedef struct _proto_instance\r
-{\r
- /*this is a node*/\r
- BASE_NODE\r
-\r
- /*Prototype interface for coding and field addressing*/\r
- GF_Proto *proto_interface;\r
-\r
- /*proto implementation at run-time (aka the state of the nodes may differ accross\r
- different instances of the proto)*/\r
- GF_List *fields;\r
-\r
- /*a proto doesn't have one root SFnode but a collection of nodes for implementation*/\r
- GF_List *node_code;\r
-\r
- /*node for proto rendering, first of all declared nodes*/\r
- GF_Node *RenderingNode;\r
-\r
- /*in case the PROTO is destroyed*/\r
- char *proto_name;\r
-\r
- /*scripts are loaded once all IS routes are activated and node code is loaded*/\r
- GF_List *scripts_to_load;\r
-\r
- Bool is_loaded;\r
-} GF_ProtoInstance;\r
-\r
-/*destroy proto*/\r
-void gf_sg_proto_del_instance(GF_ProtoInstance *inst);\r
-GF_Err gf_sg_proto_get_field_index(GF_ProtoInstance *proto, u32 index, u32 code_mode, u32 *all_index);\r
-Bool gf_sg_proto_get_aq_info(GF_Node *Node, u32 FieldIndex, u8 *QType, u8 *AType, Fixed *b_min, Fixed *b_max, u32 *QT13_bits);\r
-GF_Err gf_sg_proto_get_field_ind_static(GF_Node *Node, u32 inField, u8 IndexMode, u32 *allField);\r
-GF_Node *gf_sg_proto_create_node(GF_SceneGraph *scene, GF_Proto *proto, GF_ProtoInstance *from_inst);\r
-void gf_sg_proto_instanciate(GF_ProtoInstance *proto_node);\r
-\r
-/*get tag of first node in proto code - used for validation only*/\r
-u32 gf_sg_proto_get_root_tag(GF_Proto *proto);\r
-\r
-\r
-/*to call when a proto field has been modified (at creation or through commands, modifications through events \r
-are handled internally).\r
-node can be the proto instance or a node from the proto code\r
-this will call NodeChanged if needed, forward to proto/node or trigger any route if needed*/\r
-void gf_sg_proto_propagate_event(GF_Node *node, u32 fieldIndex, GF_Node *from_node);\r
-\r
-s32 gf_sg_proto_get_field_index_by_name(GF_Proto *proto, GF_Node *node, char *name);\r
-\r
-GF_Node *gf_vrml_node_clone(GF_SceneGraph *inScene, GF_Node *orig, GF_Node *cloned_parent, char *inst_id_suffix);\r
-\r
-\r
-/*\r
- Script node\r
-*/\r
-\r
-typedef struct \r
-{\r
- //extra script fields\r
- GF_List *fields;\r
-\r
- //BIFS coding stuff\r
- u32 numIn, numDef, numOut;\r
-\r
-#ifdef GPAC_HAS_SPIDERMONKEY\r
- struct JSContext *js_ctx;\r
- struct JSObject *js_obj;\r
- struct JSObject *js_browser;\r
- /*all attached objects (eg, not created by the script) are stored here so that we don't\r
- allocate them again and again when getting properties. Garbage collection is performed (if needed)\r
- on these objects after each eventIn execution*/\r
- GF_List *js_cache;\r
- struct JSObject *event;\r
-#endif\r
-\r
- void (*JS_PreDestroy)(GF_Node *node);\r
- void (*JS_EventIn)(GF_Node *node, GF_FieldInfo *in_field);\r
-\r
- Bool is_loaded;\r
-} GF_ScriptPriv;\r
-\r
-/*setup script stack*/\r
-void gf_sg_script_init(GF_Node *node);\r
-/*get script field*/\r
-GF_Err gf_sg_script_get_field(GF_Node *node, GF_FieldInfo *info);\r
-/*get effective field count per event mode*/\r
-u32 gf_sg_script_get_num_fields(GF_Node *node, u8 IndexMode);\r
-/*translate field index from inMode to ALL mode*/\r
-GF_Err gf_sg_script_get_field_index(GF_Node *Node, u32 inField, u8 IndexMode, u32 *allField);\r
-/*create dynamic fields in the clone*/\r
-GF_Err gf_sg_script_prepare_clone(GF_Node *dest, GF_Node *orig);\r
-\r
-struct _scriptfield\r
-{\r
- u32 eventType;\r
- u32 fieldType;\r
- char *name;\r
-\r
- s32 IN_index, OUT_index, DEF_index;\r
- u32 ALL_index;\r
-\r
- //real field\r
- void *pField;\r
-\r
- Double last_route_time;\r
- Bool activate_event_out;\r
-};\r
-\r
-\r
-#ifdef GPAC_HAS_SPIDERMONKEY\r
-\r
-\r
-#include <gpac/download.h>\r
-#include <gpac/network.h>\r
-\r
-\r
-#define JS_SETUP_CLASS(the_class, cname, flag, getp, setp, fin) \\r
- memset(&the_class, 0, sizeof(the_class)); \\r
- the_class.name = cname; \\r
- the_class.flags = flag; \\r
- the_class.addProperty = JS_PropertyStub; \\r
- the_class.delProperty = JS_PropertyStub; \\r
- the_class.getProperty = getp; \\r
- the_class.setProperty = setp; \\r
- the_class.enumerate = JS_EnumerateStub; \\r
- the_class.resolve = JS_ResolveStub; \\r
- the_class.convert = JS_ConvertStub; \\r
- the_class.finalize = fin; \\r
- the_class.hasInstance = js_has_instance;\r
-\r
-typedef struct\r
-{\r
- GF_Node *node;\r
- GF_DownloadSession *sess;\r
-} JSFileDownload;\r
-\r
-struct JSContext *gf_sg_ecmascript_new(GF_SceneGraph *sg);\r
-void gf_sg_ecmascript_del(struct JSContext *);\r
-\r
-void gf_sg_script_init_sm_api(GF_ScriptPriv *sc, GF_Node *script);\r
-\r
-typedef struct \r
-{\r
- GF_FieldInfo field;\r
- GF_Node *owner;\r
- struct JSObject *obj;\r
-\r
- /*JS list for MFFields or NULL*/\r
- struct JSObject *js_list;\r
-\r
- /*when creating SFnode from inside the script, the node is stored here untill attached to an object*/\r
- GF_Node *temp_node;\r
- /*when creating MFnode from inside the script, the node list is stored here untill attached to an object*/\r
- GF_ChildNodeItem *temp_list;\r
- /*when not owned by a node*/\r
- void *field_ptr;\r
- \r
- /*cpontext in which the field was created*/\r
- struct JSContext *js_ctx;\r
-} GF_JSField;\r
-\r
-#ifndef GPAC_DISABLE_SVG\r
-void JSScript_LoadSVG(GF_Node *node);\r
-\r
-typedef struct __tag_svg_script_ctx \r
-{\r
- Bool (*script_execute)(struct __tag_scene_graph *sg, char *utf8_script, GF_DOM_Event *event);\r
- Bool (*handler_execute)(GF_Node *n, GF_DOM_Event *event, GF_Node *observer);\r
- u32 nb_scripts;\r
- /*global script context for the scene*/\r
- struct JSContext *js_ctx;\r
- /*global object*/\r
- struct JSObject *global;\r
- /*global event object - used to update the associated DOMEvent (JS private stack) when dispatching events*/\r
- struct JSObject *event;\r
-} GF_SVGJS;\r
-\r
-#endif /*GPAC_DISABLE_SVG*/\r
-\r
-/*initialize DOM Core (subset) + xmlHTTPRequest API. The global object MUST have private data storage\r
-and its private data MUST be a scenegraph. This scenegraph is only used to create new documents\r
-and setup the callback pointers*/\r
-void dom_js_load(GF_SceneGraph *scene, struct JSContext *c, struct JSObject *global);\r
-/*unloads the DOM core support (to be called upon destruction only, once the JSContext has been destroyed\r
-to releases all resources used by DOM JS)*/\r
-void dom_js_unload();\r
-\r
-/*defines a new global object "document" of type Document*/\r
-void dom_js_define_document(struct JSContext *c, struct JSObject *global, GF_SceneGraph *doc);\r
-/*defines a new global object "evt" of type Event*/\r
-struct JSObject *dom_js_define_event(struct JSContext *c, struct JSObject *global);\r
-\r
-struct JSObject *gf_dom_new_event(struct JSContext *c);\r
-\r
-struct JSObject *dom_js_get_node_proto(struct JSContext *c);\r
-struct JSObject *dom_js_get_element_proto(struct JSContext *c);\r
-struct JSObject *dom_js_get_document_proto(struct JSContext *c);\r
-struct JSObject *dom_js_get_event_proto(struct JSContext *c);\r
-\r
-void dom_set_class_selector(struct JSContext *c, /*struct JSClass*/void *(*get_element_class)(GF_Node *n), /*struct JSClass*/void *(*get_document_class)(GF_SceneGraph *n) );\r
-\r
-enum\r
-{\r
- GF_DOM_EXC_INDEX_SIZE_ERR = 1,\r
- GF_DOM_EXC_DOMSTRING_SIZE_ERR = 2,\r
- GF_DOM_EXC_HIERARCHY_REQUEST_ERR = 3,\r
- GF_DOM_EXC_WRONG_DOCUMENT_ERR = 4,\r
- GF_DOM_EXC_INVALID_CHARACTER_ERR = 5,\r
- GF_DOM_EXC_NO_DATA_ALLOWED_ERR = 6,\r
- GF_DOM_EXC_NO_MODIFICATION_ALLOWED_ERR = 7,\r
- GF_DOM_EXC_NOT_FOUND_ERR = 8,\r
- GF_DOM_EXC_NOT_SUPPORTED_ERR = 9,\r
- GF_DOM_EXC_INUSE_ATTRIBUTE_ERR = 10,\r
- GF_DOM_EXC_INVALID_STATE_ERR = 11,\r
- GF_DOM_EXC_SYNTAX_ERR = 12,\r
- GF_DOM_EXC_INVALID_MODIFICATION_ERR = 13,\r
- GF_DOM_EXC_NAMESPACE_ERR = 14,\r
- GF_DOM_EXC_INVALID_ACCESS_ERR = 15,\r
- GF_DOM_EXC_VALIDATION_ERR = 16,\r
- GF_DOM_EXC_TYPE_MISMATCH_ERR = 17,\r
-};\r
-\r
-int dom_throw_exception(struct JSContext *c, u32 code);\r
-\r
-void gf_sg_handle_dom_event_for_vrml(GF_Node *hdl, GF_DOM_Event *event, GF_Node *observer);\r
-\r
-void gf_sg_load_script_extensions(GF_SceneGraph *sg, struct JSContext *c, struct JSObject *obj, Bool unload);\r
-\r
-#endif /*GPAC_HAS_SPIDERMONKEY*/\r
-\r
-GF_Err gf_sg_reload_xml_doc(const char *src, GF_SceneGraph *scene);\r
-\r
-SVG_Element *gf_svg_create_node(u32 tag);\r
-Bool gf_svg_node_init(GF_Node *node);\r
-void gf_svg_node_del(GF_Node *node);\r
-Bool gf_svg_node_changed(GF_Node *node, GF_FieldInfo *field);\r
-const char *gf_xml_get_element_name(GF_Node *node);\r
-\r
-SVGAttribute *gf_node_create_attribute_from_datatype(u32 data_type, u32 attribute_tag);\r
-\r
-GF_Err gf_node_get_attribute_by_name(GF_Node *node, char *name, u32 xmlns_code, Bool create_if_not_found, Bool set_default, GF_FieldInfo *field);\r
-void *gf_svg_get_property_pointer_from_tag(SVGPropertiesPointers *output_property_context, u32 prop_tag);\r
-void *gf_svg_get_property_pointer(SVG_Element *elt, void *input_attribute,\r
- SVGPropertiesPointers *output_property_context);\r
-\r
-Bool gf_svg_is_property(GF_Node *node, GF_FieldInfo *target_attribute);\r
-\r
-/*exported for LASeR paring*/\r
-u32 svg_parse_point(SVG_Point *p, char *value_string);\r
-\r
-/*activates node. This is used by LASeR:activate and whenever a node is inserted in the scene\r
-through DOM*/\r
-GF_Err gf_node_activate(GF_Node *node);\r
-/*deactivates node. This is used by LASeR:deactivate and whenever a node is removed from the scene\r
-through DOM*/\r
-GF_Err gf_node_deactivate(GF_Node *node);\r
-\r
-/*post a listener to be added - this is only used by LASeR:activate and DOM.addEventListener. This \r
-is to ensure that when a node is processing an event creating a new listener on this node, this listener\r
-will not be triggered*/\r
-void gf_dom_listener_post_add(GF_Node *obs, GF_Node *listener);\r
-/*process all pending add_listener request*/\r
-void gf_dom_listener_process_add(GF_SceneGraph *sg);\r
-\r
-\r
-void gf_node_delete_attributes(GF_Node *node);\r
-\r
-\r
-typedef GF_DOMNode XBL_Element;\r
-const char *gf_xbl_get_element_name(u32 tag);\r
-u32 gf_xbl_get_element_tag(const char *element_name);\r
-XBL_Element *gf_xbl_create_node(u32 ElementTag);\r
-u32 gf_xbl_get_attribute_tag(u32 element_tag, const char *attribute_name);\r
-GF_DOMAttribute *gf_xbl_create_attribute(GF_DOMNode *elt, u32 tag);\r
-\r
-\r
-GF_Node *gf_xml_node_clone(GF_SceneGraph *inScene, GF_Node *orig, GF_Node *cloned_parent, char *inst_id, Bool deep);\r
-\r
-GF_Err gf_dom_listener_del(GF_Node *listener, GF_DOMEventTarget *target);\r
-\r
-GF_DOMHandler *gf_dom_listener_build_ex(GF_Node *node, u32 event_type, u32 event_parameter, GF_Node *handler, GF_Node **out_listener);\r
-\r
-\r
-#endif /*_GF_SCENEGRAPH_DEV_H_*/\r
-\r