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.

78 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef SV_SESSIONRECORDER_H
  5. #define SV_SESSIONRECORDER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "basethinker.h"
  11. #include "utllinkedlist.h"
  12. #include "replay/ireplaysessionrecorder.h"
  13. #include "replay/replayhandle.h"
  14. #include "sv_filepublish.h"
  15. //----------------------------------------------------------------------------------------
  16. class IGameEvent;
  17. class CServerRecordingSessionBlock;
  18. class CServerRecordingSessionManager;
  19. class CBaseRecordingSessionBlockManager;
  20. class CSessionPublishManager;
  21. class IDemoBuffer;
  22. class CServerRecordingSession;
  23. //----------------------------------------------------------------------------------------
  24. class CSessionRecorder : public CBaseThinker,
  25. public IReplaySessionRecorder
  26. {
  27. public:
  28. CSessionRecorder();
  29. ~CSessionRecorder();
  30. bool Init();
  31. void AbortCurrentSessionRecording();
  32. int GetCurrentRecordingStartTick() const { return m_nCurrentRecordingStartTick; }
  33. void UpdateSessionLocks(); // Looks at publish managers and unlocks sessions as needed
  34. //
  35. // IReplaySessionRecorder
  36. //
  37. virtual void StartRecording(); // Will waiting for recording to stop, then will begin recording
  38. virtual void StopRecording( bool bAborting );
  39. virtual void SetCurrentRecordingStartTick( int nStartTick );
  40. // Finish any publish jobs synchronously
  41. void PublishAllSynchronous();
  42. bool RecordingAborted() const { return m_bRecordingAborted; }
  43. private:
  44. //
  45. // CBaseThinker
  46. //
  47. float GetNextThinkTime() const;
  48. void Think();
  49. void PublishThink();
  50. CSessionPublishManager *GetCurrentPublishManager() const; // Get the publish manager for the currently recording session
  51. void CreateAndAddNewPublishManager( CServerRecordingSession *pSession );
  52. int m_nCurrentRecordingStartTick;
  53. bool m_bRecordingAborted;
  54. typedef CUtlLinkedList< CSessionPublishManager *, int > PublishManagerContainer_t;
  55. PublishManagerContainer_t m_lstPublishManagers;
  56. };
  57. //----------------------------------------------------------------------------------------
  58. #endif // SV_SESSIONRECORDER_H