OSDN Git Service

add tstools.
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / internal / bifs_dev.h
diff --git a/tstools/DtsEdit/src/gpac/internal/bifs_dev.h b/tstools/DtsEdit/src/gpac/internal/bifs_dev.h
new file mode 100644 (file)
index 0000000..a053a11
--- /dev/null
@@ -0,0 +1,223 @@
+/*\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 / BIFS codec 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
+#ifndef _GF_BIFS_DEV_H_\r
+#define _GF_BIFS_DEV_H_\r
+\r
+\r
+#include <gpac/nodes_mpeg4.h>\r
+#include <gpac/bitstream.h>\r
+#include <gpac/bifs.h>\r
+#include <gpac/thread.h>\r
+#include <gpac/internal/scenegraph_dev.h>\r
+\r
+typedef struct {\r
+       /*node this mask is for*/\r
+       GF_Node *node;\r
+       /*in case node is not defined yet*/\r
+       u32 node_id;\r
+       /*the rest is not needed at the current time, we only support simple sugnaling for FDP, BDP and IFS2D\r
+       which are using pre-defs masks*/\r
+} BIFSElementaryMask;\r
+\r
+typedef struct\r
+{\r
+       /*v1 or v2*/\r
+       u8 version;\r
+       /*BIFS config - common fields*/\r
+       u16 NodeIDBits;\r
+       u16 RouteIDBits;\r
+       Bool PixelMetrics;\r
+       /*set to 0, 0 if no size is specified*/\r
+       u16 Width, Height;\r
+\r
+       /*BIFS-Anim - not supported */\r
+       /*if 1 the BIFS_Anim codec is reset at each intra frame*/\r
+       Bool BAnimRAP;\r
+       /*list of elementary masks for BIFS anim*/\r
+       GF_List *elementaryMasks;\r
+\r
+       /*BIFS v2 add-on*/\r
+       Bool Use3DMeshCoding;\r
+       Bool UsePredictiveMFField;\r
+       u16 ProtoIDBits;\r
+} BIFSConfig;\r
+\r
+\r
+\r
+/*per_stream config support*/\r
+typedef struct \r
+{\r
+       BIFSConfig config;\r
+       u16 ESID;\r
+} BIFSStreamInfo;\r
+\r
+/*per_stream config support*/\r
+typedef struct \r
+{\r
+       GF_Node *node;\r
+       SFCommandBuffer *cb;\r
+} CommandBufferItem;\r
+\r
+\r
+struct __tag_bifs_dec\r
+{\r
+       GF_Err LastError;\r
+       /*all attached streams*/\r
+       GF_List *streamInfo;\r
+       /*active stream*/\r
+       BIFSStreamInfo *info;\r
+\r
+       Bool UseName;\r
+\r
+       GF_SceneGraph *scenegraph;\r
+       /*modified during conditional execution / proto parsing*/\r
+       GF_SceneGraph *current_graph;\r
+\r
+       /*Quantization*/\r
+       /*QP stack*/\r
+       GF_List *QPs;\r
+       /*active QP*/\r
+       M_QuantizationParameter *ActiveQP;\r
+\r
+       /*QP 14 stuff: we need to store the last numb of fields in the last received Coord //field (!!!)*/\r
+       \r
+       /*number of iten in the Coord field*/\r
+       u32 NumCoord;\r
+       Bool coord_stored, storing_coord;\r
+\r
+       /*only set at SceneReplace during proto parsing, NULL otherwise*/\r
+       GF_Proto *pCurrentProto;\r
+\r
+       /*when set the decoder works with commands rather than modifying the scene graph directly*/\r
+       Bool dec_memory_mode;\r
+       Bool force_keep_qp;\r
+       /*only set in mem mode. Conditionals/InputSensors are stacked while decoding, then decoded once the AU is decoded\r
+       to make sure all nodes potentially used by the conditional command buffer are created*/\r
+       GF_List *command_buffers;\r
+\r
+       Bool ignore_size;\r
+       Bool is_com_dec;\r
+       Double cts_offset;\r
+};\r
+\r
+\r
+/*decodes an GF_Node*/\r
+GF_Node *gf_bifs_dec_node(GF_BifsDecoder * codec, GF_BitStream *bs, u32 NDT_Tag);\r
+/*decodes an SFField (to get a ptr to the field, use gf_node_get_field )\r
+the FieldIndex is used for Quantzation*/\r
+GF_Err gf_bifs_dec_sf_field(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);\r
+/*decodes a Field (either SF or MF). The field MUST BE EMPTY*/\r
+GF_Err gf_bifs_dec_field(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);\r
+/*decodes a route*/\r
+GF_Err gf_bifs_dec_route(GF_BifsDecoder * codec, GF_BitStream *bs, Bool is_insert);\r
+/*get name*/\r
+void gf_bifs_dec_name(GF_BitStream *bs, char *name);\r
+\r
+BIFSStreamInfo *gf_bifs_dec_get_stream(GF_BifsDecoder * codec, u16 ESID);\r
+/*decodes a BIFS command frame*/\r
+GF_Err gf_bifs_dec_command(GF_BifsDecoder * codec, GF_BitStream *bs);\r
+/*decodes proto list - if proto_list is not NULL, protos parsed are not registered with the parent graph\r
+and added to the list*/\r
+GF_Err gf_bifs_dec_proto_list(GF_BifsDecoder * codec, GF_BitStream *bs, GF_List *proto_list);\r
+/*decodes field(s) of a node - exported for MultipleReplace*/\r
+GF_Err gf_bifs_dec_node_list(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, Bool is_proto);\r
+GF_Err gf_bifs_dec_node_mask(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, Bool is_proto);\r
+\r
+/*called once a field has been modified through a command, send eventOut or propagate eventIn if needed*/\r
+void gf_bifs_check_field_change(GF_Node *node, GF_FieldInfo *field);\r
+\r
+GF_Err gf_bifs_flush_command_list(GF_BifsDecoder *codec);\r
+\r
+struct __tag_bifs_enc\r
+{\r
+       GF_Err LastError;\r
+       /*all attached streams*/\r
+       GF_List *streamInfo;\r
+       /*active stream*/\r
+       BIFSStreamInfo *info;\r
+\r
+       Bool UseName;\r
+\r
+       /*the scene graph the codec is encoding (set htrough ReplaceScene or manually)*/\r
+       GF_SceneGraph *scene_graph;\r
+       /*current proto graph for DEF/USE*/\r
+       GF_SceneGraph *current_proto_graph;\r
+\r
+       /*Quantization*/\r
+       /*QP stack*/\r
+       GF_List *QPs;\r
+       /*active QP*/\r
+       M_QuantizationParameter *ActiveQP;\r
+\r
+       u32 NumCoord;\r
+       Bool coord_stored, storing_coord;\r
+\r
+       GF_Proto *encoding_proto;\r
+\r
+       /*keep track of DEF/USE*/\r
+       GF_List *encoded_nodes;\r
+       Bool is_encoding_command;\r
+};\r
+\r
+GF_Err gf_bifs_enc_commands(GF_BifsEncoder *codec, GF_List *comList, GF_BitStream *bs);\r
+\r
+GF_Err gf_bifs_enc_node(GF_BifsEncoder * codec, GF_Node *node, u32 NDT_Tag, GF_BitStream *bs);\r
+GF_Err gf_bifs_enc_sf_field(GF_BifsEncoder *codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);\r
+GF_Err gf_bifs_enc_field(GF_BifsEncoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);\r
+GF_Err gf_bifs_enc_mf_field(GF_BifsEncoder *codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);\r
+GF_Err gf_bifs_enc_route(GF_BifsEncoder *codec, GF_Route *r, GF_BitStream *bs);\r
+void gf_bifs_enc_name(GF_BifsEncoder *codec, GF_BitStream *bs, char *name);\r
+GF_Node *gf_bifs_enc_find_node(GF_BifsEncoder *codec, u32 nodeID);\r
+\r
+#define GF_BIFS_WRITE_INT(codec, bs, val, nbBits, str, com)    {\\r
+               gf_bs_write_int(bs, val, nbBits);       \\r
+               GF_LOG(GF_LOG_DEBUG, GF_LOG_CODING, ("[BIFS] %s\t\t%d\t\t%d\t\t%s\n", str, nbBits, val, com ? com : "") );      \\r
+       } \\r
+\r
+GF_Route *gf_bifs_enc_is_field_ised(GF_BifsEncoder *codec, GF_Node *node, u32 fieldIndex);\r
+\r
+/*get field QP and anim info*/\r
+Bool gf_bifs_get_aq_info(GF_Node *Node, u32 FieldIndex, u8 *QType, u8 *AType, Fixed *b_min, Fixed *b_max, u32 *QT13_bits);\r
+\r
+/*get the absolute field 0_based index (or ALL mode) given the field index in IndexMode*/\r
+GF_Err gf_bifs_get_field_index(GF_Node *Node, u32 inField, u8 IndexMode, u32 *allField);\r
+\r
+/*returns the opaque NodeDataType of the node "children" field if any, or 0*/\r
+u32 gf_bifs_get_child_table(GF_Node *Node);\r
+\r
+/*returns binary type of node in the given version of the desired NDT*/\r
+u32 gf_bifs_get_node_type(u32 NDT_Tag, u32 NodeTag, u32 Version);\r
+\r
+/*converts field index from all_mode to given mode*/\r
+GF_Err gf_bifs_field_index_by_mode(GF_Node *node, u32 all_ind, u8 indexMode, u32 *outField);\r
+\r
+/*return number of bits needed to code all nodes present in the specified NDT*/\r
+u32 gf_bifs_get_ndt_bits(u32 NDT_Tag, u32 Version);\r
+/*return absolute node tag given its type in the NDT and the NDT version number*/\r
+u32 gf_bifs_ndt_get_node_type(u32 NDT_Tag, u32 NodeType, u32 Version);\r
+\r
+#endif //_GF_BIFS_DEV_H_\r
+\r