mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-21 12:06:49 +02:00
Correctly shutdown client media handlers
This commit is contained in:
parent
a6f37b7cd7
commit
af0afb251e
@ -473,6 +473,9 @@ static void quitApplication()
|
|||||||
|
|
||||||
delete CCS->consoleh;
|
delete CCS->consoleh;
|
||||||
delete CCS->curh;
|
delete CCS->curh;
|
||||||
|
delete CCS->videoh;
|
||||||
|
delete CCS->musich;
|
||||||
|
delete CCS->soundh;
|
||||||
|
|
||||||
vstd::clear_pointer(CCS);
|
vstd::clear_pointer(CCS);
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,9 @@ protected:
|
|||||||
bool initialized;
|
bool initialized;
|
||||||
int volume; // from 0 (mute) to 100
|
int volume; // from 0 (mute) to 100
|
||||||
|
|
||||||
public:
|
|
||||||
CAudioBase(): initialized(false), volume(0) {};
|
CAudioBase(): initialized(false), volume(0) {};
|
||||||
|
~CAudioBase() = default;
|
||||||
|
public:
|
||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
virtual void release() = 0;
|
virtual void release() = 0;
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ public:
|
|||||||
ui32 getVolume() const { return volume; };
|
ui32 getVolume() const { return volume; };
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSoundHandler: public CAudioBase
|
class CSoundHandler final : public CAudioBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
//update volume on configuration change
|
//update volume on configuration change
|
||||||
@ -124,7 +125,7 @@ public:
|
|||||||
bool stop(int fade_ms=0);
|
bool stop(int fade_ms=0);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMusicHandler: public CAudioBase
|
class CMusicHandler final: public CAudioBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
//update volume on configuration change
|
//update volume on configuration change
|
||||||
|
@ -31,6 +31,7 @@ public:
|
|||||||
class IMainVideoPlayer : public IVideoPlayer
|
class IMainVideoPlayer : public IVideoPlayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~IMainVideoPlayer() = default;
|
||||||
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> restart = nullptr){}
|
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> restart = nullptr){}
|
||||||
virtual bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false)
|
virtual bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false)
|
||||||
{
|
{
|
||||||
@ -39,7 +40,7 @@ public:
|
|||||||
virtual std::pair<std::unique_ptr<ui8 []>, si64> getAudio(const VideoPath & videoToOpen) { return std::make_pair(nullptr, 0); };
|
virtual std::pair<std::unique_ptr<ui8 []>, si64> getAudio(const VideoPath & videoToOpen) { return std::make_pair(nullptr, 0); };
|
||||||
};
|
};
|
||||||
|
|
||||||
class CEmptyVideoPlayer : public IMainVideoPlayer
|
class CEmptyVideoPlayer final : public IMainVideoPlayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int curFrame() const override {return -1;};
|
int curFrame() const override {return -1;};
|
||||||
@ -64,7 +65,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
class CInputStream;
|
class CInputStream;
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
class CVideoPlayer : public IMainVideoPlayer
|
class CVideoPlayer final : public IMainVideoPlayer
|
||||||
{
|
{
|
||||||
int stream; // stream index in video
|
int stream; // stream index in video
|
||||||
AVFormatContext *format;
|
AVFormatContext *format;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user