Counter Strike : Global Offensive Source Code
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.

153 lines
5.0 KiB

  1. //====== Copyright 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // The copyright to the contents herein is the property of Valve, L.L.C.
  4. // The contents may be used and/or copied only with the written permission of
  5. // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
  6. // the agreement/contract under which the contents have been supplied.
  7. //
  8. //=============================================================================
  9. #ifndef IBIK_H
  10. #define IBIK_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "appframework/iappsystem.h"
  15. #define BIK_LOOP 0x00000001 // play endlessly
  16. #define BIK_PRELOAD 0x00000002 // causes the entire move to load into memory
  17. #define BIK_NO_AUDIO 0x00000004 // video doesn't have audio
  18. #define ENABLE_BIK_PERF_SPEW 0
  19. //-----------------------------------------------------------------------------
  20. // Forward declarations
  21. //-----------------------------------------------------------------------------
  22. struct BGR888_t;
  23. class IMaterial;
  24. //-----------------------------------------------------------------------------
  25. // Parameters for creating a new BINK
  26. //-----------------------------------------------------------------------------
  27. struct BIKParams_t
  28. {
  29. BIKParams_t() :
  30. m_nFrameRate( 0 ), m_nFrameScale( 1 ), m_nWidth( 0 ), m_nHeight( 0 ),
  31. m_nSampleRate( 0 ), m_nSampleBits( 0 ), m_nNumChannels( 0 )
  32. {
  33. m_pFileName[ 0 ] = 0;
  34. }
  35. char m_pFileName[ 256 ];
  36. char m_pPathID[ 256 ];
  37. // fps = m_nFrameRate / m_nFrameScale
  38. // for integer framerates, set framerate to the fps, and framescale to 1
  39. // for ntsc-style framerates like 29.97 (or 23.976 or 59.94),
  40. // set framerate to 30,000 (or 24,000 or 60,000) and framescale to 1001
  41. // yes, framescale is an odd naming choice, but it matching MS's AVI api
  42. int m_nFrameRate;
  43. int m_nFrameScale;
  44. int m_nWidth;
  45. int m_nHeight;
  46. // Sound/.wav info
  47. int m_nSampleRate;
  48. int m_nSampleBits;
  49. int m_nNumChannels;
  50. };
  51. //-----------------------------------------------------------------------------
  52. // Handle to an BINK
  53. //-----------------------------------------------------------------------------
  54. typedef unsigned short BIKHandle_t;
  55. enum
  56. {
  57. BIKHANDLE_INVALID = (BIKHandle_t)~0
  58. };
  59. //-----------------------------------------------------------------------------
  60. // Handle to an BINK material
  61. //-----------------------------------------------------------------------------
  62. typedef unsigned short BIKMaterial_t;
  63. enum
  64. {
  65. BIKMATERIAL_INVALID = (BIKMaterial_t)~0
  66. };
  67. //-----------------------------------------------------------------------------
  68. // Main AVI interface
  69. //-----------------------------------------------------------------------------
  70. class IBik : public IAppSystem
  71. {
  72. public:
  73. // Create/destroy a BINK material (a materialsystem IMaterial)
  74. virtual BIKMaterial_t CreateMaterial( const char *pMaterialName, const char *pFileName, const char *pPathID, int flags = 0 ) = 0;
  75. virtual void DestroyMaterial( BIKMaterial_t hMaterial ) = 0;
  76. // Update the frame (if necessary)
  77. virtual bool Update( BIKMaterial_t hMaterial ) = 0;
  78. virtual bool ReadyForSwap( BIKMaterial_t hMaterial ) = 0;
  79. // Gets the IMaterial associated with an BINK material
  80. virtual IMaterial* GetMaterial( BIKMaterial_t hMaterial ) = 0;
  81. // Returns the max texture coordinate of the BINK
  82. virtual void GetTexCoordRange( BIKMaterial_t hMaterial, float *pMaxU, float *pMaxV ) = 0;
  83. // Returns the frame size of the BINK (stored in a subrect of the material itself)
  84. virtual void GetFrameSize( BIKMaterial_t hMaterial, int *pWidth, int *pHeight ) = 0;
  85. // Returns the frame rate of the BINK
  86. virtual int GetFrameRate( BIKMaterial_t hMaterial ) = 0;
  87. // Returns the total frame count of the BINK
  88. virtual int GetFrameCount( BIKMaterial_t hMaterial ) = 0;
  89. // Get our current frame
  90. virtual int GetFrame( BIKMaterial_t hMaterial ) = 0;
  91. // Sets the frame for an BINK material (use instead of SetTime)
  92. virtual void SetFrame( BIKMaterial_t hMaterial, float flFrame ) = 0;
  93. #ifdef WIN32
  94. #if !defined( _X360 )
  95. // Sets the direct sound device that Bink will decode to
  96. virtual bool SetDirectSoundDevice( void *pDevice ) = 0;
  97. virtual bool SetMilesSoundDevice( void *pDevice ) = 0;
  98. #else
  99. //needs to be called after xaudio is initialized
  100. virtual bool HookXAudio( void ) = 0;
  101. #endif
  102. #endif
  103. #if defined( _PS3 )
  104. virtual bool SetPS3SoundDevice( int nChannelCount ) = 0;
  105. #endif // _PS3
  106. // Pause and unpause the movie playback
  107. virtual void Pause( BIKMaterial_t hMaterial ) = 0;
  108. virtual void Unpause( BIKMaterial_t hMaterial ) = 0;
  109. // Number for appending the current material name
  110. virtual int GetGlobalMaterialAllocationNumber( void ) = 0;
  111. virtual bool PrecacheMovie( const char *pFileName, const char *pPathID = NULL ) = 0;
  112. virtual void *GetPrecachedMovie( const char *pFileName ) = 0;
  113. virtual void EvictPrecachedMovie( const char *pFileName ) = 0;
  114. virtual void EvictAllPrecachedMovies() = 0;
  115. virtual void UpdateVolume( BIKMaterial_t hMaterial ) = 0;
  116. virtual bool IsMovieResidentInMemory( BIKMaterial_t hMaterial ) = 0;
  117. };
  118. extern IBik *g_pBIK;
  119. #endif // IBIK_H