Team Fortress 2 Source Code as on 22/4/2020
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.

133 lines
4.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef WEBM_VIDEO_H
  7. #define WEBM_VIDEO_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //-----------------------------------------------------------------------------
  12. // Forward declarations
  13. //-----------------------------------------------------------------------------
  14. class IFileSystem;
  15. class IMaterialSystem;
  16. class CQuickTimeMaterial;
  17. //-----------------------------------------------------------------------------
  18. // Global interfaces - you already did the needed includes, right?
  19. //-----------------------------------------------------------------------------
  20. extern IFileSystem *g_pFileSystem;
  21. extern IMaterialSystem *materials;
  22. //-----------------------------------------------------------------------------
  23. // WebM Header files, anything that seems strange here is to make it so their headers
  24. // can mesh with ours
  25. //-----------------------------------------------------------------------------
  26. #define VPX_CODEC_DISABLE_COMPAT 1
  27. #include "vpx/vpx_codec.h"
  28. #include "vpx/vpx_encoder.h"
  29. #include "vpx/vpx_image.h"
  30. #include "vpx/vp8cx.h"
  31. #ifdef UNUSED
  32. #undef UNUSED
  33. #endif
  34. // libwebm, support for reading/writing webm files
  35. #include "mkvreader.hpp"
  36. #include "mkvparser.hpp"
  37. #include "mkvmuxer.hpp"
  38. #include "mkvwriter.hpp"
  39. #include "mkvmuxerutil.hpp"
  40. #include "vorbis/vorbisenc.h"
  41. #include "vorbis/codec.h"
  42. #include "video/ivideoservices.h"
  43. #include "videosubsystem.h"
  44. #include "utlvector.h"
  45. #include "tier1/KeyValues.h"
  46. #include "tier0/platform.h"
  47. // -----------------------------------------------------------------------------
  48. // CQuickTimeVideoSubSystem - Implementation of IVideoSubSystem
  49. // -----------------------------------------------------------------------------
  50. class CWebMVideoSubSystem : public CTier2AppSystem< IVideoSubSystem >
  51. {
  52. typedef CTier2AppSystem< IVideoSubSystem > BaseClass;
  53. public:
  54. CWebMVideoSubSystem();
  55. ~CWebMVideoSubSystem();
  56. // Inherited from IAppSystem
  57. virtual bool Connect( CreateInterfaceFn factory );
  58. virtual void Disconnect();
  59. virtual void *QueryInterface( const char *pInterfaceName );
  60. virtual InitReturnVal_t Init();
  61. virtual void Shutdown();
  62. // Inherited from IVideoSubSystem
  63. // SubSystem Identification functions
  64. virtual VideoSystem_t GetSystemID();
  65. virtual VideoSystemStatus_t GetSystemStatus();
  66. virtual VideoSystemFeature_t GetSupportedFeatures();
  67. virtual const char *GetVideoSystemName();
  68. // Setup & Shutdown Services
  69. virtual bool InitializeVideoSystem( IVideoCommonServices *pCommonServices );
  70. virtual bool ShutdownVideoSystem();
  71. virtual VideoResult_t VideoSoundDeviceCMD( VideoSoundDeviceOperation_t operation, void *pDevice = nullptr, void *pData = nullptr );
  72. // get list of file extensions and features we support
  73. virtual int GetSupportedFileExtensionCount();
  74. virtual const char *GetSupportedFileExtension( int num );
  75. virtual VideoSystemFeature_t GetSupportedFileExtensionFeatures( int num );
  76. // Video Playback and Recording Services
  77. virtual VideoResult_t PlayVideoFileFullScreen( const char *filename, void *mainWindow, int windowWidth, int windowHeight, int desktopWidth, int desktopHeight, bool windowed, float forcedMinTime, VideoPlaybackFlags_t playbackFlags );
  78. // Create/destroy a video material
  79. virtual IVideoMaterial *CreateVideoMaterial( const char *pMaterialName, const char *pVideoFileName, VideoPlaybackFlags_t flags );
  80. virtual VideoResult_t DestroyVideoMaterial( IVideoMaterial *pVideoMaterial );
  81. // Create/destroy a video encoder
  82. virtual IVideoRecorder *CreateVideoRecorder();
  83. virtual VideoResult_t DestroyVideoRecorder( IVideoRecorder *pRecorder );
  84. virtual VideoResult_t CheckCodecAvailability( VideoEncodeCodec_t codec );
  85. virtual VideoResult_t GetLastResult();
  86. private:
  87. bool SetupWebM();
  88. bool ShutdownWebM();
  89. VideoResult_t SetResult( VideoResult_t status );
  90. bool m_bWebMInitialized;
  91. VideoResult_t m_LastResult;
  92. VideoSystemStatus_t m_CurrentStatus;
  93. VideoSystemFeature_t m_AvailableFeatures;
  94. IVideoCommonServices *m_pCommonServices;
  95. CUtlVector< IVideoMaterial* > m_MaterialList;
  96. CUtlVector< IVideoRecorder* > m_RecorderList;
  97. static const VideoSystemFeature_t DEFAULT_FEATURE_SET;
  98. };
  99. #endif // WEBM_VIDEO_H