+++ /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 / Authoring Tools 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
-#ifndef _GF_SCENE_MANAGER_H_\r
-#define _GF_SCENE_MANAGER_H_\r
-\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#include <gpac/isomedia.h>\r
-#include <gpac/scenegraph_vrml.h>\r
-\r
-/*\r
- Memory scene management\r
-\r
-*/\r
-\r
-/*NDT check - return 1 if node belongs to given NDT. Handles proto, and assumes undefined nodes\r
-always belong to the desired NDT*/\r
-Bool gf_node_in_table(GF_Node *node, u32 NDTType);\r
-\r
-/*generic systems access unit context*/\r
-typedef struct\r
-{ \r
- /*AU timing in TimeStampResolution*/\r
- u64 timing;\r
- /*timing in sec - used if timing isn't set*/\r
- Double timing_sec;\r
- /*random access indication - may be overriden by encoder*/\r
- Bool is_rap;\r
- /*opaque command list per stream type*/\r
- GF_List *commands;\r
-\r
- /*pointer to owner stream*/\r
- struct _stream_context *owner;\r
-} GF_AUContext;\r
-\r
-/*generic stream context*/\r
-typedef struct _stream_context\r
-{\r
- /*ESID of stream, or 0 if unknown in which case it is automatically updated at encode stage*/\r
- u16 ESID;\r
- /*stream type - used as a hint, the encoder(s) may override it*/\r
- u8 streamType;\r
- u8 objectType;\r
- u32 timeScale;\r
- GF_List *AUs;\r
-\r
- u64 dump_time_offset;\r
- /*last stream AU time, when playing the context directly*/\r
- u64 last_au_time;\r
- /*set if stream is part of root OD (playback only)*/\r
- Bool in_root_od;\r
-} GF_StreamContext;\r
-\r
-/*generic presentation context*/\r
-typedef struct \r
-{\r
- /*the one and only scene graph used by the scene manager.*/\r
- GF_SceneGraph *scene_graph;\r
-\r
- /*all systems streams used in presentation*/\r
- GF_List *streams;\r
- /*(initial) object descriptor if any - if not set the encoder will generate it*/\r
- GF_ObjectDescriptor *root_od;\r
-\r
- /*scene resolution*/\r
- u32 scene_width, scene_height;\r
- Bool is_pixel_metrics;\r
-\r
- /*BIFS encoding - these is needed for:\r
- - protos in protos which define subscene graph, hence seperate namespace, but are coded with the same IDs\r
- - route insertions which are not tracked by the scene graph\r
- we could do this by hand (counting protos & route insert) but let's be lazy\r
- */\r
- u32 max_node_id, max_route_id, max_proto_id;\r
-} GF_SceneManager;\r
-\r
-/*scene manager constructor - @scene_graph: scene graph used by the manager. */\r
-GF_SceneManager *gf_sm_new(GF_SceneGraph *scene_graph);\r
-/*scene manager destructor - does not destroy the attached scene graph*/\r
-void gf_sm_del(GF_SceneManager *ctx);\r
-/*retrive or create a stream context in the presentation context\r
-WARNING: if a stream with the same streamType and no ESID already exists in the context, \r
-it is assigned the requested ES_ID - this is needed to solve base layer*/\r
-GF_StreamContext *gf_sm_stream_new(GF_SceneManager *ctx, u16 ES_ID, u8 streamType, u8 objectType);\r
-/*removes and destroy stream context from presentation context*/\r
-void gf_sm_stream_del(GF_SceneManager *ctx, GF_StreamContext *sc);\r
-/*locate a stream based on its id*/\r
-GF_StreamContext *gf_sm_stream_find(GF_SceneManager *ctx, u16 ES_ID);\r
-/*create a new AU context in the given stream context*/\r
-GF_AUContext *gf_sm_stream_au_new(GF_StreamContext *stream, u64 timing, Double time_ms, Bool isRap);\r
-\r
-/*reset the context: \r
-- purge all access units on all streams \r
-- destroy root OD\r
-*/\r
-void gf_sm_reset(GF_SceneManager *ctx);\r
-\r
-/*applies all commands in all streams (only BIFS for now): the context manager will only have one command per\r
-stream, this command being a random access*/\r
-GF_Err gf_sm_make_random_access(GF_SceneManager *ctx);\r
-\r
-/*translates SRT/SUB (TTXT not supported) source into BIFS command stream source\r
- @src: GF_ESD of new stream (MUST be created before to store TS resolution)\r
- @mux: GF_MuxInfo of src stream - shall contain a valid file, and at least the textNode member set\r
-*/\r
-GF_Err gf_sm_import_bifs_subtitle(GF_SceneManager *ctx, GF_ESD *src, GF_MuxInfo *mux);\r
-\r
-\r
-/*SWF to MPEG-4 flags*/\r
-enum\r
-{\r
- /*all data in dictionary is in first frame*/\r
- GF_SM_SWF_STATIC_DICT = 1,\r
- /*remove all text*/\r
- GF_SM_SWF_NO_TEXT = (1<<1),\r
- /*remove embedded fonts (force device font usage)*/\r
- GF_SM_SWF_NO_FONT = (1<<2),\r
- /*forces XCurve2D which supports quadratic bezier*/\r
- GF_SM_SWF_QUAD_CURVE = (1<<3),\r
- /*forces line remove*/\r
- GF_SM_SWF_NO_LINE = (1<<4),\r
- /*forces XLineProperties (supports scalable lines)*/\r
- GF_SM_SWF_SCALABLE_LINE = (1<<5),\r
- /*forces gradient remove (using center color) */\r
- GF_SM_SWF_NO_GRADIENT = (1<<6),\r
- /*use a dedicated BIFS stream to control display list. This allows positioning in the movie\r
- (jump to frame, etc..) as well as looping from inside the movie (set by default)*/\r
- GF_SM_SWF_SPLIT_TIMELINE = (1<<7),\r
- /*enable appearance reuse*/\r
- GF_SM_SWF_REUSE_APPEARANCE = (1<<9),\r
- /*enable IndexedCurve2D proto*/\r
- GF_SM_SWF_USE_IC2D = (1<<10),\r
-};\r
-\r
-/*general loader flags*/\r
-enum\r
-{\r
- /*if set, always load MPEG-4 nodes, otherwise X3D versions are used for vrml/x3d*/\r
- GF_SM_LOAD_MPEG4_STRICT = 1,\r
- /*signal loading is done for playback: \r
- scrips will be queued in their parent command for later loading\r
- SFTime (MPEG-4 only) fields will be handled correctly when inserting/creating nodes based on AU timing\r
- */\r
- GF_SM_LOAD_FOR_PLAYBACK = 1<<1,\r
-\r
- /*special flag indicating that the context is already loaded & valid (eg no default stream creations & co)\r
- this is used when performing diff encoding (eg the file to load only has updates).\r
- When set, gf_sm_load_init will NOT attempt to parse first frame*/\r
- GF_SM_LOAD_CONTEXT_READY = 1<<2,\r
-\r
- /* in this mode, each root svg tag will be interpreted as a REPLACE SCENE */\r
- GF_SM_LOAD_CONTEXT_STREAMING = 1<<3,\r
-};\r
-\r
-/*loader type, usually detected based on file ext*/\r
-enum\r
-{ \r
- GF_SM_LOAD_BT = 1, /*BT loader*/\r
- GF_SM_LOAD_VRML, /*VRML97 loader*/\r
- GF_SM_LOAD_X3DV, /*X3D VRML loader*/\r
- GF_SM_LOAD_XMTA, /*XMT-A loader*/\r
- GF_SM_LOAD_X3D, /*X3D XML loader*/\r
- GF_SM_LOAD_SVG_DA, /*SVG loader with dynamic allocation of attributes */\r
- GF_SM_LOAD_XSR, /*LASeR+XML loader*/\r
- GF_SM_LOAD_DIMS, /*DIMS LASeR+XML loader*/\r
- GF_SM_LOAD_SWF, /*SWF->MPEG-4 converter*/\r
- GF_SM_LOAD_QT, /*MOV->MPEG-4 converter (only cubic QTVR for now)*/\r
- GF_SM_LOAD_MP4, /*MP4 memory loader*/\r
- GF_SM_LOAD_XBL\r
-};\r
-\r
-typedef struct\r
-{\r
- /*scene graph worked on - may be NULL if ctx is present*/\r
- GF_SceneGraph *scene_graph;\r
-\r
- struct _inline_scene *is;\r
-\r
- /*context manager to load (MUST BE RESETED BEFORE if needed) - may be NULL for loaders not using commands, \r
- in which case the graph will be directly updated*/\r
- GF_SceneManager *ctx;\r
- /*file to import except IsoMedia files*/\r
- const char *fileName;\r
- /*IsoMedia file to import (we need to be able to load from an opened file for scene stats)*/\r
- GF_ISOFile *isom;\r
- /*swf import flags*/\r
- u32 swf_import_flags;\r
- /*swf flatten limit: angle limit below which 2 lines are considered as aligned, \r
- in which case the lines are merged as one. If 0, no flattening happens*/\r
- Float swf_flatten_limit;\r
- /*swf extraction path: if set, swf media (mp3, jpeg) are extracted to this path. If not set\r
- media are extracted to original file directory*/\r
- const char *localPath;\r
-\r
- /*loader flags*/\r
- u32 flags;\r
-\r
- /*private to loader*/\r
- void *loader_priv;\r
- /*loader type, one of the above value. If not set, detected based on file extension*/\r
- u32 type;\r
-} GF_SceneLoader;\r
-\r
-/*initializes the context loader - this will load any IOD and the first frame of the main scene*/\r
-GF_Err gf_sm_load_init(GF_SceneLoader *load);\r
-/*completely loads context*/\r
-GF_Err gf_sm_load_run(GF_SceneLoader *load);\r
-/*terminates the context loader*/\r
-void gf_sm_load_done(GF_SceneLoader *load);\r
-\r
-/*parses memory scene (any textural format) into the context\r
-!! THE LOADER TYPE MUST BE ASSIGNED (BT/WRL/XMT/X3D/SVG only) !!\r
-The string MUST be at least 4 bytes long in order to detect BOM (unicode encoding). \r
-The string can ba either UTF-8 or UTF-16 data\r
-if clean_at_end is set, associated parser is destroyed. Otherwise, a call to gf_sm_load_done must be done \r
-to clean ressources (needed for SAX progressive loading)\r
-*/\r
-GF_Err gf_sm_load_string(GF_SceneLoader *load, char *str, Bool clean_at_end);\r
-\r
-\r
-/*scene dump mode*/\r
-enum\r
-{\r
- /*BT*/\r
- GF_SM_DUMP_BT = 0,\r
- /*XMT-A*/\r
- GF_SM_DUMP_XMTA,\r
- /*VRML Text (WRL)*/\r
- GF_SM_DUMP_VRML,\r
- /*X3D Text (x3dv)*/\r
- GF_SM_DUMP_X3D_VRML,\r
- /*X3D XML*/\r
- GF_SM_DUMP_X3D_XML,\r
- /*LASeR XML*/\r
- GF_SM_DUMP_LASER,\r
- /*SVG dump (only dumps svg root of the first LASeR unit*/\r
- GF_SM_DUMP_SVG,\r
- /*blind XML dump*/\r
- GF_SM_DUMP_XML,\r
- /*automatic selection of MPEG4 vs X3D, text mode*/\r
- GF_SM_DUMP_AUTO_TXT,\r
- /*automatic selection of MPEG4 vs X3D, xml mode*/\r
- GF_SM_DUMP_AUTO_XML,\r
-};\r
-\r
-#ifndef GPAC_READ_ONLY\r
-\r
-/*dumps scene context to BT or XMT\r
-@rad_name: file name & loc without extension - if NULL dump will happen in stdout\r
-@dump_mode: one of the above*/\r
-GF_Err gf_sm_dump(GF_SceneManager *ctx, char *rad_name, u32 dump_mode);\r
-\r
-#endif\r
-\r
-\r
-/*encoding flags*/\r
-enum\r
-{\r
- /*if flag set, DEF names are encoded*/\r
- GF_SM_ENCODE_USE_NAMES = 1,\r
- /*if flag set, RAP are generated inband rather than as redundant samples*/\r
- GF_SM_ENCODE_RAP_INBAND = 2,\r
- /*if flag set, RAP are generated inband rather than as sync shadow samples*/\r
- GF_SM_ENCODE_RAP_SHADOW = 4,\r
-};\r
-\r
-typedef struct\r
-{\r
- /*encoding flags*/\r
- u32 flags;\r
- /*delay between 2 RAP in ms. If 0 RAPs are not forced - BIFS and LASeR only for now*/\r
- u32 rap_freq;\r
- /*if set, any unknown stream in the scene will be looked for in @mediaSource (MP4 only)*/\r
- char *mediaSource;\r
- /*LASeR */\r
- /*resolution*/\r
- s32 resolution;\r
- /*coordBits, scaleBits*/\r
- u32 coord_bits, scale_bits;\r
- /*auto quantification type:\r
- 0: none\r
- 1: LASeR\r
- 2: BIFS\r
- */\r
- u32 auto_quant;\r
-} GF_SMEncodeOptions;\r
-\r
-/*\r
-encodes scene context into @mp4.\r
-if @log is set, generates BIFS encoder log file\r
-*/\r
-GF_Err gf_sm_encode_to_file(GF_SceneManager *ctx, GF_ISOFile *mp4, GF_SMEncodeOptions *opt);\r
-\r
-/*Dumping tools*/\r
-typedef struct _scenedump GF_SceneDumper;\r
-/*create a scene dumper \r
-@graph: scene graph being dumped\r
-@rad_name: file radical (NULL for stdout) - if not NULL MUST BE GF_MAX_PATH length\r
-@indent_char: indent format\r
-@XMLDump: if set, dumps in XML format otherwise regular text\r
-returns NULL if can't create a file\r
-*/\r
-GF_SceneDumper *gf_sm_dumper_new(GF_SceneGraph *graph, char *rad_name, char indent_char, Bool XMLDump);\r
-void gf_sm_dumper_del(GF_SceneDumper *bd);\r
-\r
-/*dumps commands list\r
-@indent: indent to use\r
-@skip_replace_scene_header: if set and dumping in BT mode, the initial REPLACE SCENE header is skipped\r
-*/\r
-GF_Err gf_sm_dump_command_list(GF_SceneDumper *sdump, GF_List *comList, u32 indent, Bool skip_first_replace);\r
-\r
-/*dumps complete graph - \r
-@skip_proto: proto declarations are skipped\r
-@skip_routes: routes are not dumped\r
-*/\r
-GF_Err gf_sm_dump_graph(GF_SceneDumper *sdump, Bool skip_proto, Bool skip_routes);\r
-\r
-\r
-#ifndef GPAC_READ_ONLY\r
-\r
-/*stat object - to refine :)*/\r
-\r
-/*store nodes or proto stats*/\r
-typedef struct\r
-{\r
- /*node type or protoID*/\r
- u32 tag;\r
- const char *name;\r
- /*number of created nodes*/\r
- u32 nb_created;\r
- /*number of used nodes*/\r
- u32 nb_used;\r
- /*number of used nodes*/\r
- u32 nb_del;\r
-} GF_NodeStats;\r
-\r
-typedef struct _scenestat\r
-{\r
- GF_List *node_stats;\r
- GF_List *proto_stats;\r
- \r
- /*ranges of all SFVec2fs for points only (MFVec2fs)*/\r
- SFVec2f max_2d, min_2d;\r
- /* resolution of 2D points (nb bits for integer part and decimal part)*/\r
- u32 int_res_2d, frac_res_2d;\r
- /* resolution of scale coefficient (nb bits for integer part)*/\r
- u32 scale_int_res_2d, scale_frac_res_2d;\r
-\r
- Fixed max_fixed, min_fixed;\r
-\r
- /*number of parsed 2D points*/\r
- u32 count_2d;\r
- /*number of deleted 2D points*/\r
- u32 rem_2d;\r
-\r
- /*ranges of all SFVec3fs for points only (MFVec3fs)*/\r
- SFVec3f max_3d, min_3d;\r
- u32 count_3d;\r
- /*number of deleted 3D points*/\r
- u32 rem_3d;\r
-\r
- u32 count_float, rem_float;\r
- u32 count_color, rem_color;\r
- /*all SFVec2f other than MFVec2fs elements*/\r
- u32 count_2f;\r
- /*all SFVec3f other than MFVec3fs elements*/\r
- u32 count_3f;\r
-\r
- u32 nb_svg_attributes;\r
-\r
- GF_StreamContext *base_layer;\r
-} GF_SceneStatistics;\r
-\r
-typedef struct _statman GF_StatManager;\r
-\r
-/*creates new stat handler*/\r
-GF_StatManager *gf_sm_stats_new();\r
-/*deletes stat handler*/\r
-void gf_sm_stats_del(GF_StatManager *stat);\r
-/*reset statistics*/\r
-void gf_sm_stats_reset(GF_StatManager *stat);\r
-\r
-/*get statistics - do NOT modify the returned structure*/\r
-GF_SceneStatistics *gf_sm_stats_get(GF_StatManager *stat);\r
-\r
-/*produces stat report for a complete graph*/\r
-GF_Err gf_sm_stats_for_graph(GF_StatManager *stat, GF_SceneGraph *sg);\r
-\r
-/*produces stat report for the full scene*/\r
-GF_Err gf_sm_stats_for_scene(GF_StatManager *stat, GF_SceneManager *sm);\r
-\r
-/*produces stat report for the given command*/\r
-GF_Err gf_sm_stats_for_command(GF_StatManager *stat, GF_Command *com);\r
-\r
-#endif\r
-\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-\r
-#endif /*_GF_SCENE_MANAGER_H_*/\r
-\r