Source code of Windows XP (NT5)
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.

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