changeset 489:2bb59b7c748a

BGR modes with VfW codecs fixed - biCompression must be 0 for BGR...
author arpi_esp
date Tue, 17 Apr 2001 19:23:47 +0000
parents 108be5ee3b1a
children caf5ddb0d19a
files dll_init.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dll_init.c	Tue Apr 17 19:05:59 2001 +0000
+++ b/dll_init.c	Tue Apr 17 19:23:47 2001 +0000
@@ -102,6 +102,7 @@
 
 int init_video_codec(){
   HRESULT ret;
+  int yuv=0;
   unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx];
 
   if(verbose) printf("======= Win32 (VFW) VIDEO Codec init =======\n");
@@ -146,6 +147,7 @@
   case IMGFMT_I420:
   case IMGFMT_IYUV:
       sh_video->o_bih.biBitCount=12;
+      yuv=1;
       break;
 
 /* packed format */
@@ -153,6 +155,7 @@
   case IMGFMT_UYVY:
   case IMGFMT_YVYU:
       sh_video->o_bih.biBitCount=16;
+      yuv=1;
       break;
 
 /* rgb/bgr format */
@@ -189,7 +192,7 @@
       sh_video->o_bih.biHeight=-sh_video->bih->biHeight; // flip image!
   }
 
-  if(!(sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK))
+  if(yuv && !(sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK))
 	 sh_video->o_bih.biCompression = outfmt;
 
   if(verbose) {
@@ -244,7 +247,7 @@
     return 0;
   }
 
-  if(sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK)
+  if(yuv && sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK)
     sh_video->o_bih.biCompression = outfmt;
 
 //  avi_header.our_in_buffer=malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!!