Mercurial > mplayer.hg
comparison dll_init.c @ 2087:fbf7ce9401ff
divx.dll o_bih workaround, postprocessing support
author | arpi |
---|---|
date | Fri, 05 Oct 2001 00:08:58 +0000 |
parents | df41903fd7d7 |
children | ae59ad941b42 |
comparison
equal
deleted
inserted
replaced
2086:ae67940c9d12 | 2087:fbf7ce9401ff |
---|---|
20 | 20 |
21 #include "dll_init.h" | 21 #include "dll_init.h" |
22 | 22 |
23 #include "libvo/img_format.h" | 23 #include "libvo/img_format.h" |
24 #include "linux/shmem.h" | 24 #include "linux/shmem.h" |
25 | |
26 extern int divx_quality; | |
25 | 27 |
26 // ACM audio and VfW video codecs initialization | 28 // ACM audio and VfW video codecs initialization |
27 // based on the avifile library [http://divx.euro.ru] | 29 // based on the avifile library [http://divx.euro.ru] |
28 | 30 |
29 int init_acm_audio_codec(sh_audio_t *sh_audio){ | 31 int init_acm_audio_codec(sh_audio_t *sh_audio){ |
139 mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamUnprepareHeader error %d\n",(int)hr); | 141 mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamUnprepareHeader error %d\n",(int)hr); |
140 } | 142 } |
141 return len; | 143 return len; |
142 } | 144 } |
143 | 145 |
144 | |
145 | |
146 int init_vfw_video_codec(sh_video_t *sh_video,int ex){ | 146 int init_vfw_video_codec(sh_video_t *sh_video,int ex){ |
147 HRESULT ret; | 147 HRESULT ret; |
148 int yuv=0; | 148 int yuv=0; |
149 unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx]; | 149 unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx]; |
150 unsigned char temp[1024]; | |
151 int i; | |
150 | 152 |
151 mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Codec init =======\n"); | 153 mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Codec init =======\n"); |
152 | 154 |
153 memset(&sh_video->o_bih, 0, sizeof(BITMAPINFOHEADER)); | 155 memset(&sh_video->o_bih, 0, sizeof(BITMAPINFOHEADER)); |
154 sh_video->o_bih.biSize = sizeof(BITMAPINFOHEADER); | 156 sh_video->o_bih.biSize = sizeof(BITMAPINFOHEADER); |
161 return 0; | 163 return 0; |
162 } | 164 } |
163 | 165 |
164 // sh_video->bih.biBitCount=32; | 166 // sh_video->bih.biBitCount=32; |
165 | 167 |
166 ret = ICDecompressGetFormat(sh_video->hic, sh_video->bih, &sh_video->o_bih); | 168 // Note: DivX.DLL overwrites 4 bytes _AFTER_ the o_bih header, so it corrupts |
169 // the sh_video struct content. We call it with an 1024-byte temp space and | |
170 // then copy out the data we need: | |
171 memset(temp,0x77,1024); | |
172 | |
173 ret = ICDecompressGetFormat(sh_video->hic, sh_video->bih, temp); | |
167 if(ret){ | 174 if(ret){ |
168 mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret); | 175 mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret); |
169 return 0; | 176 return 0; |
170 } | 177 } |
171 mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormat OK\n"); | 178 mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormat OK\n"); |
179 | |
180 memcpy(&sh_video->o_bih,temp,sizeof(sh_video->o_bih)); | |
181 // for(i=0;i<1024;i++) printf("%02X ",temp[i]); | |
172 | 182 |
173 // printf("ICM_DECOMPRESS_QUERY=0x%X",ICM_DECOMPRESS_QUERY); | 183 // printf("ICM_DECOMPRESS_QUERY=0x%X",ICM_DECOMPRESS_QUERY); |
174 | 184 |
175 // sh_video->o_bih.biWidth=sh_video->bih.biWidth; | 185 // sh_video->o_bih.biWidth=sh_video->bih.biWidth; |
176 // sh_video->o_bih.biCompression = 0x32315659; // mmioFOURCC('U','Y','V','Y'); | 186 // sh_video->o_bih.biCompression = 0x32315659; // mmioFOURCC('U','Y','V','Y'); |
290 | 300 |
291 if(yuv && sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK) | 301 if(yuv && sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK) |
292 sh_video->o_bih.biCompression = outfmt; | 302 sh_video->o_bih.biCompression = outfmt; |
293 | 303 |
294 // avi_header.our_in_buffer=malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!! | 304 // avi_header.our_in_buffer=malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!! |
295 | 305 |
306 ICSendMessage(sh_video->hic, ICM_USER+80, (long)(&divx_quality) ,NULL); | |
307 | |
296 mp_msg(MSGT_WIN32,MSGL_V,"VIDEO CODEC Init OK!!! ;-)\n"); | 308 mp_msg(MSGT_WIN32,MSGL_V,"VIDEO CODEC Init OK!!! ;-)\n"); |
297 return 1; | 309 return 1; |
310 } | |
311 | |
312 int vfw_set_postproc(sh_video_t* sh_video,int quality){ | |
313 // Works only with opendivx/divx4 based DLL | |
314 return ICSendMessage(sh_video->hic, ICM_USER+80, (long)(&quality) ,NULL); | |
298 } | 315 } |
299 | 316 |
300 int vfw_decode_video(sh_video_t* sh_video,void* start,int in_size,int drop_frame,int ex){ | 317 int vfw_decode_video(sh_video_t* sh_video,void* start,int in_size,int drop_frame,int ex){ |
301 HRESULT ret; | 318 HRESULT ret; |
302 | 319 |