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:
parent
197062715e
commit
e0faf28d8e
@ -577,6 +577,11 @@ codecs_t **parse_codec_cfg(char *cfgfile)
|
||||
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;
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ typedef struct codecs_st {
|
||||
short flags;
|
||||
short status;
|
||||
short cpuflags;
|
||||
short priority;
|
||||
} codecs_t;
|
||||
|
||||
codecs_t** parse_codec_cfg(char *cfgfile);
|
||||
|
17
mencoder.c
17
mencoder.c
@ -411,6 +411,9 @@ sh_video->codec=NULL;
|
||||
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 @@ while(1){
|
||||
}
|
||||
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];
|
||||
|
Loading…
Reference in New Issue
Block a user