mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 23:32:26 +00:00
-vc/-vfm accepts codec/driver _list_ now. empty list element for -vc means
*, ie search all codecs. codec name starting with - disables the codec. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7507 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e8cc8584f1
commit
50de15356a
@ -107,9 +107,9 @@
|
||||
// {"afm", &audio_family, CONF_TYPE_INT, CONF_MIN, 0, 22, NULL}, // keep ranges in sync
|
||||
// {"vfm", &video_family, CONF_TYPE_INT, CONF_MIN, 0, 29, NULL}, // with codec-cfg.c
|
||||
{"afm", &audio_fm, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"vfm", &video_fm, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"vfm", &video_fm_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
|
||||
{"ac", &audio_codec, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"vc", &video_codec, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"vc", &video_codec_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
|
||||
|
||||
// postprocessing:
|
||||
{"divxq", "Option -divxq has been renamed to -pp (postprocessing), use -pp !\n",
|
||||
|
@ -204,26 +204,41 @@ int init_video(sh_video_t *sh_video,char* codecname,char* vfm,int status){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int init_best_video_codec(sh_video_t *sh_video,char* video_codec,char* video_fm){
|
||||
int init_best_video_codec(sh_video_t *sh_video,char** video_codec_list,char** video_fm_list){
|
||||
char* vc_l_default[2]={"",(char*)NULL};
|
||||
// hack:
|
||||
if(!video_codec_list) video_codec_list=vc_l_default;
|
||||
// Go through the codec.conf and find the best codec...
|
||||
sh_video->inited=0;
|
||||
codecs_reset_selection(0);
|
||||
if(video_codec){
|
||||
// forced codec by name:
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_ForcedVideoCodec,video_codec);
|
||||
init_video(sh_video,video_codec,NULL,-1);
|
||||
} else {
|
||||
while(!sh_video->inited && *video_codec_list){
|
||||
char* video_codec=*(video_codec_list++);
|
||||
if(video_codec[0]){
|
||||
if(video_codec[0]=='-'){
|
||||
// disable this codec:
|
||||
select_codec(video_codec+1,0);
|
||||
} else {
|
||||
// forced codec by name:
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_ForcedVideoCodec,video_codec);
|
||||
init_video(sh_video,video_codec,NULL,-1);
|
||||
}
|
||||
} else {
|
||||
int status;
|
||||
// try in stability order: UNTESTED, WORKING, BUGGY. never try CRASHING.
|
||||
if(video_fm){
|
||||
// try first the preferred codec family:
|
||||
if(video_fm_list){
|
||||
char** fmlist=video_fm_list;
|
||||
// try first the preferred codec families:
|
||||
while(!sh_video->inited && *fmlist){
|
||||
char* video_fm=*(fmlist++);
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_TryForceVideoFmtStr,video_fm);
|
||||
for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
|
||||
if(init_video(sh_video,NULL,video_fm,status)) break;
|
||||
}
|
||||
}
|
||||
if(!sh_video->inited)
|
||||
for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
|
||||
if(init_video(sh_video,NULL,NULL,status)) break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!sh_video->inited){
|
||||
@ -232,8 +247,8 @@ if(!sh_video->inited){
|
||||
return 0; // failed
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_INFO,"%s video codec: [%s] vfm:%s (%s)\n",
|
||||
video_codec?mp_gettext("Forcing"):mp_gettext("Detected"),sh_video->codec->name,sh_video->codec->drv,sh_video->codec->info);
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_INFO,"Selected video codec: [%s] vfm:%s (%s)\n",
|
||||
sh_video->codec->name,sh_video->codec->drv,sh_video->codec->info);
|
||||
return 1; // success
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ extern int video_read_properties(sh_video_t *sh_video);
|
||||
|
||||
extern void vfm_help();
|
||||
|
||||
extern int init_best_video_codec(sh_video_t *sh_video,char* video_codec,char* video_fm);
|
||||
extern int init_best_video_codec(sh_video_t *sh_video,char** video_codec_list,char** video_fm_list);
|
||||
|
||||
//extern int init_video(sh_video_t *sh_video, int *pitches);
|
||||
extern int init_video(sh_video_t *sh_video,char* codecname,char* vfm,int status);
|
||||
|
@ -94,8 +94,10 @@ static char* spudec_ifo=NULL;
|
||||
static int has_audio=1;
|
||||
char *audio_codec=NULL; // override audio codec
|
||||
char *video_codec=NULL; // override video codec
|
||||
char **video_codec_list=NULL; // override video codec
|
||||
char* audio_fm=NULL; // override audio codec family
|
||||
char* video_fm=NULL; // override video codec family
|
||||
char** video_fm_list=NULL; // override video codec family
|
||||
|
||||
int out_audio_codec=-1;
|
||||
int out_video_codec=-1;
|
||||
@ -633,7 +635,7 @@ default:
|
||||
sh_video->vfilter=append_filters(sh_video->vfilter);
|
||||
|
||||
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
|
||||
init_best_video_codec(sh_video,video_codec,video_fm);
|
||||
init_best_video_codec(sh_video,video_codec_list,video_fm_list);
|
||||
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
|
||||
if(!sh_video->inited) mencoder_exit(1,NULL);
|
||||
|
||||
|
16
mplayer.c
16
mplayer.c
@ -177,8 +177,10 @@ int has_audio=1;
|
||||
int has_video=1;
|
||||
char *audio_codec=NULL; // override audio codec
|
||||
char *video_codec=NULL; // override video codec
|
||||
char **video_codec_list=NULL; // override video codec
|
||||
char *audio_fm=NULL; // override audio codec family
|
||||
char *video_fm=NULL; // override video codec family
|
||||
char **video_fm_list=NULL; // override video codec family
|
||||
|
||||
// streaming:
|
||||
int audio_id=-1;
|
||||
@ -619,19 +621,27 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(video_codec_list){
|
||||
int i;
|
||||
video_codec=video_codec_list[0];
|
||||
for(i=0;video_codec_list[i];i++)
|
||||
printf("vc#%d: '%s'\n",i,video_codec_list[i]);
|
||||
}
|
||||
#endif
|
||||
if(audio_codec && strcmp(audio_codec,"help")==0){
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableAudioCodecs);
|
||||
list_codecs(1);
|
||||
printf("\n");
|
||||
exit(0);
|
||||
}
|
||||
if(video_codec && strcmp(video_codec,"help")==0){
|
||||
if(video_codec_list && strcmp(video_codec_list[0],"help")==0){
|
||||
mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableVideoCodecs);
|
||||
list_codecs(0);
|
||||
printf("\n");
|
||||
exit(0);
|
||||
}
|
||||
if(video_fm && strcmp(video_fm,"help")==0){
|
||||
if(video_fm_list && strcmp(video_fm_list[0],"help")==0){
|
||||
vfm_help();
|
||||
printf("\n");
|
||||
exit(0);
|
||||
@ -1234,7 +1244,7 @@ sh_video->vfilter=append_filters(sh_video->vfilter);
|
||||
current_module="init_video_codec";
|
||||
|
||||
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
|
||||
init_best_video_codec(sh_video,video_codec,video_fm);
|
||||
init_best_video_codec(sh_video,video_codec_list,video_fm_list);
|
||||
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
|
||||
|
||||
if(!sh_video->inited){
|
||||
|
Loading…
Reference in New Issue
Block a user