CVideoHandler.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef CVIDEOHANDLEER_H
  2. #define CVIDEOHANDLEER_H
  3. #include <stdio.h>
  4. #include <windows.h>
  5. //
  6. #define BINKNOTHREADEDIO 0x00800000
  7. //
  8. // protected
  9. // FLib: HINST;
  10. // FLibName: string;
  11. // FFileHandle: HFile;
  12. // function GetCurrentFrame: int; virtual; abstract;
  13. // function GetFramesCount: int; virtual; abstract;
  14. // procedure SetCurrentFrame(v: int); virtual; abstract;
  15. // procedure DoOpen(FileHandle: hFile); virtual; abstract;
  16. // function NormalizeFrame(i:int):int;
  17. // procedure SetPause(v:Boolean); virtual; abstract;
  18. //
  19. // procedure LoadProc(var Proc:Pointer; const ProcName:string);
  20. // public
  21. // Width:pint;
  22. // Height:pint;
  23. // constructor Create(const LibName:string);
  24. // destructor Destroy; override;
  25. // procedure Open(FileHandle:hFile); overload;
  26. // procedure Open(FileName:string); overload;
  27. //// procedure Open(FileData:TRSByteArray); overload;
  28. // procedure SetVolume(i: int); virtual;
  29. // procedure Close; virtual;
  30. // procedure NextFrame; virtual; abstract;
  31. // procedure PreparePic(b:TBitmap); virtual;
  32. // procedure GotoFrame(Index:int; b:TBitmap); virtual;
  33. // function ExtractFrame(b:TBitmap = nil):TBitmap; virtual; abstract;
  34. // function Wait:Boolean; virtual; abstract;
  35. // // Workaround for Bink and Smack thread synchronization bug
  36. // property Frame: int read GetCurrentFrame write SetCurrentFrame;
  37. // property FramesCount: int read GetFramesCount;
  38. // property LibInstance: HINST read FLib;
  39. // property Pause: Boolean write SetPause;
  40. //TRSSmkStruct = packed record
  41. // Version: int;
  42. // Width: int;
  43. // Height: int;
  44. // FrameCount: int;
  45. // mspf: int;
  46. // Unk1: array[0..87] of byte;
  47. // Palette: array[0..775] of byte;
  48. // CurrentFrame: int; // Starting with 0
  49. // // 72 - Øèï
  50. // // 1060 - interesting
  51. // // 1100 - Mute:Bool
  52. //end;
  53. //TRSBinkStruct = packed record
  54. // Width: int;
  55. // Height: int;
  56. // FrameCount: int;
  57. // CurrentFrame: int; // Starting with 1
  58. // LastFrame: int;
  59. // FPSMul: int; // frames/second multiplier
  60. // FPSDiv: int; // frames/second divisor
  61. // Unk1: int;
  62. // Flags: int;
  63. // Unk2: array[0..259] of byte;
  64. // CurrentPlane: int;
  65. // Plane1: ptr;
  66. // Plane2: ptr;
  67. // Unk3: array[0..1] of int;
  68. // YPlaneWidth: int;
  69. // YPlaneHeight: int;
  70. // UVPlaneWidth: int;
  71. // UVPlaneHeight: int;
  72. //end;
  73. typedef struct
  74. {
  75. int width;
  76. int height;
  77. int frameCount;
  78. int currentFrame;
  79. int lastFrame;
  80. int FPSMul;
  81. int FPSDiv;
  82. int unknown0;
  83. unsigned char flags;
  84. unsigned char unknown1[260];
  85. int CurPlane; // current plane
  86. void *plane0; // pointer to plane 0
  87. void *plane1; // pointer to plane 1
  88. int unknown2;
  89. int unknown3;
  90. int yWidth; // Y plane width
  91. int yHeight; // Y plane height
  92. int uvWidth; // U&V plane width
  93. int uvHeight; // U&V plane height
  94. int d,e,f,g,h,i;
  95. } BINK_STRUCT, *HBINK;
  96. struct SMKStruct
  97. {
  98. int version, width, height, frameCount, mspf, currentFrame;
  99. unsigned char unk1[88], palette[776];
  100. };
  101. class DLLHandler
  102. {
  103. public:
  104. HINSTANCE dll;
  105. void Instantiate(const char *filename);
  106. const char *GetLibExtension();
  107. void *FindAddress234(const char *symbol);
  108. virtual ~DLLHandler();
  109. };
  110. class CBIKHandler
  111. {
  112. public:
  113. DLLHandler ourLib;
  114. int newmode;
  115. HANDLE hBinkFile;
  116. HBINK hBink;
  117. BINK_STRUCT data;
  118. unsigned char * buffer;
  119. void * waveOutOpen, * BinkGetError, *BinkOpen, *BinkSetSoundSystem ;
  120. int width, height;
  121. CBIKHandler();
  122. void open(std::string name);
  123. void close();
  124. };
  125. #endif //CVIDEOHANDLEER_H