/** \fn find \brief Search for the tag given and returns the corresponding atom */ uint8_t ADM_ebml_file::find(ADM_MKV_SEARCHTYPE search,MKV_ELEM_ID prim,MKV_ELEM_ID second,uint64_t *len,uint32_t rewind) { uint64_t id,pos; ADM_MKV_TYPE type; const char *ss; vprintf("[MKV]Searching for tag %llx %llx\n",prim,second); if(rewind) seek(_begin); if(search==ADM_MKV_PRIMARY) { return simplefind(prim,len,rewind); } vprintf("[MKV]Searching primary : %llx\n",prim); if(!simplefind(prim,len,rewind)) { vprintf("[MKV] Primary find failed for %llx\n",prim); return 0; } // Now we have the father, go inside ADM_ebml_file *son=new ADM_ebml_file(this,*len); vprintf("[MKV]Searching secondary : %llx\n",second); if(!son->simplefind(second,len)) { vprintf("[MKV] secondary find failed for secondary %llx\n",second); delete son; return 0; } pos=son->tell(); delete son; seek(pos); return 1; }
long search_named_array(FILE *inputfile,char* string) { char ch; //const char ocurl='{', ccurl='}'; //short ind=1; //long buffer_index=0,buffer_size=0,blocksnumber=0, long position; //extern t_keywords T_KEYWORDS; //FLOATVECTOR *vec=NULL; HEADER h; if(inputfile==NULL){ t_error("You tried to read from a closed file "); } ch=getc(inputfile); while(ch!=EOF){ position=simplefind(inputfile,":"); ch=getc(inputfile); while(!isspace(ch) && !iscntrl(ch)){ position-=1; fseek(inputfile,position,SEEK_SET); ch=getc(inputfile); } header_scan(inputfile,&h); if(strcmp(h.name,string)==0){ fseek(inputfile,position,SEEK_SET); return position; } } t_error("The searched array does not exists in file"); return -1; }