Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.6 KiB

  1. //
  2. // handle AVI RLE files with custom code.
  3. //
  4. // use this code to deal with .AVI files without the MCIAVI runtime
  5. //
  6. // restrictions:
  7. //
  8. // AVI file must be a native DIB format (RLE or none)
  9. // AVI file must fit into memory.
  10. //
  11. #define FOURCC DWORD
  12. // HACK to build for now under NT
  13. #include <avifmt.h>
  14. #define PTR
  15. typedef struct _RLEFILE {
  16. int NumFrames; // number of frames
  17. int Width; // width in pixels
  18. int Height; // height in pixels
  19. int Rate; // mSec per frame
  20. HPALETTE hpal; // palete for drawing
  21. HANDLE hRes; // resource handle
  22. LPVOID pFile; // bits of file.
  23. int iFrame; // current frame
  24. int iKeyFrame; // nearest key
  25. int nFrame; // index pos of frame.
  26. LPVOID pFrame; // current frame data
  27. DWORD cbFrame; // size in bytes of frame
  28. DWORD FullSizeImage; // full-frame size
  29. BITMAPINFOHEADER bi; // DIB format
  30. DWORD rgbs[256]; // the colors
  31. MainAVIHeader PTR *pMainHeader; // main header
  32. int iStream; // stream number of video
  33. AVIStreamHeader PTR*pStream; // video stream
  34. LPBITMAPINFOHEADER pFormat; // format of video stream
  35. LPVOID pMovie; // movie chunk
  36. UNALIGNED AVIINDEXENTRY PTR * pIndex; // master index
  37. COLORREF clrKey;
  38. } RLEFILE;
  39. extern BOOL RleFile_OpenFromFile(RLEFILE *prle, LPCTSTR szFile);
  40. extern BOOL RleFile_OpenFromResource(RLEFILE *prle, HINSTANCE hInstance, LPCTSTR szName, LPCTSTR szType);
  41. extern BOOL RleFile_Close(RLEFILE *prle);
  42. extern BOOL RleFile_SetColor(RLEFILE *prle, int iColor, COLORREF rgb);
  43. extern BOOL RleFile_ChangeColor(RLEFILE *prle, COLORREF rgbS, COLORREF rgbD);
  44. extern BOOL RleFile_Seek(RLEFILE *prle, int iFrame);
  45. extern BOOL RleFile_Paint(RLEFILE *prle, HDC hdc, int iFrame, int x, int y);
  46. extern BOOL RleFile_Draw(RLEFILE *prle, HDC hdc, int iFrame, int x, int y);
  47. #define RleFile_New() ((RLEFILE *)LocalAlloc(LPTR, sizeof(RLEFILE)))
  48. #define RleFile_Free(pavi) (RleFile_Close(pavi), LocalFree((HLOCAL)(pavi)))
  49. #define RleFile_NumFrames(prle) ((prle)->NumFrames)
  50. #define RleFile_Width(prle) ((prle)->Width)
  51. #define RleFile_Height(prle) ((prle)->Height)
  52. #define RleFile_Rate(prle) ((prle)->Rate)