ReactOS  0.4.14-dev-114-gc8cbd56
animate.c
Go to the documentation of this file.
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
2 /*
3  * Animation control
4  *
5  * Copyright 1998, 1999 Eric Kohl
6  * Copyright 1999 Eric Pouech
7  * Copyright 2005 Dimitrie O. Paun
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  *
23  * TODO:
24  * - check for the 'rec ' list in some AVI files
25  */
26 
27 #include <stdarg.h>
28 #include <string.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "winuser.h"
33 #include "winnls.h"
34 #include "commctrl.h"
35 #include "vfw.h"
36 #include "mmsystem.h"
37 #include "comctl32.h"
38 #include "wine/debug.h"
39 #include "wine/heap.h"
40 
42 
43 static struct {
45  HIC (WINAPI *fnICOpen)(DWORD, DWORD, UINT);
46  LRESULT (WINAPI *fnICClose)(HIC);
47  LRESULT (WINAPI *fnICSendMessage)(HIC, UINT, DWORD_PTR, DWORD_PTR);
49 } fnIC;
50 
51 typedef struct
52 {
53  /* reference to input stream (file or resource) */
55  HMMIO hMMio; /* handle to mmio stream */
59  /* information on the loaded AVI file */
64  /* data for the decompressor */
65  HIC hic;
69  /* data for the background mechanism */
75  /* data for playing the file */
77  int nToFrame;
78  int nLoop;
79  int currFrame;
80  /* transparency info*/
82  HBRUSH hbrushBG;
84 } ANIMATE_INFO;
85 
86 #define ANIMATE_COLOR_NONE 0xffffffff
87 
88 static void ANIMATE_Notify(const ANIMATE_INFO *infoPtr, UINT notif)
89 {
92  (LPARAM)infoPtr->hwndSelf);
93 }
94 
96 {
97  static const WCHAR aviW[] = { 'A', 'V', 'I', 0 };
98  HRSRC hrsrc;
99  MMIOINFO mminfo;
100  LPVOID lpAvi;
101 
102  hrsrc = FindResourceW(hInst, lpName, aviW);
103  if (!hrsrc)
104  return FALSE;
105 
106  infoPtr->hRes = LoadResource(hInst, hrsrc);
107  if (!infoPtr->hRes)
108  return FALSE;
109 
110  lpAvi = LockResource(infoPtr->hRes);
111  if (!lpAvi)
112  return FALSE;
113 
114  memset(&mminfo, 0, sizeof(mminfo));
115  mminfo.fccIOProc = FOURCC_MEM;
116  mminfo.pchBuffer = lpAvi;
117  mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
118  infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ);
119  if (!infoPtr->hMMio)
120  {
121  FreeResource(infoPtr->hRes);
122  return FALSE;
123  }
124 
125  return TRUE;
126 }
127 
128 
130 {
132 
133  if(!infoPtr->hMMio) return FALSE;
134  return TRUE;
135 }
136 
137 
139 {
140  BOOL stopped = FALSE;
141 
142  EnterCriticalSection(&infoPtr->cs);
143 
144  /* should stop playing */
145  if (infoPtr->hThread)
146  {
147  HANDLE handle = infoPtr->hThread;
148 
149  TRACE("stopping animation thread\n");
150  infoPtr->hThread = 0;
151  SetEvent( infoPtr->hStopEvent );
152 
153  if (infoPtr->threadId != GetCurrentThreadId())
154  {
155  LeaveCriticalSection(&infoPtr->cs); /* leave it a chance to run */
157  TRACE("animation thread stopped\n");
158  EnterCriticalSection(&infoPtr->cs);
159  }
160 
161  CloseHandle( handle );
162  CloseHandle( infoPtr->hStopEvent );
163  infoPtr->hStopEvent = 0;
164  stopped = TRUE;
165  }
166  if (infoPtr->uTimer) {
167  KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
168  infoPtr->uTimer = 0;
169  stopped = TRUE;
170  }
171 
172  LeaveCriticalSection(&infoPtr->cs);
173 
174  if (stopped)
175  ANIMATE_Notify(infoPtr, ACN_STOP);
176 
177  return TRUE;
178 }
179 
180 
181 static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
182 {
183  if (infoPtr->hMMio)
184  {
185  ANIMATE_DoStop(infoPtr);
186  mmioClose(infoPtr->hMMio, 0);
187  if (infoPtr->hRes)
188  {
189  FreeResource(infoPtr->hRes);
190  infoPtr->hRes = 0;
191  }
192  heap_free (infoPtr->lpIndex);
193  infoPtr->lpIndex = NULL;
194  if (infoPtr->hic)
195  {
196  fnIC.fnICClose(infoPtr->hic);
197  infoPtr->hic = 0;
198  }
199  heap_free (infoPtr->inbih);
200  infoPtr->inbih = NULL;
201  heap_free (infoPtr->outbih);
202  infoPtr->outbih = NULL;
203  heap_free (infoPtr->indata);
204  infoPtr->indata = NULL;
205  heap_free (infoPtr->outdata);
206  infoPtr->outdata = NULL;
207  if (infoPtr->hbmPrevFrame)
208  {
209  DeleteObject(infoPtr->hbmPrevFrame);
210  infoPtr->hbmPrevFrame = 0;
211  }
212 
213  memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
214  memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
215  infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
216  }
218 }
219 
220 static void ANIMATE_TransparentBlt(ANIMATE_INFO const *infoPtr, HDC hdcDest, HDC hdcSource)
221 {
222  HDC hdcMask;
223  HBITMAP hbmMask;
224  HBITMAP hbmOld;
225 
226  /* create a transparency mask */
227  hdcMask = CreateCompatibleDC(hdcDest);
228  hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);
229  hbmOld = SelectObject(hdcMask, hbmMask);
230 
231  SetBkColor(hdcSource,infoPtr->transparentColor);
232  BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY);
233 
234  /* mask the source bitmap */
235  SetBkColor(hdcSource, RGB(0,0,0));
236  SetTextColor(hdcSource, RGB(255,255,255));
237  BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
238 
239  /* mask the destination bitmap */
240  SetBkColor(hdcDest, RGB(255,255,255));
241  SetTextColor(hdcDest, RGB(0,0,0));
242  BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
243 
244  /* combine source and destination */
245  BitBlt(hdcDest,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCPAINT);
246 
247  SelectObject(hdcMask, hbmOld);
248  DeleteObject(hbmMask);
249  DeleteDC(hdcMask);
250 }
251 
253 {
254  void const *pBitmapData;
255  BITMAPINFO const *pBitmapInfo;
256  HDC hdcMem;
257  HBITMAP hbmOld;
258  int nOffsetX = 0;
259  int nOffsetY = 0;
260  int nWidth;
261  int nHeight;
262 
263  if (!hDC || !infoPtr->inbih)
264  return TRUE;
265 
266  if (infoPtr->hic )
267  {
268  pBitmapData = infoPtr->outdata;
269  pBitmapInfo = (LPBITMAPINFO)infoPtr->outbih;
270 
271  nWidth = infoPtr->outbih->biWidth;
272  nHeight = infoPtr->outbih->biHeight;
273  }
274  else
275  {
276  pBitmapData = infoPtr->indata;
277  pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
278 
279  nWidth = infoPtr->inbih->biWidth;
280  nHeight = infoPtr->inbih->biHeight;
281  }
282 
283  if(!infoPtr->hbmPrevFrame)
284  {
285  infoPtr->hbmPrevFrame=CreateCompatibleBitmap(hDC, nWidth,nHeight );
286  }
287 
289  hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame);
290 
291  SetDIBits(hdcMem, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, pBitmapInfo, DIB_RGB_COLORS);
292 
293  /*
294  * we need to get the transparent color even without ACS_TRANSPARENT,
295  * because the style can be changed later on and the color should always
296  * be obtained in the first frame
297  */
298  if(infoPtr->transparentColor == ANIMATE_COLOR_NONE)
299  {
300  infoPtr->transparentColor = GetPixel(hdcMem,0,0);
301  }
302 
303  if(infoPtr->dwStyle & ACS_TRANSPARENT)
304  {
305  HDC hdcFinal = CreateCompatibleDC(hDC);
306  HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
307  HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal);
308  RECT rect;
309 
310  SetRect(&rect, 0, 0, nWidth, nHeight);
311 
312  if(!infoPtr->hbrushBG)
313  infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH);
314 
315  FillRect(hdcFinal, &rect, infoPtr->hbrushBG);
316  ANIMATE_TransparentBlt(infoPtr, hdcFinal, hdcMem);
317 
318  SelectObject(hdcFinal, hbmOld2);
319  SelectObject(hdcMem, hbmFinal);
320  DeleteDC(hdcFinal);
321  DeleteObject(infoPtr->hbmPrevFrame);
322  infoPtr->hbmPrevFrame = hbmFinal;
323  }
324 
325  if (infoPtr->dwStyle & ACS_CENTER)
326  {
327  RECT rect;
328 
329  GetWindowRect(infoPtr->hwndSelf, &rect);
330  nOffsetX = ((rect.right - rect.left) - nWidth)/2;
331  nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
332  }
333  BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);
334 
335  SelectObject(hdcMem, hbmOld);
336  DeleteDC(hdcMem);
337  return TRUE;
338 }
339 
341 {
342  TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
343 
344  mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
345  mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
346 
347  if (infoPtr->hic &&
348  fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
349  infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
350  WARN("Decompression error\n");
351  return FALSE;
352  }
353 
354  ANIMATE_PaintFrame(infoPtr, hDC);
355 
356  if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
357  infoPtr->currFrame = infoPtr->nFromFrame;
358  if (infoPtr->nLoop != -1) {
359  if (--infoPtr->nLoop == 0) {
360  ANIMATE_DoStop(infoPtr);
361  }
362  }
363  }
364 
365  return TRUE;
366 }
367 
369 {
370  HDC hDC;
371 
372  if ((hDC = GetDC(infoPtr->hwndSelf)) != 0)
373  {
374  EnterCriticalSection(&infoPtr->cs);
375  ANIMATE_DrawFrame(infoPtr, hDC);
376  LeaveCriticalSection(&infoPtr->cs);
377 
378  ReleaseDC(infoPtr->hwndSelf, hDC);
379  }
380 
381  return 0;
382 }
383 
385 {
386  ANIMATE_INFO *infoPtr = ptr_;
387  HANDLE event;
388  DWORD timeout;
389 
390  while(1)
391  {
392  HDC hDC = GetDC(infoPtr->hwndSelf);
393 
394  EnterCriticalSection(&infoPtr->cs);
395  ANIMATE_DrawFrame(infoPtr, hDC);
396  timeout = infoPtr->mah.dwMicroSecPerFrame;
397  event = infoPtr->hStopEvent;
398  LeaveCriticalSection(&infoPtr->cs);
399 
400  ReleaseDC(infoPtr->hwndSelf, hDC);
401 
402  /* time is in microseconds, we should convert it to milliseconds */
403  if ((event == 0) || WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0)
404  break;
405  }
406  return TRUE;
407 }
408 
409 static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo)
410 {
411  /* nothing opened */
412  if (!infoPtr->hMMio)
413  return FALSE;
414 
415  if (infoPtr->hThread || infoPtr->uTimer) {
416  TRACE("Already playing\n");
417  return TRUE;
418  }
419 
420  infoPtr->nFromFrame = wFrom;
421  infoPtr->nToFrame = wTo;
422  infoPtr->nLoop = cRepeat;
423 
424  if (infoPtr->nToFrame == 0xFFFF)
425  infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
426 
427  TRACE("(repeat=%d from=%d to=%d);\n",
428  infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
429 
430  if (infoPtr->nFromFrame >= infoPtr->mah.dwTotalFrames &&
431  (SHORT)infoPtr->nFromFrame < 0)
432  infoPtr->nFromFrame = 0;
433 
434  if (infoPtr->nFromFrame > infoPtr->nToFrame ||
435  infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
436  return FALSE;
437 
438  infoPtr->currFrame = infoPtr->nFromFrame;
439 
440  /* seek - doesn't need to start a thread or set a timer and neither
441  * does it send a notification */
442  if (infoPtr->nFromFrame == infoPtr->nToFrame)
443  {
444  HDC hDC;
445 
446  if ((hDC = GetDC(infoPtr->hwndSelf)) != 0)
447  {
448  ANIMATE_DrawFrame(infoPtr, hDC);
449 
450  ReleaseDC(infoPtr->hwndSelf, hDC);
451  }
452  return TRUE;
453  }
454 
455  if (infoPtr->dwStyle & ACS_TIMER)
456  {
457  TRACE("Using a timer\n");
458  /* create a timer to display AVI */
459  infoPtr->uTimer = SetTimer(infoPtr->hwndSelf, 1,
460  infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
461  }
462  else
463  {
464  TRACE("Using an animation thread\n");
465  infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
467  infoPtr, 0, &infoPtr->threadId);
468  if(!infoPtr->hThread) return FALSE;
469 
470  }
471 
472  ANIMATE_Notify(infoPtr, ACN_START);
473 
474  return TRUE;
475 }
476 
477 
479 {
480  MMCKINFO ckMainRIFF;
481  MMCKINFO mmckHead;
482  MMCKINFO mmckList;
483  MMCKINFO mmckInfo;
484  DWORD numFrame;
485  DWORD insize;
486 
487  if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
488  WARN("Can't find 'RIFF' chunk\n");
489  return FALSE;
490  }
491 
492  if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
493  (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
494  WARN("Can't find 'AVI ' chunk\n");
495  return FALSE;
496  }
497 
498  mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l');
499  if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
500  WARN("Can't find 'hdrl' list\n");
501  return FALSE;
502  }
503 
504  mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h');
505  if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
506  WARN("Can't find 'avih' chunk\n");
507  return FALSE;
508  }
509 
510  mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
511 
512  TRACE("mah.dwMicroSecPerFrame=%d\n", infoPtr->mah.dwMicroSecPerFrame);
513  TRACE("mah.dwMaxBytesPerSec=%d\n", infoPtr->mah.dwMaxBytesPerSec);
514  TRACE("mah.dwPaddingGranularity=%d\n", infoPtr->mah.dwPaddingGranularity);
515  TRACE("mah.dwFlags=%d\n", infoPtr->mah.dwFlags);
516  TRACE("mah.dwTotalFrames=%d\n", infoPtr->mah.dwTotalFrames);
517  TRACE("mah.dwInitialFrames=%d\n", infoPtr->mah.dwInitialFrames);
518  TRACE("mah.dwStreams=%d\n", infoPtr->mah.dwStreams);
519  TRACE("mah.dwSuggestedBufferSize=%d\n", infoPtr->mah.dwSuggestedBufferSize);
520  TRACE("mah.dwWidth=%d\n", infoPtr->mah.dwWidth);
521  TRACE("mah.dwHeight=%d\n", infoPtr->mah.dwHeight);
522 
523  mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
524 
525  mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
526  if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
527  WARN("Can't find 'strl' list\n");
528  return FALSE;
529  }
530 
531  mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h');
532  if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
533  WARN("Can't find 'strh' chunk\n");
534  return FALSE;
535  }
536 
537  mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
538 
539  TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)),
540  HIBYTE(LOWORD(infoPtr->ash.fccType)),
541  LOBYTE(HIWORD(infoPtr->ash.fccType)),
542  HIBYTE(HIWORD(infoPtr->ash.fccType)));
543  TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)),
544  HIBYTE(LOWORD(infoPtr->ash.fccHandler)),
545  LOBYTE(HIWORD(infoPtr->ash.fccHandler)),
546  HIBYTE(HIWORD(infoPtr->ash.fccHandler)));
547  TRACE("ash.dwFlags=%d\n", infoPtr->ash.dwFlags);
548  TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority);
549  TRACE("ash.wLanguage=%d\n", infoPtr->ash.wLanguage);
550  TRACE("ash.dwInitialFrames=%d\n", infoPtr->ash.dwInitialFrames);
551  TRACE("ash.dwScale=%d\n", infoPtr->ash.dwScale);
552  TRACE("ash.dwRate=%d\n", infoPtr->ash.dwRate);
553  TRACE("ash.dwStart=%d\n", infoPtr->ash.dwStart);
554  TRACE("ash.dwLength=%d\n", infoPtr->ash.dwLength);
555  TRACE("ash.dwSuggestedBufferSize=%d\n", infoPtr->ash.dwSuggestedBufferSize);
556  TRACE("ash.dwQuality=%d\n", infoPtr->ash.dwQuality);
557  TRACE("ash.dwSampleSize=%d\n", infoPtr->ash.dwSampleSize);
558  TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,
559  infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);
560 
561  mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
562 
563  mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f');
564  if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
565  WARN("Can't find 'strh' chunk\n");
566  return FALSE;
567  }
568 
569  infoPtr->inbih = heap_alloc_zero(mmckInfo.cksize);
570  if (!infoPtr->inbih) {
571  WARN("Can't alloc input BIH\n");
572  return FALSE;
573  }
574 
575  mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
576 
577  TRACE("bih.biSize=%d\n", infoPtr->inbih->biSize);
578  TRACE("bih.biWidth=%d\n", infoPtr->inbih->biWidth);
579  TRACE("bih.biHeight=%d\n", infoPtr->inbih->biHeight);
580  TRACE("bih.biPlanes=%d\n", infoPtr->inbih->biPlanes);
581  TRACE("bih.biBitCount=%d\n", infoPtr->inbih->biBitCount);
582  TRACE("bih.biCompression=%d\n", infoPtr->inbih->biCompression);
583  TRACE("bih.biSizeImage=%d\n", infoPtr->inbih->biSizeImage);
584  TRACE("bih.biXPelsPerMeter=%d\n", infoPtr->inbih->biXPelsPerMeter);
585  TRACE("bih.biYPelsPerMeter=%d\n", infoPtr->inbih->biYPelsPerMeter);
586  TRACE("bih.biClrUsed=%d\n", infoPtr->inbih->biClrUsed);
587  TRACE("bih.biClrImportant=%d\n", infoPtr->inbih->biClrImportant);
588 
589  mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
590 
591  mmioAscend(infoPtr->hMMio, &mmckList, 0);
592 
593 #if 0
594  /* an AVI has 0 or 1 video stream, and to be animated should not contain
595  * an audio stream, so only one strl is allowed
596  */
597  mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
598  if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
599  WARN("There should be a single 'strl' list\n");
600  return FALSE;
601  }
602 #endif
603 
604  mmioAscend(infoPtr->hMMio, &mmckHead, 0);
605 
606  /* no need to read optional JUNK chunk */
607 
608  mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i');
609  if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
610  WARN("Can't find 'movi' list\n");
611  return FALSE;
612  }
613 
614  /* FIXME: should handle the 'rec ' LIST when present */
615 
616  infoPtr->lpIndex = heap_alloc_zero(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
617  if (!infoPtr->lpIndex)
618  return FALSE;
619 
620  numFrame = insize = 0;
621  while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
622  numFrame < infoPtr->mah.dwTotalFrames) {
623  infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
624  if (insize < mmckInfo.cksize)
625  insize = mmckInfo.cksize;
626  numFrame++;
627  mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
628  }
629  if (numFrame != infoPtr->mah.dwTotalFrames) {
630  WARN("Found %d frames (/%d)\n", numFrame, infoPtr->mah.dwTotalFrames);
631  return FALSE;
632  }
633  if (insize > infoPtr->ash.dwSuggestedBufferSize) {
634  WARN("insize=%d suggestedSize=%d\n", insize, infoPtr->ash.dwSuggestedBufferSize);
635  infoPtr->ash.dwSuggestedBufferSize = insize;
636  }
637 
638  infoPtr->indata = heap_alloc_zero(infoPtr->ash.dwSuggestedBufferSize);
639  if (!infoPtr->indata)
640  return FALSE;
641 
642  return TRUE;
643 }
644 
645 
647 {
648  DWORD outSize;
649 
650  /* check uncompressed AVI */
651  if ((infoPtr->ash.fccHandler == mmioFOURCC('D', 'I', 'B', ' ')) ||
652  (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')) ||
653  (infoPtr->ash.fccHandler == mmioFOURCC(0, 0, 0, 0)))
654  {
655  infoPtr->hic = 0;
656  return TRUE;
657  }
658 
659  /* try to get a decompressor for that type */
660  infoPtr->hic = fnIC.fnICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
661  if (!infoPtr->hic) {
662  WARN("Can't load codec for the file\n");
663  return FALSE;
664  }
665 
666  outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
667  (DWORD_PTR)infoPtr->inbih, 0L);
668 
669  infoPtr->outbih = heap_alloc_zero(outSize);
670  if (!infoPtr->outbih)
671  return FALSE;
672 
673  if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
674  (DWORD_PTR)infoPtr->inbih, (DWORD_PTR)infoPtr->outbih) != ICERR_OK)
675  {
676  WARN("Can't get output BIH\n");
677  return FALSE;
678  }
679 
680  infoPtr->outdata = heap_alloc_zero(infoPtr->outbih->biSizeImage);
681  if (!infoPtr->outdata)
682  return FALSE;
683 
684  if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
685  (DWORD_PTR)infoPtr->inbih, (DWORD_PTR)infoPtr->outbih) != ICERR_OK) {
686  WARN("Can't begin decompression\n");
687  return FALSE;
688  }
689 
690  return TRUE;
691 }
692 
693 
695 {
696  HDC hdc;
697 
698  ANIMATE_Free(infoPtr);
699 
700  if (!lpszName)
701  {
702  TRACE("Closing avi.\n");
703  /* installer of thebat! v1.62 requires FALSE here */
704  return (infoPtr->hMMio != 0);
705  }
706 
707  if (!hInstance)
709 
710  TRACE("(%s)\n", debugstr_w(lpszName));
711 
712  if (!IS_INTRESOURCE(lpszName))
713  {
714  if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
715  {
716  TRACE("No AVI resource found.\n");
717  if (!ANIMATE_LoadFileW(infoPtr, lpszName))
718  {
719  WARN("No AVI file found.\n");
720  return FALSE;
721  }
722  }
723  }
724  else
725  {
726  if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
727  {
728  WARN("No AVI resource found.\n");
729  return FALSE;
730  }
731  }
732 
733  if (!ANIMATE_GetAviInfo(infoPtr))
734  {
735  WARN("Can't get AVI information\n");
736  ANIMATE_Free(infoPtr);
737  return FALSE;
738  }
739 
740  if (!ANIMATE_GetAviCodec(infoPtr))
741  {
742  WARN("Can't get AVI Codec\n");
743  ANIMATE_Free(infoPtr);
744  return FALSE;
745  }
746 
747  hdc = GetDC(infoPtr->hwndSelf);
748  /* native looks at the top left pixel of the first frame here too. */
749  infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
750  (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
751  ReleaseDC(infoPtr->hwndSelf, hdc);
752 
753  if (!(infoPtr->dwStyle & ACS_CENTER))
754  SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
756 
757  if (infoPtr->dwStyle & ACS_AUTOPLAY)
758  return ANIMATE_Play(infoPtr, -1, 0, infoPtr->mah.dwTotalFrames - 1);
759 
760  return TRUE;
761 }
762 
763 
765 {
766  LPWSTR lpwszName;
767  LRESULT result;
768  INT len;
769 
770  if (IS_INTRESOURCE(lpszName))
771  return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
772 
773  len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);
774  lpwszName = heap_alloc(len * sizeof(WCHAR));
775  if (!lpwszName) return FALSE;
776  MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len);
777 
778  result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName);
779  heap_free (lpwszName);
780  return result;
781 }
782 
783 
785 {
786  /* nothing opened */
787  if (!infoPtr->hMMio)
788  return FALSE;
789 
790  ANIMATE_DoStop(infoPtr);
791  return TRUE;
792 }
793 
794 
796 {
797  static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 };
798  ANIMATE_INFO *infoPtr;
799 
800  if (!fnIC.hModule)
801  {
802  fnIC.hModule = LoadLibraryW(msvfw32W);
803  if (!fnIC.hModule) return FALSE;
804 
805  fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen");
806  fnIC.fnICClose = (void*)GetProcAddress(fnIC.hModule, "ICClose");
807  fnIC.fnICSendMessage = (void*)GetProcAddress(fnIC.hModule, "ICSendMessage");
808  fnIC.fnICDecompress = (void*)GetProcAddress(fnIC.hModule, "ICDecompress");
809  }
810 
811  /* allocate memory for info structure */
812  infoPtr = heap_alloc_zero(sizeof(*infoPtr));
813  if (!infoPtr) return FALSE;
814 
815  /* store crossref hWnd <-> info structure */
816  SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr);
817  infoPtr->hwndSelf = hWnd;
818  infoPtr->hwndNotify = lpcs->hwndParent;
819  infoPtr->transparentColor = ANIMATE_COLOR_NONE;
820  infoPtr->hbmPrevFrame = 0;
821  infoPtr->dwStyle = lpcs->style;
822 
823  TRACE("Animate style=0x%08x, parent=%p\n", infoPtr->dwStyle, infoPtr->hwndNotify);
824 
825  InitializeCriticalSection(&infoPtr->cs);
826  infoPtr->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ANIMATE_INFO*->cs");
827 
828  return TRUE;
829 }
830 
831 
833 {
834  /* free avi data */
835  ANIMATE_Free(infoPtr);
836 
837  /* free animate info data */
838  SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
839 
840  infoPtr->cs.DebugInfo->Spare[0] = 0;
841  DeleteCriticalSection(&infoPtr->cs);
842  heap_free(infoPtr);
843 
844  return 0;
845 }
846 
847 
849 {
850  RECT rect;
851  HBRUSH hBrush;
852 
853  hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
854  (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
855  GetClientRect(infoPtr->hwndSelf, &rect);
856  FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH));
857 
858  return TRUE;
859 }
860 
861 
862 static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
863 {
864  TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
865  wStyleType, lpss->styleOld, lpss->styleNew);
866 
867  if (wStyleType != GWL_STYLE) return 0;
868 
869  infoPtr->dwStyle = lpss->styleNew;
870 
871  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
872  return 0;
873 }
874 
875 
877 {
879 
880  TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hWnd, uMsg, wParam, lParam);
881  if (!infoPtr && (uMsg != WM_NCCREATE))
882  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
883  switch (uMsg)
884  {
885  case ACM_OPENA:
886  return ANIMATE_OpenA(infoPtr, (HINSTANCE)wParam, (LPSTR)lParam);
887 
888  case ACM_OPENW:
889  return ANIMATE_OpenW(infoPtr, (HINSTANCE)wParam, (LPWSTR)lParam);
890 
891  case ACM_PLAY:
892  return ANIMATE_Play(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam));
893 
894  case ACM_STOP:
895  return ANIMATE_Stop(infoPtr);
896 
897  case WM_CLOSE:
898  ANIMATE_Free(infoPtr);
899  return 0;
900 
901  case WM_NCCREATE:
903 
904  case WM_NCHITTEST:
905  return HTTRANSPARENT;
906 
907  case WM_DESTROY:
908  return ANIMATE_Destroy(infoPtr);
909 
910  case WM_ERASEBKGND:
911  return ANIMATE_EraseBackground(infoPtr, (HDC)wParam);
912 
913  case WM_STYLECHANGED:
914  return ANIMATE_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
915 
916  case WM_TIMER:
917  return ANIMATE_Timer(infoPtr);
918 
919  case WM_PRINTCLIENT:
920  case WM_PAINT:
921  {
922  /* the animation has not decompressed
923  * (and displayed) the first frame yet, don't paint
924  */
925  if (!infoPtr->hbmPrevFrame)
926  {
927  /* default paint handling */
928  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
929  }
930 
931  if (wParam)
932  {
933  EnterCriticalSection(&infoPtr->cs);
934  ANIMATE_PaintFrame(infoPtr, (HDC)wParam);
935  LeaveCriticalSection(&infoPtr->cs);
936  }
937  else
938  {
939  PAINTSTRUCT ps;
940  HDC hDC = BeginPaint(infoPtr->hwndSelf, &ps);
941 
942  EnterCriticalSection(&infoPtr->cs);
943  ANIMATE_PaintFrame(infoPtr, hDC);
944  LeaveCriticalSection(&infoPtr->cs);
945 
946  EndPaint(infoPtr->hwndSelf, &ps);
947  }
948  }
949  break;
950 
951  case WM_SIZE:
952  if (infoPtr->dwStyle & ACS_CENTER)
953  InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
954  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
955 
956  default:
957  if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
958  ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
959 
960  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
961  }
962  return 0;
963 }
964 
966 {
967  WNDCLASSW wndClass;
968 
969  ZeroMemory(&wndClass, sizeof(WNDCLASSW));
970  wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
971  wndClass.lpfnWndProc = ANIMATE_WindowProc;
972  wndClass.cbClsExtra = 0;
973  wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
974  wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
975  wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
976  wndClass.lpszClassName = ANIMATE_CLASSW;
977 
978  RegisterClassW(&wndClass);
979 }
980 
981 
983 {
985 }
#define SRCPAINT
Definition: wingdi.h:333
DWORD dwFlags
Definition: vfw.h:944
#define MMIO_ALLOCBUF
Definition: mmsystem.h:532
DWORD dwInitialFrames
Definition: vfw.h:964
AVIStreamHeader ash
Definition: animate.c:61
int nToFrame
Definition: animate.c:77
void ANIMATE_Register(void)
Definition: animate.c:965
#define HTTRANSPARENT
Definition: winuser.h:2448
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
#define CloseHandle
Definition: compat.h:398
FOURCC fccIOProc
Definition: mmsystem.h:1487
#define ACM_OPENW
Definition: commctrl.h:4124
UINT style
Definition: winuser.h:3150
LONG cchBuffer
Definition: mmsystem.h:1491
DWORD threadId
Definition: animate.c:73
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD biClrImportant
Definition: amvideo.idl:40
#define LOBYTE(W)
Definition: jmemdos.c:487
struct tagBITMAPINFO * LPBITMAPINFO
static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
Definition: animate.c:138
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
DWORD
Definition: animate.c:45
#define ANIMATE_COLOR_NONE
Definition: animate.c:86
DWORD dwInitialFrames
Definition: vfw.h:946
LONG biXPelsPerMeter
Definition: amvideo.idl:37
#define ACM_STOP
Definition: commctrl.h:4129
#define CP_ACP
Definition: compat.h:99
LPVOID
Definition: animate.c:48
int nFromFrame
Definition: animate.c:76
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
MMRESULT WINAPI mmioAscend(HMMIO hmmio, LPMMCKINFO lpck, UINT uFlags)
Definition: mmio.c:1204
static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
Definition: animate.c:384
DWORD dwLength
Definition: vfw.h:968
#define WARN(fmt,...)
Definition: debug.h:111
DWORD dwDataOffset
Definition: mmsystem.h:1510
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:27
_In_ LPCSTR lpName
Definition: winbase.h:2736
LPVOID indata
Definition: animate.c:67
HWND hWnd
Definition: settings.c:17
#define HIBYTE(W)
Definition: jmemdos.c:486
#define ACN_START
Definition: commctrl.h:4131
int nLoop
Definition: animate.c:78
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define ACS_AUTOPLAY
Definition: commctrl.h:4120
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define ZeroMemory
Definition: winbase.h:1642
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
MMRESULT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
Definition: mmio.c:701
int cbClsExtra
Definition: winuser.h:3152
DWORD dwStart
Definition: vfw.h:967
static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName)
Definition: animate.c:764
HWND hwndSelf
Definition: animate.c:56
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
MainAVIHeader mah
Definition: animate.c:60
#define WM_NCHITTEST
Definition: winuser.h:1668
Definition: dhcpd.h:245
UINT_PTR WPARAM
Definition: windef.h:207
HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
Definition: mmio.c:669
#define ACS_CENTER
Definition: commctrl.h:4118
#define GetWindowLongPtrW
Definition: winuser.h:4730
#define MMIO_DENYWRITE
Definition: mmsystem.h:540
#define SWP_NOZORDER
Definition: winuser.h:1232
#define ICERR_OK
Definition: vfw.h:50
LPBITMAPINFOHEADER outbih
Definition: animate.c:66
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD dwFlags
Definition: vfw.h:961
static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
Definition: animate.c:832
char * LPSTR
Definition: xmlstorage.h:182
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
LONG biYPelsPerMeter
Definition: amvideo.idl:38
#define WM_NCCREATE
Definition: winuser.h:1665
static BOOL ANIMATE_PaintFrame(ANIMATE_INFO *infoPtr, HDC hDC)
Definition: animate.c:252
static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
Definition: animate.c:181
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:410
int32_t INT
Definition: typedefs.h:56
LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin)
Definition: mmio.c:835
GLbitfield GLuint64 timeout
Definition: glext.h:7164
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD dwMicroSecPerFrame
Definition: vfw.h:941
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define ACS_TIMER
Definition: commctrl.h:4121
#define WM_PRINTCLIENT
Definition: richedit.h:70
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void ANIMATE_Unregister(void)
Definition: animate.c:982
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
int WINAPI GetDlgCtrlID(_In_ HWND)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
FOURCC fccHandler
Definition: vfw.h:960
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
WINE_DEFAULT_DEBUG_CHANNEL(animate)
HINSTANCE hInstance
Definition: charmap.c:20
LPVOID outdata
Definition: animate.c:68
struct AVIStreamHeader::@3141 rcFrame
static BOOL ANIMATE_EraseBackground(ANIMATE_INFO const *infoPtr, HDC hdc)
Definition: animate.c:848
HMMIO hMMio
Definition: animate.c:55
unsigned int BOOL
Definition: ntddk_ex.h:94
short SHORT
Definition: pedump.c:59
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define debugstr_w
Definition: kernel32.h:32
WNDPROC lpfnWndProc
Definition: winuser.h:3151
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
DWORD biCompression
Definition: amvideo.idl:35
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
HANDLE hThread
Definition: animate.c:72
UINT uTimer
Definition: animate.c:74
LPCWSTR lpszClassName
Definition: winuser.h:3159
LONG_PTR LPARAM
Definition: windef.h:208
#define MMIO_FINDCHUNK
Definition: mmsystem.h:551
FOURCC fccType
Definition: vfw.h:959
FOURCC fccType
Definition: mmsystem.h:1509
HBRUSH hbrushBG
Definition: animate.c:82
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
DWORD dwStreams
Definition: vfw.h:947
#define WM_DESTROY
Definition: winuser.h:1591
#define MMIO_READ
Definition: mmsystem.h:535
static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: animate.c:862
WORD wPriority
Definition: vfw.h:962
#define SEEK_SET
Definition: jmemansi.c:26
#define TRACE(s)
Definition: solgame.cpp:4
#define WAIT_OBJECT_0
Definition: winbase.h:387
HPSTR pchBuffer
Definition: mmsystem.h:1492
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
static void ANIMATE_TransparentBlt(ANIMATE_INFO const *infoPtr, HDC hdcDest, HDC hdcSource)
Definition: animate.c:220
int cbWndExtra
Definition: winuser.h:3153
#define ACM_PLAY
Definition: commctrl.h:4128
__wchar_t WCHAR
Definition: xmlstorage.h:180
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
LPDWORD lpIndex
Definition: animate.c:63
#define WM_SIZE
Definition: winuser.h:1593
#define ICMODE_DECOMPRESS
Definition: vfw.h:269
static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: animate.c:876
#define ACN_STOP
Definition: commctrl.h:4132
#define SWP_NOACTIVATE
Definition: winuser.h:1227
DWORD COLORREF
Definition: windef.h:285
#define WM_TIMER
Definition: winuser.h:1724
#define WM_CLOSE
Definition: winuser.h:1603
#define ICM_DECOMPRESS_GET_FORMAT
Definition: vfw.h:106
#define CS_GLOBALCLASS
Definition: winuser.h:647
DWORD dwSuggestedBufferSize
Definition: vfw.h:969
#define ICTYPE_VIDEO
Definition: mmreg.h:531
#define RGB(r, g, b)
Definition: wingdi.h:2935
#define WINAPI
Definition: msvc.h:8
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
HBITMAP hbmPrevFrame
Definition: animate.c:83
DWORD biSizeImage
Definition: amvideo.idl:36
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HGLOBAL hRes
Definition: animate.c:54
DWORD cksize
Definition: mmsystem.h:1508
DWORD dwMaxBytesPerSec
Definition: vfw.h:942
LPBITMAPINFOHEADER
Definition: animate.c:48
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:866
#define WM_PAINT
Definition: winuser.h:1602
HANDLE HINSTANCE
Definition: typedefs.h:75
DWORD dwStyle
Definition: animate.c:58
COLORREF transparentColor
Definition: animate.c:81
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
UINT
Definition: animate.c:45
#define ANIMATE_CLASSW
Definition: commctrl.h:4113
HWND hwndNotify
Definition: animate.c:57
static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
Definition: animate.c:646
DWORD dwQuality
Definition: vfw.h:970
static const WCHAR L[]
Definition: oid.c:1250
#define FOURCC_RIFF
Definition: mmsystem.h:564
HDC hdc
Definition: main.c:9
DWORD_PTR
Definition: animate.c:47
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
#define COLOR_BTNFACE
Definition: winuser.h:918
DWORD dwSampleSize
Definition: vfw.h:971
const unsigned char unsigned long insize
Definition: jpeglib.h:982
GLenum GLsizei len
Definition: glext.h:6722
#define LRESULT
Definition: ole.h:14
DWORD dwTotalFrames
Definition: vfw.h:945
#define WM_APP
Definition: eventvwr.h:70
#define CS_DBLCLKS
Definition: winuser.h:646
#define WM_COMMAND
Definition: winuser.h:1722
struct _cl_event * event
Definition: glext.h:7739
uint32_t DWORD_PTR
Definition: typedefs.h:63
DWORD dwSuggestedBufferSize
Definition: vfw.h:948
#define ICM_DECOMPRESS_BEGIN
Definition: vfw.h:108
static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr)
Definition: animate.c:368
#define WM_USER
Definition: winuser.h:1877
#define WINAPIV
Definition: sdbpapi.h:64
static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName)
Definition: animate.c:694
HCURSOR hCursor
Definition: winuser.h:3156
#define ERR(fmt,...)
Definition: debug.h:109
#define GWL_STYLE
Definition: winuser.h:846
#define ACM_OPENA
Definition: commctrl.h:4123
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
CRITICAL_SECTION cs
Definition: animate.c:70
static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName)
Definition: animate.c:129
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
HINSTANCE hInst
Definition: dxdiag.c:13
BOOL WINAPI DeleteDC(_In_ HDC)
#define OBJ_BRUSH
Definition: objidl.idl:1410
FOURCC ckid
Definition: mmsystem.h:1507
MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck, const MMCKINFO *lpckParent, UINT uFlags)
Definition: mmio.c:1106
HBRUSH hbrBackground
Definition: winuser.h:3157
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD dwWidth
Definition: vfw.h:949
HANDLE hStopEvent
Definition: animate.c:71
DWORD styleNew
Definition: winuser.h:3667
DWORD dwScale
Definition: vfw.h:965
#define ACS_TRANSPARENT
Definition: commctrl.h:4119
#define SRCAND
Definition: wingdi.h:329
unsigned int UINT
Definition: ndis.h:50
#define FOURCC_MEM
Definition: mmsystem.h:567
int currFrame
Definition: animate.c:79
static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo)
Definition: animate.c:409
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
Definition: animate.c:478
#define MultiByteToWideChar
Definition: compat.h:100
DWORD styleOld
Definition: winuser.h:3666
#define IDC_ARROW
Definition: winuser.h:682
#define GWLP_HINSTANCE
Definition: winuser.h:850
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr, HDC hDC)
Definition: animate.c:340
uint32_t * LPDWORD
Definition: typedefs.h:57
#define HIWORD(l)
Definition: typedefs.h:246
static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr)
Definition: animate.c:784
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
#define GetProcAddress(x, y)
Definition: compat.h:410
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5247
static HBITMAP
Definition: button.c:44
DWORD dwPaddingGranularity
Definition: vfw.h:943
#define MMIO_FINDLIST
Definition: mmsystem.h:553
#define WM_ERASEBKGND
Definition: winuser.h:1607
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define INFINITE
Definition: serial.h:102
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
static void ANIMATE_Notify(const ANIMATE_INFO *infoPtr, UINT notif)
Definition: animate.c:88
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
DWORD dwHeight
Definition: vfw.h:950
static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
Definition: animate.c:795
WORD wLanguage
Definition: vfw.h:963
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
LPARAM lParam
Definition: combotst.c:139
LPBITMAPINFOHEADER inbih
Definition: animate.c:62
#define LOWORD(l)
Definition: pedump.c:82
static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPCWSTR lpName)
Definition: animate.c:95
#define SRCCOPY
Definition: wingdi.h:332
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:439
HDC hdcMem
Definition: welcome.c:104
DWORD dwRate
Definition: vfw.h:966
LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
Definition: mmio.c:732
static struct @323 fnIC
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:859
HMODULE hModule
Definition: animate.c:44
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
static IMMNotificationClient notif
Definition: mmdevenum.c:189