From fbbcb5a56713eef39342af8729f5e81e829b74ed Mon Sep 17 00:00:00 2001 From: Ivan Mogilko Date: Thu, 14 Mar 2024 21:30:21 +0300 Subject: [PATCH] Engine: provided stubs for AGS_NO_VIDEO_PLAYER build --- Engine/media/video/video.cpp | 39 +++++++++++++++++++++++++++---- Engine/media/video/video_core.cpp | 22 +++++++++++++++-- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/Engine/media/video/video.cpp b/Engine/media/video/video.cpp index 4e7cd0ee6b1..da766475121 100644 --- a/Engine/media/video/video.cpp +++ b/Engine/media/video/video.cpp @@ -662,10 +662,39 @@ void video_shutdown() #else -HError play_theora_video(const char *name, int video_flags, int state_flags, AGS::Engine::VideoSkipType skip) { return HError::None(); } -HError play_flc_video(int numb, int video_flags, int state_flags, AGS::Engine::VideoSkipType skip) { return HError::None(); } -void video_pause() {} -void video_resume() {} -void video_shutdown() {} +//----------------------------------------------------------------------------- +// Stubs for the video support +//----------------------------------------------------------------------------- + +using namespace AGS::Common; + +HError play_theora_video(const char *, int, int, AGS::Engine::VideoSkipType) +{ + return new Error("Video playback is not supported in this engine build."); +} +HError play_flc_video(int, int, int, AGS::Engine::VideoSkipType) +{ + return new Error("Video playback is not supported in this engine build."); +} +void video_single_pause() {} +void video_single_resume() {} +void video_single_stop() {} + +HError open_video(const char *, int, int &) +{ + return new Error("Video playback is not supported in this engine build."); +} +VideoControl *get_video_control(int) { return nullptr; } +void video_stop(int) { } +void sync_video_playback() { } +void update_video_system_on_game_loop() { } +void video_shutdown() { } + +void VideoControl::SetScriptHandle(int) {} +bool VideoControl::Play() { return false; } +void VideoControl::Pause() {} +bool VideoControl::NextFrame() { return false; } +uint32_t VideoControl::SeekFrame(uint32_t) { return -1; } +float VideoControl::SeekMs(float) { return -1.f; } #endif diff --git a/Engine/media/video/video_core.cpp b/Engine/media/video/video_core.cpp index 17d05b01432..80a1f7f0b4b 100644 --- a/Engine/media/video/video_core.cpp +++ b/Engine/media/video/video_core.cpp @@ -170,10 +170,28 @@ static void video_core_entry() g_vcore.poll_cv.wait_for(lk, std::chrono::milliseconds(8)); } } -#endif +#endif // !AGS_DISABLE_THREADS #else // AGS_NO_VIDEO_PLAYER -// TODO +void video_core_init(/*config*/) +{ + Debug::Printf(kDbgMsg_Warn, "VideoCore: video playback is not supported in this engine build."); +} +void video_core_shutdown() { } +int video_core_slot_init(std::unique_ptr, + const AGS::Common::String &, const AGS::Common::String &, const VideoInitParams &) +{ + return -1; +} +VideoPlayerLock video_core_get_player(int) +{ + throw std::runtime_error("Video playback is not supported in this engine build."); +} +void video_core_slot_stop(int) {} + +#if defined(AGS_DISABLE_THREADS) +void video_core_entry_poll() {} +#endif #endif // !AGS_NO_VIDEO_PLAYER