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.

61 lines
2.5 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. #include <vfw.h>
  13. #define PTR
  14. typedef struct _RLEFILE {
  15. int NumFrames; // number of frames
  16. int Width; // width in pixels
  17. int Height; // height in pixels
  18. int Rate; // mSec per frame
  19. HPALETTE hpal; // palete for drawing
  20. HANDLE hRes; // resource handle
  21. LPVOID pFile; // bits of file.
  22. int iFrame; // current frame
  23. int iKeyFrame; // nearest key
  24. int nFrame; // index pos of frame.
  25. LPVOID pFrame; // current frame data
  26. DWORD cbFrame; // size in bytes of frame
  27. DWORD FullSizeImage; // full-frame size
  28. BITMAPINFOHEADER bi; // DIB format
  29. DWORD rgbs[256]; // the colors
  30. MainAVIHeader PTR *pMainHeader; // main header
  31. int iStream; // stream number of video
  32. AVIStreamHeader PTR*pStream; // video stream
  33. LPBITMAPINFOHEADER pFormat; // format of video stream
  34. LPVOID pMovie; // movie chunk
  35. UNALIGNED AVIINDEXENTRY PTR * pIndex; // master index
  36. } RLEFILE;
  37. extern BOOL RleFile_OpenFromFile(RLEFILE *prle, LPCTSTR szFile);
  38. extern BOOL RleFile_OpenFromResource(RLEFILE *prle, HINSTANCE hInstance, LPCTSTR szName, LPCTSTR szType);
  39. extern BOOL RleFile_Close(RLEFILE *prle);
  40. extern BOOL RleFile_SetColor(RLEFILE *prle, int iColor, COLORREF rgb);
  41. extern BOOL RleFile_ChangeColor(RLEFILE *prle, COLORREF rgbS, COLORREF rgbD);
  42. extern BOOL RleFile_Seek(RLEFILE *prle, int iFrame);
  43. extern BOOL RleFile_Paint(RLEFILE *prle, HDC hdc, int iFrame, int x, int y);
  44. extern BOOL RleFile_Draw(RLEFILE *prle, HDC hdc, int iFrame, int x, int y);
  45. #define RleFile_New() ((RLEFILE *)LocalAlloc(LPTR, sizeof(RLEFILE)))
  46. #define RleFile_Free(pavi) (RleFile_Close(pavi), LocalFree((HLOCAL)(pavi)))
  47. #define RleFile_NumFrames(prle) ((prle)->NumFrames)
  48. #define RleFile_Width(prle) ((prle)->Width)
  49. #define RleFile_Height(prle) ((prle)->Height)
  50. #define RleFile_Rate(prle) ((prle)->Rate)