summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-26 01:31:18 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-26 01:31:18 +0000
commit50de15356ad928c225b9666449ed968908e96c28 (patch)
tree6f3fa7416a0ee193757d6d050c5d93c15caa2ee2
parente8cc8584f11c70dbbfe9c28211aa763964167576 (diff)
downloadmpv-50de15356ad928c225b9666449ed968908e96c28.tar.bz2
mpv-50de15356ad928c225b9666449ed968908e96c28.tar.xz
-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
-rw-r--r--cfg-common.h4
-rw-r--r--libmpcodecs/dec_video.c35
-rw-r--r--libmpcodecs/dec_video.h2
-rw-r--r--mencoder.c4
-rw-r--r--mplayer.c16
5 files changed, 44 insertions, 17 deletions
diff --git a/cfg-common.h b/cfg-common.h
index 624e74148d..7b36eb5e74 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -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",
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index a29e95cf3a..589887a305 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -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
}
diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h
index 5663b9071f..c4865e43a2 100644
--- a/libmpcodecs/dec_video.h
+++ b/libmpcodecs/dec_video.h
@@ -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);
diff --git a/mencoder.c b/mencoder.c
index ca079fe83f..cdf9735767 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -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);
diff --git a/mplayer.c b/mplayer.c
index 74b3d0a4c9..139c5990e2 100644
--- a/mplayer.c
+++ b/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){