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.

128 lines
4.2 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 IAVI_H
  10. #define IAVI_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "appframework/iappsystem.h"
  15. //-----------------------------------------------------------------------------
  16. // Forward declarations
  17. //-----------------------------------------------------------------------------
  18. struct BGR888_t;
  19. class IMaterial;
  20. //-----------------------------------------------------------------------------
  21. // Parameters for creating a new AVI
  22. //-----------------------------------------------------------------------------
  23. struct AVIParams_t
  24. {
  25. AVIParams_t() :
  26. m_nFrameRate( 0 ), m_nFrameScale( 1 ), m_nWidth( 0 ), m_nHeight( 0 ),
  27. m_nSampleRate( 0 ), m_nSampleBits( 0 ), m_nNumChannels( 0 ), m_bGetCodecFromUser( true )
  28. {
  29. m_pFileName[ 0 ] = 0;
  30. }
  31. char m_pFileName[ 256 ];
  32. char m_pPathID[ 256 ];
  33. // fps = m_nFrameRate / m_nFrameScale
  34. // for integer framerates, set framerate to the fps, and framescale to 1
  35. // for ntsc-style framerates like 29.97 (or 23.976 or 59.94),
  36. // set framerate to 30,000 (or 24,000 or 60,000) and framescale to 1001
  37. // yes, framescale is an odd naming choice, but it matching MS's AVI api
  38. int m_nFrameRate;
  39. int m_nFrameScale;
  40. int m_nWidth;
  41. int m_nHeight;
  42. // Sound/.wav info
  43. int m_nSampleRate;
  44. int m_nSampleBits;
  45. int m_nNumChannels;
  46. // The user will be asked to select a compressor if true, otherwise the
  47. // previous or default will be used.
  48. bool m_bGetCodecFromUser;
  49. };
  50. //-----------------------------------------------------------------------------
  51. // Handle to an AVI
  52. //-----------------------------------------------------------------------------
  53. typedef unsigned short AVIHandle_t;
  54. enum
  55. {
  56. AVIHANDLE_INVALID = (AVIHandle_t)~0
  57. };
  58. //-----------------------------------------------------------------------------
  59. // Handle to an AVI material
  60. //-----------------------------------------------------------------------------
  61. typedef unsigned short AVIMaterial_t;
  62. enum
  63. {
  64. AVIMATERIAL_INVALID = (AVIMaterial_t)~0
  65. };
  66. //-----------------------------------------------------------------------------
  67. // Main AVI interface
  68. //-----------------------------------------------------------------------------
  69. class IAvi : public IAppSystem
  70. {
  71. public:
  72. // Necessary to call this before any other AVI interface methods
  73. virtual void SetMainWindow( void* hWnd ) = 0;
  74. // Start/stop recording an AVI
  75. virtual AVIHandle_t StartAVI( const AVIParams_t& params ) = 0;
  76. virtual void FinishAVI( AVIHandle_t handle ) = 0;
  77. // Add frames to an AVI
  78. virtual void AppendMovieSound( AVIHandle_t h, short *buf, size_t bufsize ) = 0;
  79. virtual void AppendMovieFrame( AVIHandle_t h, const BGR888_t *pRGBData ) = 0;
  80. // Create/destroy an AVI material (a materialsystem IMaterial)
  81. virtual AVIMaterial_t CreateAVIMaterial( const char *pMaterialName, const char *pFileName, const char *pPathID ) = 0;
  82. virtual void DestroyAVIMaterial( AVIMaterial_t hMaterial ) = 0;
  83. // Sets the time for an AVI material
  84. virtual void SetTime( AVIMaterial_t hMaterial, float flTime ) = 0;
  85. // Gets the IMaterial associated with an AVI material
  86. virtual IMaterial* GetMaterial( AVIMaterial_t hMaterial ) = 0;
  87. // Returns the max texture coordinate of the AVI
  88. virtual void GetTexCoordRange( AVIMaterial_t hMaterial, float *pMaxU, float *pMaxV ) = 0;
  89. // Returns the frame size of the AVI (stored in a subrect of the material itself)
  90. virtual void GetFrameSize( AVIMaterial_t hMaterial, int *pWidth, int *pHeight ) = 0;
  91. // Returns the frame rate of the AVI
  92. virtual int GetFrameRate( AVIMaterial_t hMaterial ) = 0;
  93. // Returns the total frame count of the AVI
  94. virtual int GetFrameCount( AVIMaterial_t hMaterial ) = 0;
  95. // Sets the frame for an AVI material (use instead of SetTime)
  96. virtual void SetFrame( AVIMaterial_t hMaterial, float flFrame ) = 0;
  97. };
  98. extern IAvi *g_pAVI;
  99. #endif // IAVI_H