From d2eef7bb8a16d73e21342ad92662b63e2e34bdbd Mon Sep 17 00:00:00 2001 From: arpi Date: Wed, 29 May 2002 22:39:25 +0000 Subject: [PATCH] restore original bih->biCompression if codec init failed git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6231 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/dec_video.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index 103e25f0d3..59f044c358 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -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