Mercurial > mplayer.hg
comparison codec-cfg.c @ 7180:28677d779205
-afm/-vfm migration from ID (int) to NAME (string) - simplifies code and makes dlopen()'ing possible
author | arpi |
---|---|
date | Fri, 30 Aug 2002 21:44:20 +0000 |
parents | 0145bba6e201 |
children | 624cab9f7359 |
comparison
equal
deleted
inserted
replaced
7179:a258b9b7669e | 7180:28677d779205 |
---|---|
208 err_out_parse_error: | 208 err_out_parse_error: |
209 mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error"); | 209 mp_msg(MSGT_CODECCFG,MSGL_ERR,"parse error"); |
210 return 0; | 210 return 0; |
211 } | 211 } |
212 | 212 |
213 #if 0 | |
213 static short get_driver(char *s,int audioflag) | 214 static short get_driver(char *s,int audioflag) |
214 { | 215 { |
215 static char *audiodrv[] = { | 216 static char *audiodrv[] = { |
216 "null", | 217 "null", |
217 "mp3lib", | 218 "mp3lib", |
276 | 277 |
277 for(i=0;drv[i];i++) if(!strcmp(s,drv[i])) return i; | 278 for(i=0;drv[i];i++) if(!strcmp(s,drv[i])) return i; |
278 | 279 |
279 return -1; | 280 return -1; |
280 } | 281 } |
282 #endif | |
281 | 283 |
282 static int validate_codec(codecs_t *c, int type) | 284 static int validate_codec(codecs_t *c, int type) |
283 { | 285 { |
284 unsigned int i; | 286 unsigned int i; |
285 char *tmp_name = strdup(c->name); | 287 char *tmp_name = strdup(c->name); |
579 if (!add_to_format(token[0], codec->fourcc,codec->fourccmap)) | 581 if (!add_to_format(token[0], codec->fourcc,codec->fourccmap)) |
580 goto err_out_print_linenum; | 582 goto err_out_print_linenum; |
581 } else if (!strcmp(token[0], "driver")) { | 583 } else if (!strcmp(token[0], "driver")) { |
582 if (get_token(1, 1) < 0) | 584 if (get_token(1, 1) < 0) |
583 goto err_out_parse_error; | 585 goto err_out_parse_error; |
584 if ((codec->driver = get_driver(token[0],codec_type))<0) | 586 if (!(codec->drv = strdup(token[0]))) { |
585 goto err_out_parse_error; | 587 mp_msg(MSGT_CODECCFG,MSGL_ERR,"can't strdup -> 'driver': %s\n", strerror(errno)); |
588 goto err_out; | |
589 } | |
586 } else if (!strcmp(token[0], "dll")) { | 590 } else if (!strcmp(token[0], "dll")) { |
587 if (get_token(1, 1) < 0) | 591 if (get_token(1, 1) < 0) |
588 goto err_out_parse_error; | 592 goto err_out_parse_error; |
589 if (!(codec->dll = strdup(token[0]))) { | 593 if (!(codec->dll = strdup(token[0]))) { |
590 mp_msg(MSGT_CODECCFG,MSGL_ERR,"can't strdup -> 'dll': %s\n", strerror(errno)); | 594 mp_msg(MSGT_CODECCFG,MSGL_ERR,"can't strdup -> 'dll': %s\n", strerror(errno)); |
649 } else if (!strcmp(token[0], "cpuflags")) { | 653 } else if (!strcmp(token[0], "cpuflags")) { |
650 if (get_token(1, 1) < 0) | 654 if (get_token(1, 1) < 0) |
651 goto err_out_parse_error; | 655 goto err_out_parse_error; |
652 if (!(codec->cpuflags = get_cpuflags(token[0]))) | 656 if (!(codec->cpuflags = get_cpuflags(token[0]))) |
653 goto err_out_parse_error; | 657 goto err_out_parse_error; |
654 } else if (!strcasecmp(token[0], "priority")) { | |
655 if (get_token(1, 1) < 0) | |
656 goto err_out_parse_error; | |
657 //printf("\n\n!!!cfg-parse: priority %s (%d) found!!!\n\n", token[0], atoi(token[0])); // ::atmos | |
658 codec->priority = atoi(token[0]); | |
659 } else | 658 } else |
660 goto err_out_parse_error; | 659 goto err_out_parse_error; |
661 } | 660 } |
662 if (!validate_codec(codec, codec_type)) | 661 if (!validate_codec(codec, codec_type)) |
663 goto err_out_not_valid; | 662 goto err_out_not_valid; |
736 } | 735 } |
737 if(!i) return NULL; | 736 if(!i) return NULL; |
738 for (/* NOTHING */; i--; c++) { | 737 for (/* NOTHING */; i--; c++) { |
739 if(start && c<=start) continue; | 738 if(start && c<=start) continue; |
740 for (j = 0; j < CODECS_MAX_FOURCC; j++) { | 739 for (j = 0; j < CODECS_MAX_FOURCC; j++) { |
741 if (c->fourcc[j]==fourcc || c->driver==0) { | 740 // FIXME: do NOT hardwire 'null' name here: |
741 if (c->fourcc[j]==fourcc || !strcmp(c->drv,"null")) { | |
742 if (fourccmap) | 742 if (fourccmap) |
743 *fourccmap = c->fourccmap[j]; | 743 *fourccmap = c->fourccmap[j]; |
744 return c; | 744 return c; |
745 } | 745 } |
746 } | 746 } |
785 case CODECS_STATUS_PROBLEMS: s="problems";break; | 785 case CODECS_STATUS_PROBLEMS: s="problems";break; |
786 case CODECS_STATUS_NOT_WORKING: s="crashing";break; | 786 case CODECS_STATUS_NOT_WORKING: s="crashing";break; |
787 case CODECS_STATUS_UNTESTED: s="untested";break; | 787 case CODECS_STATUS_UNTESTED: s="untested";break; |
788 } | 788 } |
789 if(c->dll) | 789 if(c->dll) |
790 mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s%2d %s %s [%s]\n",c->name,c->driver,s,c->info,c->dll); | 790 mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-6s %s %s [%s]\n",c->name,c->drv,s,c->info,c->dll); |
791 else | 791 else |
792 mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s%2d %s %s\n",c->name,c->driver,s,c->info); | 792 mp_msg(MSGT_CODECCFG,MSGL_INFO,"%-11s %-6s %s %s\n",c->name,c->drv,s,c->info); |
793 | 793 |
794 } | 794 } |
795 | 795 |
796 } | 796 } |
797 | 797 |