MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / DoLoadVideo

Method DoLoadVideo

src/project.cpp:285–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285bool 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
329void Project::LoadVideo(agi::fs::path path) {
330 if (path.empty()) return;

Callers

nothing calls this directly

Calls 11

UpdateVideoPropertiesFunction · 0.85
HasExtensionFunction · 0.85
GetScriptInfoMethod · 0.80
to_wxFunction · 0.70
getMethod · 0.45
RemoveMethod · 0.45
LoadSubtitlesMethod · 0.45
GetFPSMethod · 0.45
GetKeyFramesMethod · 0.45
clearMethod · 0.45
GetWarningMethod · 0.45

Tested by

no test coverage detected