[Mplayer-cvslog] CVS: main dll_init.c,1.29,1.30 dll_init.h,1.1,1.2 dec_video.c,1.44,1.45

Arpi of Ize arpi at mplayer.dev.hu
Fri Oct 5 02:09:15 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv28000

Modified Files:
	dll_init.c dll_init.h dec_video.c 
Log Message:
divx.dll o_bih workaround, postprocessing support

Index: dll_init.c
===================================================================
RCS file: /cvsroot/mplayer/main/dll_init.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- dll_init.c	2 Oct 2001 21:44:45 -0000	1.29
+++ dll_init.c	5 Oct 2001 00:08:58 -0000	1.30
@@ -23,6 +23,8 @@
 #include "libvo/img_format.h"
 #include "linux/shmem.h"
 
+extern int divx_quality;
+
 // ACM audio and VfW video codecs initialization
 // based on the avifile library [http://divx.euro.ru]
 
@@ -141,12 +143,12 @@
         return len;
 }
 
-
-
 int init_vfw_video_codec(sh_video_t *sh_video,int ex){
   HRESULT ret;
   int yuv=0;
   unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx];
+  unsigned char temp[1024];
+  int i;
 
   mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Codec init =======\n");
 
@@ -163,13 +165,21 @@
 
 //  sh_video->bih.biBitCount=32;
 
-  ret = ICDecompressGetFormat(sh_video->hic, sh_video->bih, &sh_video->o_bih);
+  // Note: DivX.DLL overwrites 4 bytes _AFTER_ the o_bih header, so it corrupts
+  // the sh_video struct content. We call it with an 1024-byte temp space and
+  // then copy out the data we need:
+  memset(temp,0x77,1024);
+
+  ret = ICDecompressGetFormat(sh_video->hic, sh_video->bih, temp);
   if(ret){
     mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret);
     return 0;
   }
   mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormat OK\n");
   
+  memcpy(&sh_video->o_bih,temp,sizeof(sh_video->o_bih));
+  // for(i=0;i<1024;i++) printf("%02X ",temp[i]);
+  
 //  printf("ICM_DECOMPRESS_QUERY=0x%X",ICM_DECOMPRESS_QUERY);
 
 //  sh_video->o_bih.biWidth=sh_video->bih.biWidth;
@@ -292,9 +302,16 @@
     sh_video->o_bih.biCompression = outfmt;
 
 //  avi_header.our_in_buffer=malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!!
-  
+
+  ICSendMessage(sh_video->hic, ICM_USER+80, (long)(&divx_quality) ,NULL);
+
   mp_msg(MSGT_WIN32,MSGL_V,"VIDEO CODEC Init OK!!! ;-)\n");
   return 1;
+}
+
+int vfw_set_postproc(sh_video_t* sh_video,int quality){
+  // Works only with opendivx/divx4 based DLL
+  return ICSendMessage(sh_video->hic, ICM_USER+80, (long)(&quality) ,NULL);
 }
 
 int vfw_decode_video(sh_video_t* sh_video,void* start,int in_size,int drop_frame,int ex){

Index: dll_init.h
===================================================================
RCS file: /cvsroot/mplayer/main/dll_init.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dll_init.h	2 Oct 2001 21:44:45 -0000	1.1
+++ dll_init.h	5 Oct 2001 00:08:58 -0000	1.2
@@ -8,3 +8,4 @@
 
 int init_vfw_video_codec(sh_video_t *sh_video,int ex);
 int vfw_decode_video(sh_video_t* sh_video,void* start,int in_size,int drop_frame,int ex);
+int vfw_set_postproc(sh_video_t* sh_video,int quality);

Index: dec_video.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_video.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- dec_video.c	2 Oct 2001 21:44:45 -0000	1.44
+++ dec_video.c	5 Oct 2001 00:08:58 -0000	1.45
@@ -95,6 +95,11 @@
 
 int get_video_quality_max(sh_video_t *sh_video){
  switch(sh_video->codec->driver){
+#ifdef USE_WIN32DLL
+  case VFM_VFW:
+  case VFM_VFWEX:
+      return 6;
+#endif
 #ifdef USE_DIRECTSHOW
   case VFM_DSHOW:
       return 4;
@@ -111,6 +116,12 @@
 
 void set_video_quality(sh_video_t *sh_video,int quality){
  switch(sh_video->codec->driver){
+#ifdef USE_WIN32DLL
+  case VFM_VFW:
+  case VFM_VFWEX:
+   vfw_set_postproc(sh_video,10*quality);
+  break;
+#endif
 #ifdef USE_DIRECTSHOW
   case VFM_DSHOW: {
    if(quality<0 || quality>4) quality=4;




More information about the MPlayer-cvslog mailing list