Mercurial > mplayer.hg
annotate dll_init.c @ 3054:9507f90d8254
add half dvd support for gui
author | pontscho |
---|---|
date | Wed, 21 Nov 2001 17:43:57 +0000 |
parents | 283eab7c4c8e |
children | ae0e2736a5d4 |
rev | line source |
---|---|
2775 | 1 |
2 #include "config.h" | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
3 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
4 #include <stdio.h> |
2775 | 5 #ifdef HAVE_MALLOC_H |
6 #include <malloc.h> | |
7 #endif | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
8 #include <stdlib.h> |
1430 | 9 #include <unistd.h> |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
10 |
1567 | 11 #include "mp_msg.h" |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1653
diff
changeset
|
12 #include "help_mp.h" |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
13 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
14 #include "stream.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
15 #include "demuxer.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
16 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
17 #include "loader.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
18 //#include "wine/mmreg.h" |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
19 #include "wine/vfw.h" |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
20 #include "wine/avifmt.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
21 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
22 #include "codec-cfg.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
23 #include "stheader.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
24 |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
25 #include "dll_init.h" |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
26 |
2897 | 27 #ifdef USE_LIBVO2 |
28 #include "libvo2/img_format.h" | |
29 #else | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
30 #include "libvo/img_format.h" |
2897 | 31 #endif |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
32 #include "linux/shmem.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
489
diff
changeset
|
33 |
2087 | 34 extern int divx_quality; |
35 | |
1 | 36 // ACM audio and VfW video codecs initialization |
37 // based on the avifile library [http://divx.euro.ru] | |
38 | |
296 | 39 int init_acm_audio_codec(sh_audio_t *sh_audio){ |
1 | 40 HRESULT ret; |
432
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
414
diff
changeset
|
41 WAVEFORMATEX *in_fmt=sh_audio->wf; |
1 | 42 unsigned long srcsize=0; |
43 | |
1567 | 44 mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (ACM) AUDIO Codec init =======\n"); |
1 | 45 |
291 | 46 sh_audio->srcstream=NULL; |
1 | 47 |
291 | 48 sh_audio->o_wf.nChannels=in_fmt->nChannels; |
49 sh_audio->o_wf.nSamplesPerSec=in_fmt->nSamplesPerSec; | |
50 sh_audio->o_wf.nAvgBytesPerSec=2*sh_audio->o_wf.nSamplesPerSec*sh_audio->o_wf.nChannels; | |
51 sh_audio->o_wf.wFormatTag=WAVE_FORMAT_PCM; | |
52 sh_audio->o_wf.nBlockAlign=2*in_fmt->nChannels; | |
53 sh_audio->o_wf.wBitsPerSample=16; | |
54 sh_audio->o_wf.cbSize=0; | |
1 | 55 |
303 | 56 win32_codec_name = sh_audio->codec->dll; |
291 | 57 ret=acmStreamOpen(&sh_audio->srcstream,(HACMDRIVER)NULL, |
58 in_fmt,&sh_audio->o_wf, | |
1 | 59 NULL,0,0,0); |
60 if(ret){ | |
61 if(ret==ACMERR_NOTPOSSIBLE) | |
1567 | 62 mp_msg(MSGT_WIN32,MSGL_ERR,"ACM_Decoder: Unappropriate audio format\n"); |
1 | 63 else |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1653
diff
changeset
|
64 mp_msg(MSGT_WIN32,MSGL_ERR,"ACM_Decoder: acmStreamOpen error: %d", (int)ret); |
291 | 65 sh_audio->srcstream=NULL; |
1 | 66 return 0; |
67 } | |
1567 | 68 mp_msg(MSGT_WIN32,MSGL_V,"Audio codec opened OK! ;-)\n"); |
1 | 69 |
631 | 70 acmStreamSize(sh_audio->srcstream, in_fmt->nBlockAlign, &srcsize, ACM_STREAMSIZEF_SOURCE); |
758 | 71 //if(verbose) printf("Audio ACM output buffer min. size: %ld (reported by codec)\n",srcsize); |
746 | 72 srcsize*=2; |
758 | 73 //if(srcsize<MAX_OUTBURST) srcsize=MAX_OUTBURST; |
74 if(!srcsize){ | |
1567 | 75 mp_msg(MSGT_WIN32,MSGL_WARN,"Warning! ACM codec reports srcsize=0\n"); |
758 | 76 srcsize=16384; |
77 } | |
78 // limit srcsize to 4-16kb | |
79 //while(srcsize && srcsize<4096) srcsize*=2; | |
80 //while(srcsize>16384) srcsize/=2; | |
291 | 81 sh_audio->audio_out_minsize=srcsize; // audio output min. size |
1567 | 82 mp_msg(MSGT_WIN32,MSGL_V,"Audio ACM output buffer min. size: %ld\n",srcsize); |
1 | 83 |
746 | 84 acmStreamSize(sh_audio->srcstream, srcsize, &srcsize, ACM_STREAMSIZEF_DESTINATION); |
291 | 85 sh_audio->audio_in_minsize=srcsize; // audio input min. size |
1567 | 86 mp_msg(MSGT_WIN32,MSGL_V,"Audio ACM input buffer min. size: %ld\n",srcsize); |
631 | 87 |
88 if(srcsize<in_fmt->nBlockAlign) srcsize=in_fmt->nBlockAlign; | |
1 | 89 |
631 | 90 sh_audio->a_in_buffer_size=2*sh_audio->audio_in_minsize; |
291 | 91 sh_audio->a_in_buffer=malloc(sh_audio->a_in_buffer_size); |
92 sh_audio->a_in_buffer_len=0; | |
92 | 93 |
1 | 94 return 1; |
95 } | |
96 | |
758 | 97 int acm_decode_audio(sh_audio_t *sh_audio, void* a_buffer,int minlen,int maxlen){ |
92 | 98 ACMSTREAMHEADER ash; |
99 HRESULT hr; | |
100 DWORD srcsize=0; | |
758 | 101 DWORD len=minlen; |
291 | 102 acmStreamSize(sh_audio->srcstream,len , &srcsize, ACM_STREAMSIZEF_DESTINATION); |
1567 | 103 mp_msg(MSGT_WIN32,MSGL_DBG3,"acm says: srcsize=%ld (buffsize=%d) out_size=%d\n",srcsize,sh_audio->a_in_buffer_size,len); |
758 | 104 |
105 if(srcsize<sh_audio->wf->nBlockAlign){ | |
106 srcsize=sh_audio->wf->nBlockAlign; | |
107 acmStreamSize(sh_audio->srcstream, srcsize, &len, ACM_STREAMSIZEF_SOURCE); | |
108 if(len>maxlen) len=maxlen; | |
109 } | |
110 | |
291 | 111 // if(srcsize==0) srcsize=((WAVEFORMATEX *)&sh_audio->o_wf_ext)->nBlockAlign; |
112 if(srcsize>sh_audio->a_in_buffer_size) srcsize=sh_audio->a_in_buffer_size; // !!!!!! | |
113 if(sh_audio->a_in_buffer_len<srcsize){ | |
114 sh_audio->a_in_buffer_len+= | |
115 demux_read_data(sh_audio->ds,&sh_audio->a_in_buffer[sh_audio->a_in_buffer_len], | |
116 srcsize-sh_audio->a_in_buffer_len); | |
92 | 117 } |
1567 | 118 mp_msg(MSGT_WIN32,MSGL_DBG3,"acm convert %d -> %d bytes\n",sh_audio->a_in_buffer_len,len); |
92 | 119 memset(&ash, 0, sizeof(ash)); |
120 ash.cbStruct=sizeof(ash); | |
121 ash.fdwStatus=0; | |
122 ash.dwUser=0; | |
291 | 123 ash.pbSrc=sh_audio->a_in_buffer; |
124 ash.cbSrcLength=sh_audio->a_in_buffer_len; | |
92 | 125 ash.pbDst=a_buffer; |
126 ash.cbDstLength=len; | |
291 | 127 hr=acmStreamPrepareHeader(sh_audio->srcstream,&ash,0); |
92 | 128 if(hr){ |
1567 | 129 mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamPrepareHeader error %d\n",(int)hr); |
92 | 130 return -1; |
131 } | |
291 | 132 hr=acmStreamConvert(sh_audio->srcstream,&ash,0); |
92 | 133 if(hr){ |
1567 | 134 mp_msg(MSGT_WIN32,MSGL_DBG2,"ACM_Decoder: acmStreamConvert error %d\n",(int)hr); |
631 | 135 |
136 // return -1; | |
92 | 137 } |
1407 | 138 if(verbose>1) |
1567 | 139 mp_msg(MSGT_WIN32,MSGL_DBG2,"acm converted %d -> %d\n",ash.cbSrcLengthUsed,ash.cbDstLengthUsed); |
291 | 140 if(ash.cbSrcLengthUsed>=sh_audio->a_in_buffer_len){ |
141 sh_audio->a_in_buffer_len=0; | |
92 | 142 } else { |
291 | 143 sh_audio->a_in_buffer_len-=ash.cbSrcLengthUsed; |
144 memcpy(sh_audio->a_in_buffer,&sh_audio->a_in_buffer[ash.cbSrcLengthUsed],sh_audio->a_in_buffer_len); | |
92 | 145 } |
146 len=ash.cbDstLengthUsed; | |
291 | 147 hr=acmStreamUnprepareHeader(sh_audio->srcstream,&ash,0); |
92 | 148 if(hr){ |
1567 | 149 mp_msg(MSGT_WIN32,MSGL_V,"ACM_Decoder: acmStreamUnprepareHeader error %d\n",(int)hr); |
92 | 150 } |
151 return len; | |
152 } | |
153 | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
154 int init_vfw_video_codec(sh_video_t *sh_video,int ex){ |
1 | 155 HRESULT ret; |
489
2bb59b7c748a
BGR modes with VfW codecs fixed - biCompression must be 0 for BGR...
arpi_esp
parents:
469
diff
changeset
|
156 int yuv=0; |
303 | 157 unsigned int outfmt=sh_video->codec->outfmt[sh_video->outfmtidx]; |
2679 | 158 char *temp; |
159 int temp_len; | |
2087 | 160 int i; |
1 | 161 |
1567 | 162 mp_msg(MSGT_WIN32,MSGL_V,"======= Win32 (VFW) VIDEO Codec init =======\n"); |
1 | 163 |
291 | 164 memset(&sh_video->o_bih, 0, sizeof(BITMAPINFOHEADER)); |
165 sh_video->o_bih.biSize = sizeof(BITMAPINFOHEADER); | |
1 | 166 |
303 | 167 win32_codec_name = sh_video->codec->dll; |
746 | 168 // sh_video->hic = ICOpen( 0x63646976, sh_video->bih->biCompression, ICMODE_FASTDECOMPRESS); |
169 sh_video->hic = ICOpen( 0x63646976, sh_video->bih->biCompression, ICMODE_DECOMPRESS); | |
291 | 170 if(!sh_video->hic){ |
1567 | 171 mp_msg(MSGT_WIN32,MSGL_ERR,"ICOpen failed! unknown codec / wrong parameters?\n"); |
1 | 172 return 0; |
173 } | |
174 | |
2679 | 175 // sh_video->bih->biBitCount=32; |
176 | |
177 temp_len = ICDecompressGetFormatSize(sh_video->hic, sh_video->bih); | |
178 | |
179 if (temp_len < sh_video->o_bih.biSize) | |
180 temp_len = sh_video->o_bih.biSize; | |
181 | |
182 temp = malloc(temp_len); | |
183 printf("ICDecompressGetFormatSize ret: %d\n", temp_len); | |
184 | |
185 #if 0 | |
186 { | |
187 ICINFO icinfo; | |
188 ret = ICGetInfo(sh_video->hic, &icinfo, sizeof(ICINFO)); | |
189 printf("%d - %d - %d\n", ret, icinfo.dwSize, sizeof(ICINFO)); | |
190 printf("Compressor type: %.4x\n", icinfo.fccType); | |
191 printf("Compressor subtype: %.4x\n", icinfo.fccHandler); | |
192 printf("Compressor flags: %lu, version %lu, ICM version: %lu\n", | |
193 icinfo.dwFlags, icinfo.dwVersion, icinfo.dwVersionICM); | |
194 printf("Compressor name: %s\n", icinfo.szName); | |
195 printf("Compressor description: %s\n", icinfo.szDescription); | |
196 | |
197 printf("Flags:"); | |
198 if (icinfo.dwFlags & VIDCF_QUALITY) | |
199 printf(" quality"); | |
200 if (icinfo.dwFlags & VIDCF_FASTTEMPORALD) | |
201 printf(" fast-decompr"); | |
202 if (icinfo.dwFlags & VIDCF_QUALITYTIME) | |
203 printf(" temp-quality"); | |
204 printf("\n"); | |
205 } | |
206 #endif | |
1 | 207 |
2087 | 208 // Note: DivX.DLL overwrites 4 bytes _AFTER_ the o_bih header, so it corrupts |
209 // the sh_video struct content. We call it with an 1024-byte temp space and | |
210 // then copy out the data we need: | |
2679 | 211 memset(temp,0x77,temp_len); |
2885 | 212 // memcpy(temp,sh_video->bih,sizeof(BITMAPINFOHEADER)); |
213 // sh_video->o_bih.biSize = temp_len; | |
2087 | 214 |
215 ret = ICDecompressGetFormat(sh_video->hic, sh_video->bih, temp); | |
2679 | 216 if(ret < 0){ |
1567 | 217 mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret); |
2679 | 218 for (i=0; i < temp_len; i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02x ", temp[i]); |
1 | 219 return 0; |
220 } | |
1567 | 221 mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormat OK\n"); |
1 | 222 |
2087 | 223 memcpy(&sh_video->o_bih,temp,sizeof(sh_video->o_bih)); |
2679 | 224 |
225 if (temp_len > sizeof(sh_video->o_bih)) | |
226 { | |
227 mp_msg(MSGT_WIN32, MSGL_V, "Extra info in o_bih (%d bytes)!\n", | |
228 temp_len-sizeof(sh_video->o_bih)); | |
229 for(i=sizeof(sh_video->o_bih);i<temp_len;i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02X ",temp[i]); | |
230 } | |
231 free(temp); | |
1 | 232 // printf("ICM_DECOMPRESS_QUERY=0x%X",ICM_DECOMPRESS_QUERY); |
233 | |
291 | 234 // sh_video->o_bih.biWidth=sh_video->bih.biWidth; |
235 // sh_video->o_bih.biCompression = 0x32315659; // mmioFOURCC('U','Y','V','Y'); | |
236 // ret=ICDecompressGetFormatSize(sh_video->hic,&sh_video->o_bih); | |
237 // sh_video->o_bih.biCompression = 3; //0x32315659; | |
238 // sh_video->o_bih.biCompression = mmioFOURCC('U','Y','V','Y'); | |
239 // sh_video->o_bih.biCompression = mmioFOURCC('U','Y','V','Y'); | |
240 // sh_video->o_bih.biCompression = mmioFOURCC('Y','U','Y','2'); | |
241 // sh_video->o_bih.biPlanes=3; | |
242 // sh_video->o_bih.biBitCount=16; | |
1 | 243 |
713 | 244 #if 0 |
245 // workaround for pegasus MJPEG: | |
246 if(!sh_video->o_bih.biWidth) sh_video->o_bih.biWidth=sh_video->bih->biWidth; | |
247 if(!sh_video->o_bih.biHeight) sh_video->o_bih.biHeight=sh_video->bih->biHeight; | |
248 if(!sh_video->o_bih.biPlanes) sh_video->o_bih.biPlanes=sh_video->bih->biPlanes; | |
249 #endif | |
408 | 250 |
251 switch (outfmt) { | |
252 | |
253 /* planar format */ | |
254 case IMGFMT_YV12: | |
255 case IMGFMT_I420: | |
256 case IMGFMT_IYUV: | |
257 sh_video->o_bih.biBitCount=12; | |
489
2bb59b7c748a
BGR modes with VfW codecs fixed - biCompression must be 0 for BGR...
arpi_esp
parents:
469
diff
changeset
|
258 yuv=1; |
467 | 259 break; |
1 | 260 |
408 | 261 /* packed format */ |
262 case IMGFMT_YUY2: | |
263 case IMGFMT_UYVY: | |
264 case IMGFMT_YVYU: | |
265 sh_video->o_bih.biBitCount=16; | |
489
2bb59b7c748a
BGR modes with VfW codecs fixed - biCompression must be 0 for BGR...
arpi_esp
parents:
469
diff
changeset
|
266 yuv=1; |
408 | 267 break; |
303 | 268 |
408 | 269 /* rgb/bgr format */ |
270 case IMGFMT_RGB8: | |
271 case IMGFMT_BGR8: | |
272 sh_video->o_bih.biBitCount=8; | |
273 break; | |
1 | 274 |
408 | 275 case IMGFMT_RGB15: |
276 case IMGFMT_RGB16: | |
277 case IMGFMT_BGR15: | |
278 case IMGFMT_BGR16: | |
279 sh_video->o_bih.biBitCount=16; | |
280 break; | |
281 | |
282 case IMGFMT_RGB24: | |
283 case IMGFMT_BGR24: | |
284 sh_video->o_bih.biBitCount=24; | |
285 break; | |
286 | |
287 case IMGFMT_RGB32: | |
288 case IMGFMT_BGR32: | |
289 sh_video->o_bih.biBitCount=32; | |
290 break; | |
1 | 291 |
408 | 292 default: |
1567 | 293 mp_msg(MSGT_WIN32,MSGL_ERR,"unsupported image format: 0x%x\n", outfmt); |
408 | 294 return 0; |
295 } | |
296 | |
297 sh_video->o_bih.biSizeImage = sh_video->o_bih.biWidth * sh_video->o_bih.biHeight * (sh_video->o_bih.biBitCount/8); | |
713 | 298 |
408 | 299 if(!(sh_video->codec->outflags[sh_video->outfmtidx]&CODECS_FLAG_FLIP)) { |
432
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
414
diff
changeset
|
300 sh_video->o_bih.biHeight=-sh_video->bih->biHeight; // flip image! |
408 | 301 } |
1 | 302 |
489
2bb59b7c748a
BGR modes with VfW codecs fixed - biCompression must be 0 for BGR...
arpi_esp
parents:
469
diff
changeset
|
303 if(yuv && !(sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK)) |
408 | 304 sh_video->o_bih.biCompression = outfmt; |
759 | 305 else |
306 sh_video->o_bih.biCompression = 0; | |
1 | 307 |
308 if(verbose) { | |
309 printf("Starting decompression, format:\n"); | |
603 | 310 printf(" biSize %ld\n", sh_video->bih->biSize); |
311 printf(" biWidth %ld\n", sh_video->bih->biWidth); | |
312 printf(" biHeight %ld\n", sh_video->bih->biHeight); | |
432
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
414
diff
changeset
|
313 printf(" biPlanes %d\n", sh_video->bih->biPlanes); |
5251b0c57e39
sh_audio->wf and sh_video->bih changed to dynamic (thanx to Jens Hoffmann)
arpi_esp
parents:
414
diff
changeset
|
314 printf(" biBitCount %d\n", sh_video->bih->biBitCount); |
603 | 315 printf(" biCompression 0x%lx ('%.4s')\n", sh_video->bih->biCompression, (char *)&sh_video->bih->biCompression); |
316 printf(" biSizeImage %ld\n", sh_video->bih->biSizeImage); | |
1 | 317 printf("Dest fmt:\n"); |
603 | 318 printf(" biSize %ld\n", sh_video->o_bih.biSize); |
319 printf(" biWidth %ld\n", sh_video->o_bih.biWidth); | |
320 printf(" biHeight %ld\n", sh_video->o_bih.biHeight); | |
291 | 321 printf(" biPlanes %d\n", sh_video->o_bih.biPlanes); |
322 printf(" biBitCount %d\n", sh_video->o_bih.biBitCount); | |
603 | 323 printf(" biCompression 0x%lx ('%.4s')\n", sh_video->o_bih.biCompression, (char *)&sh_video->o_bih.biCompression); |
324 printf(" biSizeImage %ld\n", sh_video->o_bih.biSizeImage); | |
1 | 325 } |
326 | |
1297 | 327 ret = ex ? |
328 ICDecompressQueryEx(sh_video->hic, sh_video->bih, &sh_video->o_bih) : | |
329 ICDecompressQuery(sh_video->hic, sh_video->bih, &sh_video->o_bih); | |
1 | 330 if(ret){ |
1567 | 331 mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressQuery failed: Error %d\n", (int)ret); |
2714 | 332 // return 0; |
333 } else | |
1567 | 334 mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressQuery OK\n"); |
1 | 335 |
1297 | 336 ret = ex ? |
337 ICDecompressBeginEx(sh_video->hic, sh_video->bih, &sh_video->o_bih) : | |
338 ICDecompressBegin(sh_video->hic, sh_video->bih, &sh_video->o_bih); | |
1 | 339 if(ret){ |
1567 | 340 mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressBegin failed: Error %d\n", (int)ret); |
2876 | 341 // return 0; |
1 | 342 } |
343 | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
344 sh_video->our_out_buffer = (char*)memalign(64,sh_video->o_bih.biSizeImage); |
291 | 345 if(!sh_video->our_out_buffer){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1653
diff
changeset
|
346 mp_msg(MSGT_WIN32,MSGL_ERR,MSGTR_NoMemForDecodedImage, sh_video->o_bih.biSizeImage); |
1 | 347 return 0; |
348 } | |
349 | |
489
2bb59b7c748a
BGR modes with VfW codecs fixed - biCompression must be 0 for BGR...
arpi_esp
parents:
469
diff
changeset
|
350 if(yuv && sh_video->codec->outflags[sh_video->outfmtidx] & CODECS_FLAG_YUVHACK) |
469 | 351 sh_video->o_bih.biCompression = outfmt; |
1 | 352 |
353 // avi_header.our_in_buffer=malloc(avi_header.video.dwSuggestedBufferSize); // FIXME!!!! | |
2087 | 354 |
355 ICSendMessage(sh_video->hic, ICM_USER+80, (long)(&divx_quality) ,NULL); | |
356 | |
1567 | 357 mp_msg(MSGT_WIN32,MSGL_V,"VIDEO CODEC Init OK!!! ;-)\n"); |
1 | 358 return 1; |
359 } | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
360 |
2087 | 361 int vfw_set_postproc(sh_video_t* sh_video,int quality){ |
362 // Works only with opendivx/divx4 based DLL | |
363 return ICSendMessage(sh_video->hic, ICM_USER+80, (long)(&quality) ,NULL); | |
364 } | |
365 | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
366 int vfw_decode_video(sh_video_t* sh_video,void* start,int in_size,int drop_frame,int ex){ |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
367 HRESULT ret; |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
368 |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
369 sh_video->bih->biSizeImage = in_size; |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
370 |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
371 if(ex) |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
372 ret = ICDecompressEx(sh_video->hic, |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
373 ( (sh_video->ds->flags&1) ? 0 : ICDECOMPRESS_NOTKEYFRAME ) | |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
374 ( (drop_frame==2 && !(sh_video->ds->flags&1))?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
375 sh_video->bih, start, |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
376 &sh_video->o_bih, |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
377 drop_frame ? 0 : sh_video->our_out_buffer); |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
378 else |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
379 ret = ICDecompress(sh_video->hic, |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
380 ( (sh_video->ds->flags&1) ? 0 : ICDECOMPRESS_NOTKEYFRAME ) | |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
381 ( (drop_frame==2 && !(sh_video->ds->flags&1))?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
382 sh_video->bih, start, |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
383 &sh_video->o_bih, |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
384 drop_frame ? 0 : sh_video->our_out_buffer); |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
385 |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
386 return (int)ret; |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
387 } |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
1973
diff
changeset
|
388 |