BinkVideoPlayer.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. //----------------------------------------------------------------------------
  24. //
  25. // Westwood Studios Pacific.
  26. //
  27. // Confidential Information
  28. // Copyright (C) 2001 - All Rights Reserved
  29. //
  30. //----------------------------------------------------------------------------
  31. //
  32. // Project: Generals
  33. //
  34. // File name: GameClient/VideoPlayer.h
  35. //
  36. // Created: 10/22/01
  37. //
  38. //----------------------------------------------------------------------------
  39. #pragma once
  40. #ifndef __VIDEODEVICE_BINKDEVICE_H_
  41. #define __VIDEODEVICE_BINKDEVICE_H_
  42. //----------------------------------------------------------------------------
  43. // Includes
  44. //----------------------------------------------------------------------------
  45. #include "GameClient/VideoPlayer.h"
  46. #include "bink.h"
  47. //----------------------------------------------------------------------------
  48. // Forward References
  49. //----------------------------------------------------------------------------
  50. class BinkVideoPlayer;
  51. //----------------------------------------------------------------------------
  52. // Type Defines
  53. //----------------------------------------------------------------------------
  54. //===============================
  55. // BinkVideoStream
  56. //===============================
  57. class BinkVideoStream : public VideoStream
  58. {
  59. friend class BinkVideoPlayer;
  60. protected:
  61. HBINK m_handle; ///< Bink streaming handle;
  62. Char *m_memFile; ///< Pointer to memory resident file
  63. BinkVideoStream(); ///< only BinkVideoPlayer can create these
  64. virtual ~BinkVideoStream();
  65. public:
  66. virtual void update( void ); ///< Update bink stream
  67. virtual Bool isFrameReady( void ); ///< Is the frame ready to be displayed
  68. virtual void frameDecompress( void ); ///< Render current frame in to buffer
  69. virtual void frameRender( VideoBuffer *buffer ); ///< Render current frame in to buffer
  70. virtual void frameNext( void ); ///< Advance to next frame
  71. virtual Int frameIndex( void ); ///< Returns zero based index of current frame
  72. virtual Int frameCount( void ); ///< Returns the total number of frames in the stream
  73. virtual void frameGoto( Int index ); ///< Go to the spcified frame index
  74. virtual Int height( void ); ///< Return the height of the video
  75. virtual Int width( void ); ///< Return the width of the video
  76. };
  77. //===============================
  78. // BinkVideoPlayer
  79. //===============================
  80. /**
  81. * Bink video playback code.
  82. */
  83. //===============================
  84. class BinkVideoPlayer : public VideoPlayer
  85. {
  86. protected:
  87. VideoStreamInterface* createStream( HBINK handle );
  88. public:
  89. // subsytem requirements
  90. virtual void init( void ); ///< Initialize video playback code
  91. virtual void reset( void ); ///< Reset video playback
  92. virtual void update( void ); ///< Services all audio tasks. Should be called frequently
  93. virtual void deinit( void ); ///< Close down player
  94. BinkVideoPlayer();
  95. ~BinkVideoPlayer();
  96. // service
  97. virtual void loseFocus( void ); ///< Should be called when application loses focus
  98. virtual void regainFocus( void ); ///< Should be called when application regains focus
  99. virtual VideoStreamInterface* open( AsciiString movieTitle ); ///< Open video file for playback
  100. virtual VideoStreamInterface* load( AsciiString movieTitle ); ///< Load video file in to memory for playback
  101. virtual void notifyVideoPlayerOfNewProvider( Bool nowHasValid );
  102. virtual void initializeBinkWithMiles( void );
  103. };
  104. //----------------------------------------------------------------------------
  105. // Inlining
  106. //----------------------------------------------------------------------------
  107. #endif // __VIDEODEVICE_BINKDEVICE_H_