IVideoPlayer.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * IVideoPlayer.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../lib/filesystem/ResourcePath.h"
  12. struct SDL_Surface;
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class Point;
  15. VCMI_LIB_NAMESPACE_END
  16. class IVideoInstance
  17. {
  18. public:
  19. /// Returns current video timestamp
  20. virtual double timeStamp() = 0;
  21. /// Returns true if video playback is over
  22. virtual bool videoEnded() = 0;
  23. /// Returns dimensions of the video
  24. virtual Point size() = 0;
  25. /// Displays current frame at specified position
  26. virtual void show(const Point & position, SDL_Surface * to) = 0;
  27. /// Advances video playback by specified duration
  28. virtual void tick(uint32_t msPassed) = 0;
  29. /// activate or deactivate video
  30. virtual void activate() = 0;
  31. virtual void deactivate() = 0;
  32. virtual ~IVideoInstance() = default;
  33. };
  34. class IVideoPlayer : boost::noncopyable
  35. {
  36. public:
  37. /// Load video from specified path. Returns nullptr on failure
  38. virtual std::unique_ptr<IVideoInstance> open(const VideoPath & name, float scaleFactor) = 0;
  39. /// Extracts audio data from provided video in wav format
  40. virtual std::pair<std::unique_ptr<ui8[]>, si64> getAudio(const VideoPath & videoToOpen) = 0;
  41. virtual ~IVideoPlayer() = default;
  42. };