CVideoHandler.h 3.7 KB

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