2024-05-02 14:55:20 +02:00
|
|
|
/*
|
|
|
|
* IVideoPlayer.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../lib/filesystem/ResourcePath.h"
|
|
|
|
|
2024-05-03 18:07:00 +02:00
|
|
|
class Canvas;
|
2024-05-02 14:55:20 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
class Point;
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
2024-05-03 18:07:00 +02:00
|
|
|
class IVideoInstance
|
2024-05-02 14:55:20 +02:00
|
|
|
{
|
2024-05-03 18:07:00 +02:00
|
|
|
public:
|
2024-10-16 02:36:26 +02:00
|
|
|
/// Returns current video timestamp
|
|
|
|
virtual double timeStamp() = 0;
|
|
|
|
|
2024-05-03 18:07:00 +02:00
|
|
|
/// Returns true if video playback is over
|
|
|
|
virtual bool videoEnded() = 0;
|
|
|
|
|
|
|
|
/// Returns dimensions of the video
|
|
|
|
virtual Point size() = 0;
|
|
|
|
|
|
|
|
/// Displays current frame at specified position
|
|
|
|
virtual void show(const Point & position, Canvas & canvas) = 0;
|
|
|
|
|
|
|
|
/// Advances video playback by specified duration
|
|
|
|
virtual void tick(uint32_t msPassed) = 0;
|
|
|
|
|
2024-10-30 01:35:50 +02:00
|
|
|
/// activate or deactivate video
|
|
|
|
virtual void activate() = 0;
|
|
|
|
virtual void deactivate() = 0;
|
|
|
|
|
2024-05-03 18:07:00 +02:00
|
|
|
virtual ~IVideoInstance() = default;
|
2024-05-02 14:55:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class IVideoPlayer : boost::noncopyable
|
|
|
|
{
|
|
|
|
public:
|
2024-05-03 18:07:00 +02:00
|
|
|
/// Load video from specified path. Returns nullptr on failure
|
2024-09-12 23:06:33 +02:00
|
|
|
virtual std::unique_ptr<IVideoInstance> open(const VideoPath & name, float scaleFactor) = 0;
|
2024-05-03 18:07:00 +02:00
|
|
|
|
2024-05-04 18:09:45 +02:00
|
|
|
/// Extracts audio data from provided video in wav format
|
2024-05-17 18:01:08 +02:00
|
|
|
virtual std::pair<std::unique_ptr<ui8[]>, si64> getAudio(const VideoPath & videoToOpen) = 0;
|
2024-05-04 18:09:45 +02:00
|
|
|
|
2024-05-02 14:55:20 +02:00
|
|
|
virtual ~IVideoPlayer() = default;
|
|
|
|
};
|