comparison mplayer.c @ 3712:d846a89e609a

fixed priority support, tested with -vfm -vc, etc.
author atmos4
date Mon, 24 Dec 2001 14:01:55 +0000
parents 772729dd7b40
children c8a267dc9941
comparison
equal deleted inserted replaced
3711:5fa7eb90e2ec 3712:d846a89e609a
1018 current_module="init_video_codec"; 1018 current_module="init_video_codec";
1019 1019
1020 // Go through the codec.conf and find the best codec... 1020 // Go through the codec.conf and find the best codec...
1021 sh_video->codec=NULL; 1021 sh_video->codec=NULL;
1022 if(video_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family); 1022 if(video_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
1023 { /* local vars */
1024 short bestprio=-1;
1025 struct codecs_st *bestcodec=NULL;
1023 while(1){ 1026 while(1){
1024 sh_video->codec=find_codec(sh_video->format, 1027 sh_video->codec=find_codec(sh_video->format,
1025 sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0); 1028 sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
1026 if(!sh_video->codec){ 1029 if(!sh_video->codec/* && bestprio==-1*/){
1027 if(video_family!=-1) { 1030 if(video_family!=-1) {
1028 sh_video->codec=NULL; /* re-search */ 1031 //sh_video->codec=NULL; /* re-search */
1029 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CantFindVfmtFallback); 1032 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CantFindVfmtFallback);
1030 video_family=-1; 1033 video_family=-1;
1031 continue; 1034 continue;
1032 } 1035 }
1036 if(bestprio==-1 || !video_codec) {
1033 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format); 1037 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
1034 mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); 1038 mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf"));
1035 goto goto_next_file; // exit_player(MSGTR_Exit_error); 1039 goto goto_next_file; // exit_player(MSGTR_Exit_error);
1036 } 1040 }
1037 // is next line needed anymore? - atmos :: 1041 } else {
1038 if(!allow_dshow && sh_video->codec->driver==VFM_DSHOW) continue; // skip DShow 1042 // is next line needed anymore? - atmos ::
1039 else if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue; 1043 if(!allow_dshow && sh_video->codec->driver==VFM_DSHOW) continue; // skip DShow
1040 else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue; 1044 else if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
1045 else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
1046 else if(video_family==-1 && !video_codec && sh_video->codec->priority) {
1047 if(sh_video->codec->priority > bestprio) {
1048 //printf("\n\n!!! setting bestprio from %d to %d for %s!!!\n\n", bestprio, sh_video->codec->priority, sh_video->codec->name);
1049 bestprio=sh_video->codec->priority;
1050 bestcodec=sh_video->codec;
1051 }
1052 continue;
1053 }
1054 } /* sh_video->codec */
1041 break; 1055 break;
1042 } 1056 }
1043 1057 if(bestprio!=-1) {
1044 mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->info); 1058 //printf("chose codec %s by priority.\n", bestcodec->name);
1059 sh_video->codec=bestcodec;
1060 }
1061
1062 } /* end local vars */
1063
1064 mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d prio:%d (%s)\n",video_codec?"Forcing":"Detected",sh_video->codec->name,sh_video->codec->driver,sh_video->codec->priority!=-1?sh_video->codec->priority:0,sh_video->codec->info);
1045 1065
1046 for(i=0;i<CODECS_MAX_OUTFMT;i++){ 1066 for(i=0;i<CODECS_MAX_OUTFMT;i++){
1047 // int ret; 1067 // int ret;
1048 out_fmt=sh_video->codec->outfmt[i]; 1068 out_fmt=sh_video->codec->outfmt[i];
1049 if(out_fmt==0xFFFFFFFF) continue; 1069 if(out_fmt==0xFFFFFFFF) continue;