| 165 | } |
| 166 | |
| 167 | void VideoHandler::Initialize(const std::string& gameDir, ID3D11Device* device, ID3D11DeviceContext* context) |
| 168 | { |
| 169 | TENLog("Initializing video player...", LogLevel::Info); |
| 170 | |
| 171 | auto pluginCachePath = GetBinaryPath(false) + VIDEO_PLUGIN_CACHE_PATH; |
| 172 | |
| 173 | std::vector<const char*> vlcArgs; |
| 174 | vlcArgs.push_back("--vout=none"); // Disable video output and title because rendering is done to a D3D texture. |
| 175 | vlcArgs.push_back("--aout=adummy"); // Disable audio output because audio is routed to BASS. |
| 176 | vlcArgs.push_back("--no-video-title"); // Disable video title display. |
| 177 | vlcArgs.push_back("--no-media-library"); // Disable media library to increase loading speed. |
| 178 | |
| 179 | #if !_DEBUG |
| 180 | vlcArgs.push_back("--quiet"); // Don't generate excessive VLC warnings in the console. |
| 181 | #endif |
| 182 | |
| 183 | if (!std::filesystem::is_regular_file(pluginCachePath)) |
| 184 | { |
| 185 | TENLog("Rebuilding video plugin cache", LogLevel::Info); |
| 186 | vlcArgs.push_back("--reset-plugins-cache"); |
| 187 | } |
| 188 | |
| 189 | _vlcInstance = libvlc_new(static_cast<int>(vlcArgs.size()), vlcArgs.data()); |
| 190 | |
| 191 | #if _DEBUG |
| 192 | //libvlc_log_set(_vlcInstance, OnLog, nullptr); |
| 193 | #endif |
| 194 | |
| 195 | HandleError(); |
| 196 | |
| 197 | _d3dDevice = device; |
| 198 | _d3dContext = context; |
| 199 | |
| 200 | _videoDirectory = gameDir + VIDEO_PATH; |
| 201 | _size = Vector2i::Zero; |
| 202 | _fileName = {}; |
| 203 | _playbackMode = VideoPlaybackMode::Exclusive; |
| 204 | _looped = false; |
| 205 | _silent = false; |
| 206 | } |
| 207 | |
| 208 | void VideoHandler::DeInitialize() |
| 209 | { |
nothing calls this directly
no test coverage detected