summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/dec_video.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-05-29 22:39:25 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-05-29 22:39:25 +0000
commitd2eef7bb8a16d73e21342ad92662b63e2e34bdbd (patch)
tree78962b48bd1847613f6f7ea7cb80b862c4381a54 /libmpcodecs/dec_video.c
parentb600c44f46b06469b7b50b8e8dabf1e3e96152ca (diff)
downloadmpv-d2eef7bb8a16d73e21342ad92662b63e2e34bdbd.tar.bz2
mpv-d2eef7bb8a16d73e21342ad92662b63e2e34bdbd.tar.xz
restore original bih->biCompression if codec init failed
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6231 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/dec_video.c')
-rw-r--r--libmpcodecs/dec_video.c13
1 files 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