Only set video zoom when loading associated video if it's actually present in the file

Originally committed to SVN as r5772.
This commit is contained in:
Thomas Goyne 2011-10-24 20:18:25 +00:00
parent 10464e4617
commit 3a218c9dd4

View file

@ -645,13 +645,10 @@ void FrameMain::OnSubtitlesOpen() {
if (!blockVideoLoad && curSubsVideo != context->videoController->videoName) { if (!blockVideoLoad && curSubsVideo != context->videoController->videoName) {
context->videoController->SetVideo(curSubsVideo); context->videoController->SetVideo(curSubsVideo);
if (context->videoController->IsLoaded()) { if (context->videoController->IsLoaded()) {
long videoPos = 0; context->videoController->JumpToFrame(context->ass->GetScriptInfoAsInt("Video Position"));
long videoAr = 0;
double videoArValue = 0.0;
double videoZoom = 0.;
context->ass->GetScriptInfo("Video Position").ToLong(&videoPos); long videoAr = 0;
context->ass->GetScriptInfo("Video Zoom Percent").ToDouble(&videoZoom); double videoArValue = 0.;
wxString arString = context->ass->GetScriptInfo("Video Aspect Ratio"); wxString arString = context->ass->GetScriptInfo("Video Aspect Ratio");
if (arString.Left(1) == "c") { if (arString.Left(1) == "c") {
videoAr = 4; videoAr = 4;
@ -661,10 +658,11 @@ void FrameMain::OnSubtitlesOpen() {
else if (arString.IsNumber()) { else if (arString.IsNumber()) {
arString.ToLong(&videoAr); arString.ToLong(&videoAr);
} }
context->videoController->SetAspectRatio(videoAr,videoArValue); context->videoController->SetAspectRatio(videoAr,videoArValue);
double videoZoom = 0.;
if (context->ass->GetScriptInfo("Video Zoom Percent").ToDouble(&videoZoom))
videoBox->videoDisplay->SetZoom(videoZoom); videoBox->videoDisplay->SetZoom(videoZoom);
context->videoController->JumpToFrame(videoPos);
} }
} }