changeset 6230:936aa617e829

restore original bih->biCompression if codec init failed
author arpi
date Wed, 29 May 2002 22:39:25 +0000
parents b03cdd8adb32
children 3acbdbc8f212
files libmpcodecs/dec_video.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_video.c	Wed May 29 22:38:34 2002 +0000
+++ b/libmpcodecs/dec_video.c	Wed May 29 22:39:25 2002 +0000
@@ -135,13 +135,18 @@
 }
 
 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) )){
+
+    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
-	int i;
 	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