📄 mpeg4_nodes.c
字号:
case GF_SG_FIELD_CODING_DYN: return 0; default: return 6; }}static GF_Err AudioSwitch_get_field_index(GF_Node *n, u32 inField, u8 IndexMode, u32 *allField){ switch(IndexMode) { case GF_SG_FIELD_CODING_IN: *allField = AudioSwitch_In2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_DEF: *allField = AudioSwitch_Def2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_OUT: *allField = AudioSwitch_Out2All[inField]; return GF_OK; default: return GF_BAD_PARAM; }}static GF_Err AudioSwitch_get_field(GF_Node *node, GF_FieldInfo *info){ switch (info->fieldIndex) { case 0: info->name = "addChildren"; info->eventType = GF_SG_EVENT_IN; info->on_event_in = ((M_AudioSwitch *)node)->on_addChildren; info->fieldType = GF_SG_VRML_MFNODE; info->NDTtype = NDT_SFAudioNode; info->far_ptr = & ((M_AudioSwitch *)node)->addChildren; return GF_OK; case 1: info->name = "removeChildren"; info->eventType = GF_SG_EVENT_IN; info->on_event_in = ((M_AudioSwitch *)node)->on_removeChildren; info->fieldType = GF_SG_VRML_MFNODE; info->NDTtype = NDT_SFAudioNode; info->far_ptr = & ((M_AudioSwitch *)node)->removeChildren; return GF_OK; case 2: info->name = "children"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFNODE; info->NDTtype = NDT_SFAudioNode; info->far_ptr = & ((M_AudioSwitch *)node)->children; return GF_OK; case 3: info->name = "whichChoice"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFINT32; info->far_ptr = & ((M_AudioSwitch *) node)->whichChoice; return GF_OK; case 4: info->name = "numChan"; info->eventType = GF_SG_EVENT_FIELD; info->fieldType = GF_SG_VRML_SFINT32; info->far_ptr = & ((M_AudioSwitch *) node)->numChan; return GF_OK; case 5: info->name = "phaseGroup"; info->eventType = GF_SG_EVENT_FIELD; info->fieldType = GF_SG_VRML_MFINT32; info->far_ptr = & ((M_AudioSwitch *) node)->phaseGroup; return GF_OK; default: return GF_BAD_PARAM; }}static s32 AudioSwitch_get_field_index_by_name(char *name){ if (!strcmp("addChildren", name)) return 0; if (!strcmp("removeChildren", name)) return 1; if (!strcmp("children", name)) return 2; if (!strcmp("whichChoice", name)) return 3; if (!strcmp("numChan", name)) return 4; if (!strcmp("phaseGroup", name)) return 5; return -1; }static Bool AudioSwitch_get_aq_info(GF_Node *n, u32 FieldIndex, u8 *QType, u8 *AType, Fixed *b_min, Fixed *b_max, u32 *QT13_bits){ switch (FieldIndex) { case 3: *AType = 0; *QType = 13; *QT13_bits = 1; *b_min = FLT2FIX(0); *b_max = FLT2FIX(1); return 1; case 4: *AType = 0; *QType = 13; *QT13_bits = 8; *b_min = FLT2FIX(0); *b_max = FLT2FIX(255); return 1; case 5: *AType = 0; *QType = 13; *QT13_bits = 8; *b_min = FLT2FIX(0); *b_max = FLT2FIX(255); return 1; default: return 0; }}GF_Node *AudioSwitch_Create(){ M_AudioSwitch *p; GF_SAFEALLOC(p, M_AudioSwitch); if(!p) return NULL; gf_node_setup((GF_Node *)p, TAG_MPEG4_AudioSwitch); gf_sg_vrml_parent_setup((GF_Node *) p);#ifdef GF_NODE_USE_POINTERS ((GF_Node *)p)->sgprivate->name = "AudioSwitch"; ((GF_Node *)p)->sgprivate->node_del = AudioSwitch_Del; ((GF_Node *)p)->sgprivate->get_field_count = AudioSwitch_get_field_count; ((GF_Node *)p)->sgprivate->get_field = AudioSwitch_get_field;#endif /*default field values*/ p->numChan = 1; return (GF_Node *)p;}/* Background Node deletion*/static void Background_Del(GF_Node *node){ M_Background *p = (M_Background *) node; gf_sg_mffloat_del(p->groundAngle); gf_sg_mfcolor_del(p->groundColor); gf_sg_mfurl_del(p->backUrl); gf_sg_mfurl_del(p->bottomUrl); gf_sg_mfurl_del(p->frontUrl); gf_sg_mfurl_del(p->leftUrl); gf_sg_mfurl_del(p->rightUrl); gf_sg_mfurl_del(p->topUrl); gf_sg_mffloat_del(p->skyAngle); gf_sg_mfcolor_del(p->skyColor); gf_node_free((GF_Node *) p);}static const u16 Background_Def2All[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};static const u16 Background_In2All[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};static const u16 Background_Out2All[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};static const u16 Background_Dyn2All[] = { 1, 2, 9, 10};static u32 Background_get_field_count(GF_Node *node, u8 IndexMode){ switch(IndexMode) { case GF_SG_FIELD_CODING_IN: return 11; case GF_SG_FIELD_CODING_DEF: return 10; case GF_SG_FIELD_CODING_OUT: return 11; case GF_SG_FIELD_CODING_DYN: return 4; default: return 12; }}static GF_Err Background_get_field_index(GF_Node *n, u32 inField, u8 IndexMode, u32 *allField){ switch(IndexMode) { case GF_SG_FIELD_CODING_IN: *allField = Background_In2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_DEF: *allField = Background_Def2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_OUT: *allField = Background_Out2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_DYN: *allField = Background_Dyn2All[inField]; return GF_OK; default: return GF_BAD_PARAM; }}static GF_Err Background_get_field(GF_Node *node, GF_FieldInfo *info){ switch (info->fieldIndex) { case 0: info->name = "set_bind"; info->eventType = GF_SG_EVENT_IN; info->on_event_in = ((M_Background *)node)->on_set_bind; info->fieldType = GF_SG_VRML_SFBOOL; info->far_ptr = & ((M_Background *) node)->set_bind; return GF_OK; case 1: info->name = "groundAngle"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFFLOAT; info->far_ptr = & ((M_Background *) node)->groundAngle; return GF_OK; case 2: info->name = "groundColor"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFCOLOR; info->far_ptr = & ((M_Background *) node)->groundColor; return GF_OK; case 3: info->name = "backUrl"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFURL; info->far_ptr = & ((M_Background *) node)->backUrl; return GF_OK; case 4: info->name = "bottomUrl"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFURL; info->far_ptr = & ((M_Background *) node)->bottomUrl; return GF_OK; case 5: info->name = "frontUrl"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFURL; info->far_ptr = & ((M_Background *) node)->frontUrl; return GF_OK; case 6: info->name = "leftUrl"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFURL; info->far_ptr = & ((M_Background *) node)->leftUrl; return GF_OK; case 7: info->name = "rightUrl"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFURL; info->far_ptr = & ((M_Background *) node)->rightUrl; return GF_OK; case 8: info->name = "topUrl"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFURL; info->far_ptr = & ((M_Background *) node)->topUrl; return GF_OK; case 9: info->name = "skyAngle"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFFLOAT; info->far_ptr = & ((M_Background *) node)->skyAngle; return GF_OK; case 10: info->name = "skyColor"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFCOLOR; info->far_ptr = & ((M_Background *) node)->skyColor; return GF_OK; case 11: info->name = "isBound"; info->eventType = GF_SG_EVENT_OUT; info->fieldType = GF_SG_VRML_SFBOOL; info->far_ptr = & ((M_Background *) node)->isBound; return GF_OK; default: return GF_BAD_PARAM; }}static s32 Background_get_field_index_by_name(char *name){ if (!strcmp("set_bind", name)) return 0; if (!strcmp("groundAngle", name)) return 1; if (!strcmp("groundColor", name)) return 2; if (!strcmp("backUrl", name)) return 3; if (!strcmp("bottomUrl", name)) return 4; if (!strcmp("frontUrl", name)) return 5; if (!strcmp("leftUrl", name)) return 6; if (!strcmp("rightUrl", name)) return 7; if (!strcmp("topUrl", name)) return 8; if (!strcmp("skyAngle", name)) return 9; if (!strcmp("skyColor", name)) return 10; if (!strcmp("isBound", name)) return 11; return -1; }static Bool Background_get_aq_info(GF_Node *n, u32 FieldIndex, u8 *QType, u8 *AType, Fixed *b_min, Fixed *b_max, u32 *QT13_bits){ switch (FieldIndex) { case 1: *AType = 8; *QType = 6; *b_min = FLT2FIX(0); *b_max = FLT2FIX(1.5707963); return 1; case 2: *AType = 4; *QType = 4; *b_min = FLT2FIX(0); *b_max = FLT2FIX(1); return 1; case 9: *AType = 8; *QType = 6; *b_min = FLT2FIX(0); *b_max = FLT2FIX(3.14159265); return 1; case 10: *AType = 4; *QType = 4; *b_min = FLT2FIX(0); *b_max = FLT2FIX(1); return 1; default: return 0; }}GF_Node *Background_Create(){ M_Background *p; GF_SAFEALLOC(p, M_Background); if(!p) return NULL; gf_node_setup((GF_Node *)p, TAG_MPEG4_Background);#ifdef GF_NODE_USE_POINTERS ((GF_Node *)p)->sgprivate->name = "Background"; ((GF_Node *)p)->sgprivate->node_del = Background_Del; ((GF_Node *)p)->sgprivate->get_field_count = Background_get_field_count; ((GF_Node *)p)->sgprivate->get_field = Background_get_field;#endif /*default field values*/ p->skyColor.vals = (SFColor*)malloc(sizeof(SFColor)*1); p->skyColor.count = 1; p->skyColor.vals[0].red = FLT2FIX(0); p->skyColor.vals[0].green = FLT2FIX(0); p->skyColor.vals[0].blue = FLT2FIX(0); return (GF_Node *)p;}/* Background2D Node deletion*/static void Background2D_Del(GF_Node *node){ M_Background2D *p = (M_Background2D *) node; gf_sg_mfurl_del(p->url); gf_node_free((GF_Node *) p);}static const u16 Background2D_Def2All[] = { 1, 2};static const u16 Background2D_In2All[] = { 0, 1, 2};static const u16 Background2D_Out2All[] = { 1, 2, 3};static const u16 Background2D_Dyn2All[] = { 1};static u32 Background2D_get_field_count(GF_Node *node, u8 IndexMode){ switch(IndexMode) { case GF_SG_FIELD_CODING_IN: return 3; case GF_SG_FIELD_CODING_DEF: return 2; case GF_SG_FIELD_CODING_OUT: return 3; case GF_SG_FIELD_CODING_DYN: return 1; default: return 4; }}static GF_Err Background2D_get_field_index(GF_Node *n, u32 inField, u8 IndexMode, u32 *allField){ switch(IndexMode) { case GF_SG_FIELD_CODING_IN: *allField = Background2D_In2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_DEF: *allField = Background2D_Def2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_OUT: *allField = Background2D_Out2All[inField]; return GF_OK; case GF_SG_FIELD_CODING_DYN: *allField = Background2D_Dyn2All[inField]; return GF_OK; default: return GF_BAD_PARAM; }}static GF_Err Background2D_get_field(GF_Node *node, GF_FieldInfo *info){ switch (info->fieldIndex) { case 0: info->name = "set_bind"; info->eventType = GF_SG_EVENT_IN; info->on_event_in = ((M_Background2D *)node)->on_set_bind; info->fieldType = GF_SG_VRML_SFBOOL; info->far_ptr = & ((M_Background2D *) node)->set_bind; return GF_OK; case 1: info->name = "backColor"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_SFCOLOR; info->far_ptr = & ((M_Background2D *) node)->backColor; return GF_OK; case 2: info->name = "url"; info->eventType = GF_SG_EVENT_EXPOSED_FIELD; info->fieldType = GF_SG_VRML_MFURL; info->far_ptr = & ((M_Background2D *) node)->url; return GF_OK; case 3: info->name = "isBound"; info->eventType = GF_SG_EVENT_OUT; info->fieldType = GF_SG_VRML_SFBOOL; info->far_ptr = & ((M_Background2D *) node)->isBound; return GF_OK; default: return GF_BAD_PARAM; }}static s32 Background2D_get_field_index_by_name(char *name){ if (!strcmp("set_bind", name)) return 0; if (!strcmp("backColor", name)) return 1; if (!strcmp("url", name)) return 2; if (!strcmp("isBound", name)) return 3; return -1; }static Bool Background2D_get_aq_info(GF_Node *n, u32 FieldIndex, u8 *QType, u8 *AType, Fixed *b_min, Fixed *b_max, u32 *QT13_bits){ switch (FieldIndex) { case 1: *AType = 4; *QType = 4; *b_min = FLT2FIX(0); *b_max = FLT2FIX(1); return 1; default: return 0; }}GF_Node *Background2D_Create(){ M_Background2D *p; GF_SAFEALLOC(p, M_Background2D); if(!p) return NULL; gf_node_setup((GF_Node *)p, TAG_MPEG4_Background2D);#ifdef GF_NODE_USE_POINTERS ((GF_Node *)p)->sgprivate->name = "Background2D"; ((GF_Node *)p)->sgprivate->node_del = Background2D_Del; ((GF_Node *)p)->sgprivate->get_field_count = Background2D_get_field_count; ((GF_Node *)p)->sgprivate->get_field = Background2D_get_field;#endif /*default field values*/ p->backColor.red = FLT2FIX(0); p->backColor.green = FLT2FIX(0); p->backColor.blue = FLT2FIX(0); return (GF_Node *)p;}/* Billboard Node deletion*/static void Billboard_Del(GF_Node *node){ M_Billboard *p = (M_Billboard *) node; gf_sg_vrml_parent_destroy((GF_Node *) p); gf_node_free((GF_Node *) p);}static const u16 Billboard_Def2All[] = { 2, 3};static const u16 Billboard_In2All[] = { 0, 1, 2, 3};static const u16 Billboard_Out2All[] = { 2, 3};static const u16 Billboard_Dyn2All[] = { 3};static u32 Billboard_get_field_count(GF_Node *node, u8 IndexMode){ switch(IndexMode) { case GF_SG_FIELD_CODING_IN: return 4; case GF_SG_FIELD_CODING_DEF: return 2; case GF_SG_FIELD_CODING_OUT: return 2; case GF_SG_FIELD_CODING_DYN: return 1; default: return 4; }}static GF_Err Billboard_get_field_index(GF_Node *n, u32 inField, u8 IndexMode, u32 *allField){ switch(IndexMode) { case GF_SG_FIELD_CODING_IN:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -