Open
Conversation
490a040 to
c076115
Compare
Author
Demonese
reviewed
Feb 22, 2026
47ec385 to
8856c99
Compare
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive video texture support to the engine, enabling videos to be loaded and rendered as textures. The implementation integrates video decoding through Microsoft Media Foundation (Direct3D 11 platform) with the existing graphics and resource management systems.
Changes:
- Implemented
VideoDecoderandVideoTextureclasses with hardware-accelerated decoding support via Media Foundation - Extended
IGraphicsDeviceandITexture2Dinterfaces to support video textures - Added
LoadVideomethod to resource manager for loading videos into the texture pool - Created Lua bindings (both modern OOP-style
lstg.Videoclass and classiclstg.LoadVideofunction) - Added configuration option to disable hardware video decoding
- Provided example scripts demonstrating video playback with manual time-based updates
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| engine/graphics/d3d11/VideoDecoder.cpp | Core video decoder implementation using Media Foundation with hardware acceleration support |
| engine/graphics/d3d11/VideoDecoder.hpp | Video decoder interface with playback control and stream enumeration |
| engine/graphics/d3d11/VideoTexture.cpp | VideoTexture wrapper combining ITexture2D and IVideoDecoder interfaces |
| engine/graphics/d3d11/VideoTexture.hpp | VideoTexture class definition |
| engine/graphics/core/VideoDecoder.hpp | IVideoDecoder interface with VideoOpenOptions configuration |
| engine/graphics/core/Texture2D.hpp | Added isVideoTexture() and getVideoDecoder() to ITexture2D interface |
| engine/graphics/core/GraphicsDevice.hpp | Added createVideoTexture() and createVideoDecoder() methods |
| engine/graphics/d3d11/Texture2D.hpp | Implemented new interface methods for standard textures |
| engine/graphics/d3d11/GraphicsDevice.hpp | Added video creation method declarations |
| engine/graphics/CMakeLists.txt | Linked Media Foundation libraries |
| engine/configuration/core/Configuration.hpp | Added disable_hardware_video_decode configuration option |
| engine/configuration/core/Configuration.cpp | Configuration loading for hardware decode option |
| LuaSTG/LuaSTG/LuaBinding/modern/Video.cpp | Modern OOP-style Lua binding for video control |
| LuaSTG/LuaSTG/LuaBinding/modern/Video.hpp | Video class interface |
| LuaSTG/LuaSTG/LuaBinding/LuaWrapper.cpp | Registered Video class |
| LuaSTG/LuaSTG/LuaBinding/LW_ResourceMgr.cpp | Classic Lua bindings for video loading and control functions |
| LuaSTG/LuaSTG/GameResource/ResourcePool.cpp | Implemented LoadVideo method in ResourcePool |
| LuaSTG/LuaSTG/GameResource/ResourceManager.h | Added LoadVideo declaration |
| LuaSTG/LuaSTG/GameResource/ResourceDebug.cpp | Updated debug view to display video texture information |
| data/example/video_example.lua | Example demonstrating classic API usage |
| data/example/video_example_modern.lua | Example demonstrating modern OOP API usage |
| LuaSTG/CMakeLists.txt | Added Video.cpp/hpp to build |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…esource management
…erance adjustments
… and stream handling
…usting frame size handling
- Add Video.hpp and Video.cpp Lua binding classes for video resource management - Implement video information methods (getWidth, getHeight, getDuration, getCurrentTime, getFPS) - Implement playback control methods (seek, update, setLooping, setLoopRange, getLoopRange) - Add stream enumeration methods (getVideoStreams, getAudioStreams, getSubtitleStreams) - Add stream selection methods (selectVideoStream, selectAudioStream, selectSubtitleStream) - Implement getTexture method to retrieve associated Texture2D object - Register Video class in LuaWrapper for Lua API exposure - Add video_example_modern.lua example demonstrating video loading and playback - Update CMakeLists.txt to include new Video binding source files - Extend Texture2D and VideoTexture interfaces to support video decoder access
- Add null pointer checks for video decoder in Lua resource manager seek, updateToTime, and getLastOpenOptions methods - Extract VideoOpenOptions parsing logic into reusable parseVideoOptions helper function - Replace duplicated video options parsing code in reopen and createFromFile methods with helper function call - Define constants for maximum stream enumeration (kMaxStreams) and post-seek decode frames (kMaxDecodeFramesAfterSeek) - Replace magic number 16 with kMaxStreams constant for stream enumeration loops - Replace magic number 360 with kMaxDecodeFramesAfterSeek constant for frame decode limit - Improves code maintainability by reducing duplication and centralizing configuration constants
6302f8d to
9208c6a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request introduces comprehensive support for video textures in the engine, including their loading, management, and control from both C++ and Lua APIs. It adds new resource management functions for video, exposes detailed video control and information retrieval functions to Lua, and provides example scripts for both classic and modern APIs. Additionally, it adds a configuration option to control hardware video decoding.
Video Texture Support and Resource Management
LoadVideotoResourcePool, allowing video textures to be loaded and managed similarly to images, with support for custom options. [1] [2]Video.hppandVideo.cppto the engine sources and relevant includes throughout the resource and binding code. [1] [2] [3] [4]Lua API Enhancements for Video
lstg.LoadVideo,lstg.VideoSeek,lstg.VideoSetLooping,lstg.VideoSetLoopRange,lstg.VideoUpdate,lstg.VideoGetInfo,lstg.VideoGetVideoStreams,lstg.VideoGetAudioStreams, andlstg.VideoReopen. These allow for fine-grained playback and information control from scripts. [1] [2] [3]Modern API and Object-Oriented Bindings
Videoclass binding for the modern object-oriented Lua API, with methods for creation, property access, and registration. [1] [2]video_example_modern.lua) demonstrating object-oriented video playback and rendering.Debug and UI Improvements
Configuration
disable_hardware_video_decodeto the graphics system, controllable via config file or command-line, to allow disabling hardware video decoding if needed. [1] [2]Examples
video_example.luafor classic API usage andvideo_example_modern.luafor the modern object-oriented API, demonstrating video loading, playback, and control. [1] [2]This pull request introduces video texture support to the engine, enabling videos to be loaded and controlled as textures in the resource system. The changes span the engine’s graphics layer, Lua bindings, and resource management, providing both API and implementation for video playback and control. The most important changes are grouped below.Video Texture and Decoder Implementation
VideoTextureandVideoDecoderclasses to support loading, decoding, and rendering video files as textures. This includes new interfaces (IVideoDecoder) and their Direct3D 11 implementations, as well as integration with the graphics device and resource management systems. ([1], [2], [3], [4])IGraphicsDevice) and its D3D11 implementation to create video textures and decoders, and linked Media Foundation libraries for video support. ([1], [2], [3])Resource Manager and Lua Binding Enhancements
LoadVideomethod to the resource manager, allowing videos to be loaded into the texture pool and accessed like regular textures. ([1], [2])Example and Documentation
video_example.lua) demonstrating video playback, manual update with a stopwatch, and available control functions. This serves as documentation for the new video API. (data/example/video_example.luaR1-R26)These changes collectively enable video playback as textures, with full control and integration into the engine’s resource and scripting systems.