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