media_streaming_file_delegate.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. namespace FFmpeg {
  9. class Packet;
  10. } // namespace FFmpeg
  11. namespace Media {
  12. namespace Streaming {
  13. struct Stream;
  14. enum class Error;
  15. class FileDelegate {
  16. public:
  17. [[nodiscard]] virtual Mode fileOpenMode() = 0;
  18. [[nodiscard]] virtual bool fileReady(
  19. int headerSize,
  20. Stream &&video,
  21. Stream &&audio) = 0;
  22. virtual void fileError(Error error) = 0;
  23. virtual void fileWaitingForData() = 0;
  24. virtual void fileFullInCache(bool fullInCache) = 0;
  25. virtual void fileProcessEndOfFile() = 0;
  26. // Return true if reading and processing more packets is desired.
  27. // Return false if sleeping until 'wake()' is called is desired.
  28. [[nodiscard]] virtual bool fileProcessPackets(
  29. base::flat_map<int, std::vector<FFmpeg::Packet>> &packets) = 0;
  30. // Also returns true after fileProcessEndOfFile() if looping is desired.
  31. [[nodiscard]] virtual bool fileReadMore() = 0;
  32. };
  33. } // namespace Streaming
  34. } // namespace Media