restore original bih->biCompression if codec init failed

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6231 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-05-29 22:39:25 +00:00
parent b600c44f46
commit d2eef7bb8a
1 changed files with 9 additions and 4 deletions

View File

@ -135,13 +135,18 @@ void uninit_video(sh_video_t *sh_video){
}
int init_video(sh_video_t *sh_video,char* codecname,int vfm,int status){
unsigned int orig_fourcc=sh_video->bih?sh_video->bih->biCompression:0;
sh_video->codec=NULL;
sh_video->vf_inited=0;
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
while(1){
int i;
// restore original fourcc:
if(sh_video->bih) sh_video->bih->biCompression=orig_fourcc;
if(!(sh_video->codec=find_codec(sh_video->format,
sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,
sh_video->codec,0) )) break;
// ok we found one codec
if(sh_video->codec->flags&CODECS_FLAG_SELECTED) continue; // already tried & failed
if(codecname && strcmp(sh_video->codec->name,codecname)) continue; // -vc
if(vfm>=0 && sh_video->codec->driver!=vfm) continue; // vfm doesn't match