GF_Err BD_SetProtoISed(GF_BifsDecoder * codec, u32 protofield, GF_Node *n, u32 nodefield) { /*take care of conditional execution in proto*/ if (codec->current_graph->pOwningProto) { return gf_sg_proto_instance_set_ised((GF_Node *) codec->current_graph->pOwningProto, protofield, n, nodefield); } /*regular ISed fields*/ else { return gf_sg_proto_field_set_ised(codec->pCurrentProto, protofield, n, nodefield); } }
GF_Err ParseScriptField(ScriptParser *parser) { GF_ScriptField *field; GF_Err e; u32 eventType, fieldType; char name[1000]; GF_FieldInfo info; eventType = gf_bs_read_int(parser->bs, 2); fieldType = gf_bs_read_int(parser->bs, 6); gf_bifs_dec_name(parser->bs, name); field = gf_sg_script_field_new(parser->script, eventType, fieldType, name); if (!field) return GF_NON_COMPLIANT_BITSTREAM; //save the name in the list of identifiers gf_list_add(parser->identifiers, gf_strdup(name)); if (parser->codec->pCurrentProto) { Bool isISfield = gf_bs_read_int(parser->bs, 1); if (isISfield) { u32 numProtoField = gf_sg_proto_get_field_count(parser->codec->pCurrentProto); u32 numBits = gf_get_bit_size(numProtoField - 1); u32 field_all = gf_bs_read_int(parser->bs, numBits); e = gf_sg_script_field_get_info(field, &info); if (e) return e; e = gf_sg_proto_field_set_ised(parser->codec->pCurrentProto, field_all, parser->script, info.fieldIndex); return e; } } /*get default value*/ if (eventType == GF_SG_SCRIPT_TYPE_FIELD) { if (gf_bs_read_int(parser->bs, 1)) { e = gf_sg_script_field_get_info(field, &info); if (e) return e; gf_bifs_dec_field(parser->codec, parser->bs, parser->script, &info); } } return parser->codec->LastError; }