diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-10-05 00:08:58 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-10-05 00:08:58 +0000 |
commit | 0898f2141acffa04b082863704d7d1b69ccd3a00 (patch) | |
tree | 03a6745f4b5832aa68ce94e031a0563fce5a781d | |
parent | d6e14e8c5f885823edc74e78807b024acd2c2b03 (diff) |
divx.dll o_bih workaround, postprocessing support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2088 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | dec_video.c | 11 | ||||
-rw-r--r-- | dll_init.c | 25 | ||||
-rw-r--r-- | dll_init.h | 1 |
3 files changed, 33 insertions, 4 deletions
diff --git a/dec_video.c b/dec_video.c index 07c42406cc..a6c70bf2d8 100644 --- a/dec_video.c +++ b/dec_video.c @@ -95,6 +95,11 @@ void convert_linux(unsigned char *puc_y, int stride_y, 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 @@ int get_video_quality_max(sh_video_t *sh_video){ 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; diff --git a/dll_init.c b/dll_init.c index 3fad062aca..8ec9fb8dc0 100644 --- a/dll_init.c +++ b/dll_init.c @@ -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 @@ int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int minlen,int maxlen) 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 @@ int init_vfw_video_codec(sh_video_t *sh_video,int ex){ // 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,11 +302,18 @@ int init_vfw_video_codec(sh_video_t *sh_video,int ex){ 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){ HRESULT ret; diff --git a/dll_init.h b/dll_init.h index 8864d9d5ba..89e90a6350 100644 --- a/dll_init.h +++ b/dll_init.h @@ -8,3 +8,4 @@ int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int minlen,int maxlen) 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); |