diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-03-18 01:47:14 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-03-18 01:47:14 +0000 |
commit | 52ffa1525626606d246930421ce807439e3537f0 (patch) | |
tree | 06a110e92dafec57a0e109193ea95d81a5ae5e06 | |
parent | cc65feabd19a9a874a8529d358aa46f6bd9c2ec6 (diff) | |
download | mpv-52ffa1525626606d246930421ce807439e3537f0.tar.bz2 mpv-52ffa1525626606d246930421ce807439e3537f0.tar.xz |
init_video() changed - now it handles codec selection
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5172 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/dec_video.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index b04777cd36..db374211d6 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -116,34 +116,36 @@ void uninit_video(sh_video_t *sh_video){ sh_video->inited=0; } -int init_video(sh_video_t *sh_video,int *pitches) -{ -//unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx]; -int i; -//pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */ - -//sh_video->our_out_buffer=NULL; -//sh_video->our_out_buffer_size=0U; - - for (i=0; mpcodecs_vd_drivers[i] != NULL; i++) - if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver){ - mpvdec=mpcodecs_vd_drivers[i]; break; +int init_video(sh_video_t *sh_video,char* codecname,int vfm,int status){ + sh_video->codec=NULL; + while((sh_video->codec=find_codec(sh_video->format, + sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL, + sh_video->codec,0) )){ + // ok we found one codec + int i; + if(codecname && strcmp(sh_video->codec->name,codecname)) continue; // -vc + if(vfm>=0 && sh_video->codec->driver!=vfm) continue; // vfm doesn't match + if(sh_video->codec->status<status) continue; // too unstable + // ok, it matches all rules, let's find the driver! + for (i=0; mpcodecs_vd_drivers[i] != NULL; i++) + if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver) break; + mpvdec=mpcodecs_vd_drivers[i]; + if(!mpvdec){ // driver not available (==compiled in) + mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Requested video codec family [%s] (vfm=%d) not available (enable it at compile time!)\n", + sh_video->codec->name, sh_video->codec->driver); + continue; + } + // it's available, let's try to init! + printf("Opening Video Decoder: [%s] %s\n",mpvdec->info->short_name,mpvdec->info->name); + if(!mpvdec->init(sh_video)){ + printf("VDecoder init failed :(\n"); + continue; // try next... + } + // Yeah! We got it! + sh_video->inited=1; + return 1; } - if(!mpvdec){ - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Requested video codec family [%s] (vfm=%d) not available (enable it at compile time!)\n", - sh_video->codec->name, sh_video->codec->driver); - return 0; // no such driver - } - - printf("Selecting Video Decoder: [%s] %s\n",mpvdec->info->short_name,mpvdec->info->name); - - if(!mpvdec->init(sh_video)){ - printf("VDecoder init failed :(\n"); - return 0; - } - - sh_video->inited=1; - return 1; + return 0; } extern int vaa_use_dr; |