Fix restoring video position from saved project info

This commit is contained in:
Thomas Goyne 2014-05-23 12:36:28 -07:00
parent d004fc1856
commit 99b46f6a14
2 changed files with 11 additions and 16 deletions

View File

@ -300,6 +300,13 @@ void Project::LoadVideo(agi::fs::path const& path) {
if (!DoLoadVideo(path)) return;
if (OPT_GET("Video/Open Audio")->GetBool() && audio_file != video_file && video_provider->HasAudio())
DoLoadAudio(video_file, true);
double dar = video_provider->GetDAR();
if (dar > 0)
context->videoController->SetAspectRatio(dar);
else
context->videoController->SetAspectRatio(AspectRatio::Default);
context->videoController->JumpToFrame(0);
}
void Project::CloseVideo() {
@ -307,6 +314,9 @@ void Project::CloseVideo() {
video_provider.reset();
SetPath(video_file, "?video", "", "");
video_has_subtitles = false;
context->ass->Properties.ar_mode = 0;
context->ass->Properties.ar_value = 0.0;
context->ass->Properties.video_position = 0;
}
void Project::DoLoadTimecodes(agi::fs::path const& path) {

View File

@ -60,23 +60,8 @@ VideoController::VideoController(agi::Context *c)
void VideoController::OnNewVideoProvider(AsyncVideoProvider *new_provider) {
Stop();
frame_n = 0;
provider = new_provider;
if (!provider) {
color_matrix.clear();
context->ass->Properties.ar_mode = 0;
context->ass->Properties.ar_value = 0.0;
context->ass->Properties.video_position = 0;
return;
}
color_matrix = provider->GetColorSpace();
double dar = provider->GetDAR();
if (dar > 0)
SetAspectRatio(dar);
JumpToFrame(0);
color_matrix = provider ? provider->GetColorSpace() : "";
}
void VideoController::OnSubtitlesCommit(int type, std::set<const AssDialogue *> const& changed) {