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