2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / BIFS codec sub-project
\r
9 * GPAC is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation; either version 2, or (at your option)
\r
12 * any later version.
\r
14 * GPAC is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public
\r
20 * License along with this library; see the file COPYING. If not, write to
\r
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
\r
26 #ifndef _GF_BIFS_DEV_H_
\r
27 #define _GF_BIFS_DEV_H_
\r
30 #include <gpac/nodes_mpeg4.h>
\r
31 #include <gpac/bitstream.h>
\r
32 #include <gpac/bifs.h>
\r
33 #include <gpac/thread.h>
\r
34 #include <gpac/internal/scenegraph_dev.h>
\r
37 /*node this mask is for*/
\r
39 /*in case node is not defined yet*/
\r
41 /*the rest is not needed at the current time, we only support simple sugnaling for FDP, BDP and IFS2D
\r
42 which are using pre-defs masks*/
\r
43 } BIFSElementaryMask;
\r
49 /*BIFS config - common fields*/
\r
53 /*set to 0, 0 if no size is specified*/
\r
56 /*BIFS-Anim - not supported */
\r
57 /*if 1 the BIFS_Anim codec is reset at each intra frame*/
\r
59 /*list of elementary masks for BIFS anim*/
\r
60 GF_List *elementaryMasks;
\r
63 Bool Use3DMeshCoding;
\r
64 Bool UsePredictiveMFField;
\r
70 /*per_stream config support*/
\r
77 /*per_stream config support*/
\r
81 SFCommandBuffer *cb;
\r
82 } CommandBufferItem;
\r
85 struct __tag_bifs_dec
\r
88 /*all attached streams*/
\r
89 GF_List *streamInfo;
\r
91 BIFSStreamInfo *info;
\r
95 GF_SceneGraph *scenegraph;
\r
96 /*modified during conditional execution / proto parsing*/
\r
97 GF_SceneGraph *current_graph;
\r
103 M_QuantizationParameter *ActiveQP;
\r
105 /*QP 14 stuff: we need to store the last numb of fields in the last received Coord //field (!!!)*/
\r
107 /*number of iten in the Coord field*/
\r
109 Bool coord_stored, storing_coord;
\r
111 /*only set at SceneReplace during proto parsing, NULL otherwise*/
\r
112 GF_Proto *pCurrentProto;
\r
114 /*when set the decoder works with commands rather than modifying the scene graph directly*/
\r
115 Bool dec_memory_mode;
\r
116 Bool force_keep_qp;
\r
117 /*only set in mem mode. Conditionals/InputSensors are stacked while decoding, then decoded once the AU is decoded
\r
118 to make sure all nodes potentially used by the conditional command buffer are created*/
\r
119 GF_List *command_buffers;
\r
127 /*decodes an GF_Node*/
\r
128 GF_Node *gf_bifs_dec_node(GF_BifsDecoder * codec, GF_BitStream *bs, u32 NDT_Tag);
\r
129 /*decodes an SFField (to get a ptr to the field, use gf_node_get_field )
\r
130 the FieldIndex is used for Quantzation*/
\r
131 GF_Err gf_bifs_dec_sf_field(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);
\r
132 /*decodes a Field (either SF or MF). The field MUST BE EMPTY*/
\r
133 GF_Err gf_bifs_dec_field(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);
\r
134 /*decodes a route*/
\r
135 GF_Err gf_bifs_dec_route(GF_BifsDecoder * codec, GF_BitStream *bs, Bool is_insert);
\r
137 void gf_bifs_dec_name(GF_BitStream *bs, char *name);
\r
139 BIFSStreamInfo *gf_bifs_dec_get_stream(GF_BifsDecoder * codec, u16 ESID);
\r
140 /*decodes a BIFS command frame*/
\r
141 GF_Err gf_bifs_dec_command(GF_BifsDecoder * codec, GF_BitStream *bs);
\r
142 /*decodes proto list - if proto_list is not NULL, protos parsed are not registered with the parent graph
\r
143 and added to the list*/
\r
144 GF_Err gf_bifs_dec_proto_list(GF_BifsDecoder * codec, GF_BitStream *bs, GF_List *proto_list);
\r
145 /*decodes field(s) of a node - exported for MultipleReplace*/
\r
146 GF_Err gf_bifs_dec_node_list(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, Bool is_proto);
\r
147 GF_Err gf_bifs_dec_node_mask(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, Bool is_proto);
\r
149 /*called once a field has been modified through a command, send eventOut or propagate eventIn if needed*/
\r
150 void gf_bifs_check_field_change(GF_Node *node, GF_FieldInfo *field);
\r
152 GF_Err gf_bifs_flush_command_list(GF_BifsDecoder *codec);
\r
154 struct __tag_bifs_enc
\r
157 /*all attached streams*/
\r
158 GF_List *streamInfo;
\r
160 BIFSStreamInfo *info;
\r
164 /*the scene graph the codec is encoding (set htrough ReplaceScene or manually)*/
\r
165 GF_SceneGraph *scene_graph;
\r
166 /*current proto graph for DEF/USE*/
\r
167 GF_SceneGraph *current_proto_graph;
\r
173 M_QuantizationParameter *ActiveQP;
\r
176 Bool coord_stored, storing_coord;
\r
178 GF_Proto *encoding_proto;
\r
180 /*keep track of DEF/USE*/
\r
181 GF_List *encoded_nodes;
\r
182 Bool is_encoding_command;
\r
185 GF_Err gf_bifs_enc_commands(GF_BifsEncoder *codec, GF_List *comList, GF_BitStream *bs);
\r
187 GF_Err gf_bifs_enc_node(GF_BifsEncoder * codec, GF_Node *node, u32 NDT_Tag, GF_BitStream *bs);
\r
188 GF_Err gf_bifs_enc_sf_field(GF_BifsEncoder *codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);
\r
189 GF_Err gf_bifs_enc_field(GF_BifsEncoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);
\r
190 GF_Err gf_bifs_enc_mf_field(GF_BifsEncoder *codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field);
\r
191 GF_Err gf_bifs_enc_route(GF_BifsEncoder *codec, GF_Route *r, GF_BitStream *bs);
\r
192 void gf_bifs_enc_name(GF_BifsEncoder *codec, GF_BitStream *bs, char *name);
\r
193 GF_Node *gf_bifs_enc_find_node(GF_BifsEncoder *codec, u32 nodeID);
\r
195 #define GF_BIFS_WRITE_INT(codec, bs, val, nbBits, str, com) {\
\r
196 gf_bs_write_int(bs, val, nbBits); \
\r
197 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
200 GF_Route *gf_bifs_enc_is_field_ised(GF_BifsEncoder *codec, GF_Node *node, u32 fieldIndex);
\r
202 /*get field QP and anim info*/
\r
203 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
205 /*get the absolute field 0_based index (or ALL mode) given the field index in IndexMode*/
\r
206 GF_Err gf_bifs_get_field_index(GF_Node *Node, u32 inField, u8 IndexMode, u32 *allField);
\r
208 /*returns the opaque NodeDataType of the node "children" field if any, or 0*/
\r
209 u32 gf_bifs_get_child_table(GF_Node *Node);
\r
211 /*returns binary type of node in the given version of the desired NDT*/
\r
212 u32 gf_bifs_get_node_type(u32 NDT_Tag, u32 NodeTag, u32 Version);
\r
214 /*converts field index from all_mode to given mode*/
\r
215 GF_Err gf_bifs_field_index_by_mode(GF_Node *node, u32 all_ind, u8 indexMode, u32 *outField);
\r
217 /*return number of bits needed to code all nodes present in the specified NDT*/
\r
218 u32 gf_bifs_get_ndt_bits(u32 NDT_Tag, u32 Version);
\r
219 /*return absolute node tag given its type in the NDT and the NDT version number*/
\r
220 u32 gf_bifs_ndt_get_node_type(u32 NDT_Tag, u32 NodeType, u32 Version);
\r
222 #endif //_GF_BIFS_DEV_H_
\r