# HG changeset patch # User arpi_esp # Date 988078454 0 # Node ID 4407bb4741c9759b0389de3a5dae9a7e90e7332d # Parent 0b1f9eda1ea6b0f3e0b493037a233a626e3c991d added html generation diff -r 0b1f9eda1ea6 -r 4407bb4741c9 codec-cfg.c --- a/codec-cfg.c Tue Apr 24 00:02:20 2001 +0000 +++ b/codec-cfg.c Tue Apr 24 02:14:14 2001 +0000 @@ -99,10 +99,6 @@ return 1; } - -static int add_to_out(char *sfmt, char *sflags, unsigned int *outfmt, - unsigned char *outflags) -{ static struct { const char *name; const unsigned int num; @@ -128,6 +124,11 @@ {NULL, 0} }; + +static int add_to_out(char *sfmt, char *sflags, unsigned int *outfmt, + unsigned char *outflags) +{ + static char *flagstr[] = { "flip", "noflip", @@ -623,6 +624,175 @@ return NULL; } +#ifdef CODECS2HTML + +void wrapline(FILE *f2,char *s){ + int c; + if(!s){ + fprintf(f2,"-"); + return; + } + while((c=*s++)){ + if(c==',') fprintf(f2,"
"); else fputc(c,f2); + } +} + +void parsehtml(FILE *f1,FILE *f2,codecs_t *codec,int section,int dshow){ + int c,d; + while((c=fgetc(f1))>=0){ + if(c!='%'){ + fputc(c,f2); + continue; + } + d=fgetc(f1); + if(d=='.') return; // end of section + + switch(d){ + case '.': + return; + case 'n': + wrapline(f2,codec->name); break; + case 'i': + wrapline(f2,codec->info); break; + case 'c': + wrapline(f2,codec->comment); break; + case 'd': + wrapline(f2,codec->dll); break; + case 'D': + fprintf(f2,"%c",codec->driver==dshow?'+':'-'); break; + case 'F': + for(d=0;dfourcc[d]!=0xFFFFFFFF) + fprintf(f2,"%s%.4s",d?"
":"",codec->fourcc[d]<0x20202020?"-":(char*) &codec->fourcc[d]); + break; + case 'f': + for(d=0;dfourcc[d]!=0xFFFFFFFF) + fprintf(f2,"%s0x%X",d?"
":"",codec->fourcc[d]); + break; + case 'Y': + for(d=0;doutfmt[d]!=0xFFFFFFFF){ + for (c=0; fmt_table[c].name; c++) + if(fmt_table[c].num==codec->outfmt[d]) break; + if(fmt_table[c].name) + fprintf(f2,"%s%s",d?"
":"",fmt_table[c].name); + } + break; + default: + fputc(c,f2); + fputc(d,f2); + } + } + +} + +void skiphtml(FILE *f1){ + int c,d; + while((c=fgetc(f1))>=0){ + if(c!='%'){ + continue; + } + d=fgetc(f1); + if(d=='.') return; // end of section + } +} + +int main(void) +{ + codecs_t **codecs, *cl; + FILE *f1; + FILE *f2; + int c,d,i; + int pos; + int section=-1; + int nr_codecs; + int win32=-1; + int dshow=-1; + + if (!(codecs = parse_codec_cfg("DOCS/codecs.conf"))) + return 0; + if (!codecs[0]) + printf("no videoconfig.\n"); + if (!codecs[1]) + printf("no audioconfig.\n"); + + f1=fopen("DOCS/codecs-in.html","rb"); if(!f1) exit(1); + f2=fopen("DOCS/codecs.html","wb"); if(!f2) exit(1); + + while((c=fgetc(f1))>=0){ + if(c!='%'){ + fputc(c,f2); + continue; + } + d=fgetc(f1); + if(d>='0' && d<='9'){ + // begin section + section=d-'0'; + printf("BEGIN %d\n",section); + if(section>=5){ + // audio + cl = codecs[1]; + nr_codecs = nr_acodecs; + dshow=7;win32=4; + } else { + // video + cl = codecs[0]; + nr_codecs = nr_vcodecs; + dshow=4;win32=2; + } + pos=ftell(f1); + for(i=0;i