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.

83 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef SV_SESSIONBLOCKPUBLISHER_H
  5. #define SV_SESSIONBLOCKPUBLISHER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "sv_filepublish.h"
  11. #include "replay/replayhandle.h"
  12. //----------------------------------------------------------------------------------------
  13. class CServerRecordingSession;
  14. class CServerRecordingSessionBlock;
  15. class CSessionInfoPublisher;
  16. class IDemoBuffer;
  17. //----------------------------------------------------------------------------------------
  18. class CSessionBlockPublisher : public IPublishCallbackHandler
  19. {
  20. public:
  21. CSessionBlockPublisher( CServerRecordingSession *pSession, CSessionInfoPublisher *pSessionInfoPublisher );
  22. ~CSessionBlockPublisher();
  23. void Think(); // Called explicitly
  24. // Finish any publish jobs synchronously
  25. void PublishAllSynchronous();
  26. // Abort any publishing
  27. void AbortPublish();
  28. // Have all publish job completed?
  29. bool IsDone() const;
  30. // This will flag this publish manager as recording
  31. void OnStartRecording();
  32. // This will write out and publish any final session block
  33. void OnStopRecord( bool bAborting );
  34. // Get the handle for the associated session
  35. ReplayHandle_t GetSessionHandle() const;
  36. #ifdef _DEBUG
  37. void Validate();
  38. #endif
  39. private:
  40. //
  41. // IPublishCallback
  42. //
  43. virtual void OnPublishComplete( const IFilePublisher *pPublisher, void *pUserData );
  44. virtual void OnPublishAborted( const IFilePublisher *pPublisher );
  45. virtual void AdjustHeader( const IFilePublisher *pPublisher, void *pHeaderData ) {}
  46. void PublishBlock( CServerRecordingSessionBlock *pBlock );
  47. void WriteAndPublishSessionBlock();
  48. void PublishThink();
  49. void WriteSessionBlockThink();
  50. void SessionLockThink();
  51. void GatherBlockData( uint8 *pSessionBuffer, int nSessionBufferSize, CServerRecordingSessionBlock *pBlock,
  52. unsigned char **ppBlockData, int *pBlockSize );
  53. CServerRecordingSessionBlock *FindBlockFromPublisher( const IFilePublisher *pPublisher );
  54. float m_flLastBlockWriteTime;
  55. int m_nDumpInterval;
  56. CUtlLinkedList< CServerRecordingSessionBlock *, int > m_lstPublishingBlocks;
  57. CServerRecordingSession *m_pSession;
  58. CSessionInfoPublisher *m_pSessionInfoPublisher;
  59. };
  60. //----------------------------------------------------------------------------------------
  61. #endif // SV_SESSIONBLOCKPUBLISHER_H