rtflic.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2016 RWS Inc, All Rights Reserved
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of version 2 of the GNU General Public License as published by
  7. // the Free Software Foundation
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License along
  15. // with this program; if not, write to the Free Software Foundation, Inc.,
  16. // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. //
  18. #ifndef RTFLIC_H
  19. #define RTFLIC_H
  20. //////////////////////////////////////////////////////////////////////////////
  21. // Headers.
  22. //////////////////////////////////////////////////////////////////////////////
  23. #include "dispatch.h"
  24. #include "Image.h"
  25. //////////////////////////////////////////////////////////////////////////////
  26. // Macros.
  27. //////////////////////////////////////////////////////////////////////////////
  28. // This value can be from 0 to 64K - 1.
  29. // The overhead per channel is sizeof(FLX_RT_HDR) bytes.
  30. #define MAX_VID_CHANNELS 25
  31. //////////////////////////////////////////////////////////////////////////////
  32. // Typedefs.
  33. //////////////////////////////////////////////////////////////////////////////
  34. // Forward declare classes for RTFLIC_CALL definition.
  35. class CRtFlic;
  36. class FLX_RT_HDR;
  37. typedef FLX_RT_HDR* PFLX_RT_HDR;
  38. typedef void (*RTFLIC_CALL)(CRtFlic* prtflic, PFLX_RT_HDR pflxhdr);
  39. class FLX_RT_HDR
  40. {
  41. public:
  42. // Header info from stream.
  43. short sNumFrames; // Number of frames. Max 4000.
  44. short sWidth; // Width in pixels (always 320 in FLI)
  45. short sHeight; // Height in pixels (always 200 in FLI)
  46. short sDepth; // Bits per pixel (always 8)
  47. long lMilliPerFrame; // Milliseconds between frames.
  48. short sNoDelta; // TRUE if no deltas, FALSE otherwise.
  49. short sTransparent; // Blt with transparency if TRUE.
  50. short sX; // Intended position in x direction.
  51. short sY; // Intended position in y direction.
  52. // Header info for our use.
  53. CImage* pImage; // Where to blt.
  54. short sCurFrame; // Current frame number (0 origin).
  55. short sPixelsModified; // TRUE if pixels were modified last
  56. // decompression.
  57. short sColorsModified; // TRUE if colors were modified last
  58. // decompression.
  59. long lMaxLag; // Maximum lag before skipping frames.
  60. RTFLIC_CALL callbackHeader; // Callback on header receipt.
  61. RTFLIC_CALL callbackBefore; // Callback before decompression.
  62. RTFLIC_CALL callbackAfter; // Callback after decompression.
  63. };
  64. class CRtFlic
  65. {
  66. public: // Construction/Destruction.
  67. // Default constructor.
  68. CRtFlic();
  69. // Destructor.
  70. ~CRtFlic();
  71. public: // Methods.
  72. // Sets the dispatcher.
  73. void SetDispatcher(CDispatch* pdispatch);
  74. // Sets callback(s) called on channel header receipt.
  75. void SetCallbackHeader(RTFLIC_CALL callback);
  76. void SetCallbackHeader(RTFLIC_CALL callback, short sChannel);
  77. // Sets callback(s) called before decompression.
  78. void SetCallbackBefore(RTFLIC_CALL callback);
  79. void SetCallbackBefore(RTFLIC_CALL callback, short sChannel);
  80. // Sets callback(s) called after decompression.
  81. void SetCallbackAfter(RTFLIC_CALL callback);
  82. void SetCallbackAfter(RTFLIC_CALL callback, short sChannel);
  83. protected: // Internal methods.
  84. // Sets variables w/o regard to current values.
  85. void Set();
  86. // Resets variables. Performs deallocation if necessary.
  87. void Reset();
  88. // Use handler for RtFlic buffers.
  89. // Returns RET_FREE if done with data on return, RET_DONTFREE otherwise.
  90. short Use( UCHAR* puc, long lSize, USHORT usType, UCHAR ucFlags,
  91. long lTime);
  92. // Static entry point for above.
  93. static short UseStatic( UCHAR* puc, long lSize, USHORT usType,
  94. UCHAR ucFlags, long lTime, long l_pRtFlic);
  95. protected: // Internal typedefs.
  96. public: // Members.
  97. protected: // Members.
  98. FLX_RT_HDR m_aflxhdrs[MAX_VID_CHANNELS];// Info for each channel.
  99. USHORT m_usState; // The current state of this CRtFlic.
  100. CDispatch* m_pdispatch; // The dispatcher for this CRtFlic.
  101. };
  102. #endif // RTFLIC_H
  103. //////////////////////////////////////////////////////////////////////////////
  104. // EOF
  105. //////////////////////////////////////////////////////////////////////////////