| 206 | } |
| 207 | |
| 208 | void VideoHandler::DeInitialize() |
| 209 | { |
| 210 | TENLog("Shutting down VLC...", LogLevel::Info); |
| 211 | |
| 212 | // This flag is needed to avoid race conditions with update callbacks. |
| 213 | _deInitializing = true; |
| 214 | |
| 215 | if (_player != nullptr) |
| 216 | { |
| 217 | if (libvlc_media_player_is_playing(_player)) |
| 218 | libvlc_media_player_stop_async(_player); |
| 219 | |
| 220 | while (libvlc_media_player_is_playing(_player)) |
| 221 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); |
| 222 | |
| 223 | libvlc_media_player_release(_player); |
| 224 | |
| 225 | _player = nullptr; |
| 226 | } |
| 227 | |
| 228 | if (_vlcInstance) |
| 229 | libvlc_release(_vlcInstance); |
| 230 | |
| 231 | _vlcInstance = nullptr; |
| 232 | } |
| 233 | |
| 234 | bool VideoHandler::Play(const std::string& filename, VideoPlaybackMode mode, bool silent, bool loop) |
| 235 | { |
no test coverage detected