| 283 | } |
| 284 | |
| 285 | bool Project::DoLoadVideo(agi::fs::path const& path) { |
| 286 | if (!progress) |
| 287 | progress = new DialogProgress(context->parent); |
| 288 | |
| 289 | try { |
| 290 | auto old_matrix = context->ass->GetScriptInfo("YCbCr Matrix"); |
| 291 | video_provider = std::make_unique<AsyncVideoProvider>(path, old_matrix, context->videoController.get(), progress); |
| 292 | } |
| 293 | catch (agi::UserCancelException const&) { return false; } |
| 294 | catch (agi::fs::FileSystemError const& err) { |
| 295 | config::mru->Remove("Video", path); |
| 296 | ShowError(to_wx(err.GetMessage())); |
| 297 | return false; |
| 298 | } |
| 299 | catch (VideoProviderError const& err) { |
| 300 | ShowError(to_wx(err.GetMessage())); |
| 301 | return false; |
| 302 | } |
| 303 | |
| 304 | AnnounceVideoProviderModified(video_provider.get()); |
| 305 | |
| 306 | UpdateVideoProperties(context->ass.get(), video_provider.get(), context->parent); |
| 307 | video_provider->LoadSubtitles(context->ass.get()); |
| 308 | |
| 309 | timecodes = video_provider->GetFPS(); |
| 310 | keyframes = video_provider->GetKeyFrames(); |
| 311 | |
| 312 | timecodes_file.clear(); |
| 313 | keyframes_file.clear(); |
| 314 | SetPath(video_file, "?video", "Video", path); |
| 315 | |
| 316 | std::string warning = video_provider->GetWarning(); |
| 317 | if (!warning.empty()) |
| 318 | wxMessageBox(to_wx(warning), "Warning", wxICON_WARNING | wxOK); |
| 319 | |
| 320 | video_has_subtitles = false; |
| 321 | if (agi::fs::HasExtension(path, "mkv")) |
| 322 | video_has_subtitles = MatroskaWrapper::HasSubtitles(path); |
| 323 | |
| 324 | AnnounceKeyframesModified(keyframes); |
| 325 | AnnounceTimecodesModified(timecodes); |
| 326 | return true; |
| 327 | } |
| 328 | |
| 329 | void Project::LoadVideo(agi::fs::path path) { |
| 330 | if (path.empty()) return; |
nothing calls this directly
no test coverage detected