0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

add support for priotity <int> in codecs.conf, higher numbers are better

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3668 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
atmos4 2001-12-23 11:58:57 +00:00
parent 197062715e
commit e0faf28d8e
3 changed files with 22 additions and 1 deletions

View File

@ -577,6 +577,11 @@ codecs_t **parse_codec_cfg(char *cfgfile)
goto err_out_parse_error; goto err_out_parse_error;
if (!(codec->cpuflags = get_cpuflags(token[0]))) if (!(codec->cpuflags = get_cpuflags(token[0])))
goto err_out_parse_error; 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 } else
goto err_out_parse_error; goto err_out_parse_error;
} }

View File

@ -73,6 +73,7 @@ typedef struct codecs_st {
short flags; short flags;
short status; short status;
short cpuflags; short cpuflags;
short priority;
} codecs_t; } codecs_t;
codecs_t** parse_codec_cfg(char *cfgfile); codecs_t** parse_codec_cfg(char *cfgfile);

View File

@ -411,6 +411,9 @@ sh_video->codec=NULL;
if(out_video_codec>1){ if(out_video_codec>1){
if(video_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family); if(video_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
{
short bestprio=-1;
struct codecs_st *bestcodec=NULL;
while(1){ while(1){
sh_video->codec=find_codec(sh_video->format, sh_video->codec=find_codec(sh_video->format,
sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0); sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
@ -427,10 +430,22 @@ while(1){
} }
if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue; 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(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; 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++){ for(i=0;i<CODECS_MAX_OUTFMT;i++){
out_fmt=sh_video->codec->outfmt[i]; out_fmt=sh_video->codec->outfmt[i];