diff options
author | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-12-23 11:58:57 +0000 |
---|---|---|
committer | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-12-23 11:58:57 +0000 |
commit | e0faf28d8e0beb236c5e53b96f88e89fe6775dc6 (patch) | |
tree | 322ae91a6f5cbc8f82d486a8d2e416ee8ae22feb | |
parent | 197062715e037f604c26a0ce2d24b408c1c7f0a1 (diff) | |
download | mpv-e0faf28d8e0beb236c5e53b96f88e89fe6775dc6.tar.bz2 mpv-e0faf28d8e0beb236c5e53b96f88e89fe6775dc6.tar.xz |
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
-rw-r--r-- | codec-cfg.c | 5 | ||||
-rw-r--r-- | codec-cfg.h | 1 | ||||
-rw-r--r-- | mencoder.c | 17 |
3 files changed, 22 insertions, 1 deletions
diff --git a/codec-cfg.c b/codec-cfg.c index 54e6fbb8e6..68ab3e5045 100644 --- a/codec-cfg.c +++ b/codec-cfg.c @@ -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; } diff --git a/codec-cfg.h b/codec-cfg.h index e9bb61f56e..c2bb91f0a9 100644 --- a/codec-cfg.h +++ b/codec-cfg.h @@ -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); diff --git a/mencoder.c b/mencoder.c index 17fe21711b..8739c57a97 100644 --- a/mencoder.c +++ b/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]; |