[Mplayer-cvslog] CVS: main codec-cfg.c,1.51,1.52 codec-cfg.h,1.26,1.27 mplayer.c,1.346,1.347 mencoder.c,1.46,1.47
Atmosfear
atmos4 at mplayer.dev.hu
Sun Dec 23 12:59:05 CET 2001
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv30259
Modified Files:
codec-cfg.c codec-cfg.h mplayer.c mencoder.c
Log Message:
add support for priotity <int> in codecs.conf, higher numbers are better
Index: codec-cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- codec-cfg.c 21 Dec 2001 16:39:54 -0000 1.51
+++ codec-cfg.c 23 Dec 2001 11:58:57 -0000 1.52
@@ -577,6 +577,11 @@
goto err_out_parse_error;
if (!(codec->cpuflags = get_cpuflags(token[0])))
goto err_out_parse_error;
+ } else if (!strcasecmp(token[0], "priority")) {
+ if (get_token(1, 1) < 0)
+ goto err_out_parse_error;
+ //printf("\n\n!!!cfg-parse: priority %s (%d) found!!!\n\n", token[0], atoi(token[0])); // ::atmos
+ codec->priority = atoi(token[0]);
} else
goto err_out_parse_error;
}
Index: codec-cfg.h
===================================================================
RCS file: /cvsroot/mplayer/main/codec-cfg.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- codec-cfg.h 21 Dec 2001 16:39:54 -0000 1.26
+++ codec-cfg.h 23 Dec 2001 11:58:57 -0000 1.27
@@ -73,6 +73,7 @@
short flags;
short status;
short cpuflags;
+ short priority;
} codecs_t;
codecs_t** parse_codec_cfg(char *cfgfile);
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.346
retrieving revision 1.347
diff -u -r1.346 -r1.347
--- mplayer.c 19 Dec 2001 16:55:31 -0000 1.346
+++ mplayer.c 23 Dec 2001 11:58:57 -0000 1.347
@@ -1020,10 +1020,13 @@
// Go through the codec.conf and find the best codec...
sh_video->codec=NULL;
if(video_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
+{
+short bestprio=-1;
+struct codecs_st *bestcodec=NULL;
while(1){
sh_video->codec=find_codec(sh_video->format,
sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
- if(!sh_video->codec){
+ if(!sh_video->codec && bestprio==-1){
if(video_family!=-1) {
sh_video->codec=NULL; /* re-search */
mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CantFindVfmtFallback);
@@ -1038,10 +1041,22 @@
if(!allow_dshow && sh_video->codec->driver==VFM_DSHOW) continue; // skip DShow
else if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
+ else if(sh_video->codec && sh_video->codec->priority > bestprio) {
+ //printf("\n\n!!! setting bestprio from %d to %d for %s!!!\n\n", bestprio, sh_video->codec->priority, sh_video->codec->name);
+ bestprio=sh_video->codec->priority;
+ bestcodec=sh_video->codec;
+ continue;
+ }
break;
}
+if(bestprio!=-1) {
+ //printf("chose codec %s by priority.\n", bestcodec->name);
+ sh_video->codec=bestcodec;
+}
+
+}
-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);
+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);
for(i=0;i<CODECS_MAX_OUTFMT;i++){
// int ret;
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- mencoder.c 22 Dec 2001 16:59:10 -0000 1.46
+++ mencoder.c 23 Dec 2001 11:58:57 -0000 1.47
@@ -411,6 +411,9 @@
if(out_video_codec>1){
if(video_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
+{
+short bestprio=-1;
+struct codecs_st *bestcodec=NULL;
while(1){
sh_video->codec=find_codec(sh_video->format,
sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
@@ -427,10 +430,22 @@
}
if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
+ else if(sh_video->codec && sh_video->codec->priority > bestprio) {
+ //printf("\n\n!!! setting bestprio from %d to %d for %s!!!\n\n", bestprio, sh_video->codec->priority, sh_video->codec->name);
+ bestprio=sh_video->codec->priority;
+ bestcodec=sh_video->codec;
+ continue;
+ }
break;
}
+if(bestprio!=-1) {
+ //printf("chose codec %s by priority.\n", bestcodec->name);
+ sh_video->codec=bestcodec;
+}
+
+}
-mp_msg(MSGT_MENCODER,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);
+mp_msg(MSGT_MENCODER,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);
for(i=0;i<CODECS_MAX_OUTFMT;i++){
out_fmt=sh_video->codec->outfmt[i];
More information about the MPlayer-cvslog
mailing list