static void parse_option() { const char * file_name; FILE * file; char line[256]; char * name, * value; file_name = option_get_string("OptionFile"); file = fopen(file_name,"r"); if (file == NULL) my_fatal("Can't open file \"%s\": %s\n",file_name,strerror(errno)); // PolyGlot options (assumed first) while (true) { if (!my_file_read_line(file,line,256)) { my_fatal("parse_option(): missing [Engine] section\n"); } if (my_string_case_equal(line,"[engine]")) break; if (parse_line(line,&name,&value)) option_set(name,value); } if (option_get_bool("Log")) { my_log_open(option_get_string("LogFile")); } my_log("POLYGLOT %s *** START ***\n",Version); my_log("POLYGLOT INI file \"%s\"\n",file_name); engine_open(Engine); Init = true; uci_open(Uci,Engine); while (my_file_read_line(file,line,256)) { if (line[0] == '[') my_fatal("parse_option(): unknown section %s\n",line); if (parse_line(line,&name,&value)) { uci_send_option(Uci,name,"%s",value); //to get a decent display in winboard_x we need to now if an engine really is doing multipv analysis // "multipv 1" in the pv is meaningless,f.i. toga sends that all the time //therefore check if MultiPV is set to a decent value in the polyglot ini file if(my_string_case_equal(name,"MultiPV") && atoi(value)>1) Uci->multipv_mode=true; } } uci_send_isready(Uci); fclose(file); if (my_string_equal(option_get_string("EngineName"),"<empty>")) { option_set("EngineName",Uci->name); } }
static void gst_ducati_viddec_get_property (GObject * obj, guint prop_id, GValue * value, GParamSpec * pspec) { GstDucatiVidDec *self = GST_DUCATIVIDDEC (obj); switch (prop_id) { case PROP_VERSION: { int err; char *version = gst_ducati_alloc_1d (VERSION_LENGTH); /* in case something fails: */ snprintf (version, VERSION_LENGTH, "unsupported"); if (! self->engine) engine_open (self); if (! self->codec) codec_create (self); if (self->codec) { self->status->data.buf = (XDAS_Int8 *) TilerMem_VirtToPhys (version); self->status->data.bufSize = VERSION_LENGTH; err = VIDDEC3_control (self->codec, XDM_GETVERSION, self->dynParams, self->status); if (err) { GST_ERROR_OBJECT (self, "failed XDM_GETVERSION"); } self->status->data.buf = NULL; self->status->data.bufSize = 0; } g_value_set_string (value, version); MemMgr_Free (version); break; } default: { G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); break; } } }
static GstStateChangeReturn gst_ducati_viddec_change_state (GstElement * element, GstStateChange transition) { GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstDucatiVidDec *self = GST_DUCATIVIDDEC (element); GST_INFO_OBJECT (self, "begin: changing state %s -> %s", gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)), gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition))); switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: if (!engine_open (self)) { GST_ERROR_OBJECT (self, "could not open"); return GST_STATE_CHANGE_FAILURE; } break; default: break; } ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); if (ret == GST_STATE_CHANGE_FAILURE) goto leave; switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: codec_delete (self); engine_close (self); break; default: break; } leave: GST_LOG_OBJECT (self, "end"); return ret; }
static void parse_option() { const char * file_name; FILE * file; char line[256]; char * name, * value; file_name = option_get_string("OptionFile"); file = fopen(file_name,"r"); if (file == NULL) my_fatal("Can't open file \"%s\": %s\n",file_name,strerror(errno)); // PolyGlot options (assumed first) //read the ini file,and store the name/value pairs while (true) { if (!my_file_read_line(file,line,sizeof(line))) { my_fatal("parse_option(): missing [Engine] section\n"); } if (my_string_case_equal(line,"[engine]")) break; if (parse_line(line,&name,&value)) option_set(name,value); } if (option_get_bool("Log")) { my_log_open(option_get_string("LogFile"));} while (my_file_read_line(file,line,sizeof(line))) { if (line[0] == '[') my_fatal("parse_option(): unknown section %s\n",line); if (parse_line(line,&name,&value)) { uci_option_store(name,value); } } fclose(file); //read the optional global.ini file if(!option_get_bool("NoGlobals")){ file=fopen("globals.ini","r"); //override settings,if any if(file!=NULL){ while (true) { if (!my_file_read_line(file,line,sizeof(line))) { my_fatal("parse_option(): missing [Engine] section\n"); } if (my_string_case_equal(line,"[engine]")) break; if (parse_line(line,&name,&value)){ if(!my_string_case_equal(name,"LogFile")) option_set(name,value); } } if (option_get_bool("Log")) { my_log_open(option_get_string("LogFile")); } else my_log_close(); //close it while (my_file_read_line(file,line,sizeof(line))) { if (line[0] == '[') my_fatal("parse_option(): unknown section %s\n",line); if (parse_line(line,&name,&value)) { uci_option_store(name,value); } } fclose(file); } } my_log("POLYGLOT %s *** START ***\n",Version); my_log("POLYGLOT INI file \"%s\"\n",file_name); //do the dump: engine_open(Engine); Init = true; uci_open(Uci,Engine); uci_option_t *next; init_uci_list(&next); while(next!=NULL){ if(next->var==NULL) break; uci_send_option(Uci,next->var,"%s",next->val); if(my_string_case_equal(next->var,"MultiPV") && atoi(next->val)>1) Uci->multipv_mode=true; next=next->next; } uci_send_isready(Uci); if (my_string_equal(option_get_string("EngineName"),"<empty>")) { option_set("EngineName",Uci->name); } }