| 18 | static const std::vector<std::string> VIDEO_EXTENSIONS = { ".mp4", ".avi", ".mkv", ".mov" }; |
| 19 | |
| 20 | int VideoHandler::GetPosition() const |
| 21 | { |
| 22 | if (_player == nullptr) |
| 23 | return 0; |
| 24 | |
| 25 | auto* media = libvlc_media_player_get_media(_player); |
| 26 | long long duration = libvlc_media_get_duration(media); |
| 27 | float posNormalized = GetNormalizedPosition(); |
| 28 | |
| 29 | // Convert and return position in frames. |
| 30 | long long posMsec = posNormalized * duration; |
| 31 | return (int)((posMsec / 1000.0f) * FPS); |
| 32 | } |
| 33 | |
| 34 | float VideoHandler::GetNormalizedPosition() const |
| 35 | { |
no outgoing calls
no test coverage detected