Slightly improved (and apparently broken?) PRS encoding

Originally committed to SVN as r263.
This commit is contained in:
Rodrigo Braz Monteiro 2006-03-31 02:06:50 +00:00
parent 7b7b17d42b
commit 2ffcf9d1cc
2 changed files with 63 additions and 32 deletions

View File

@ -101,14 +101,45 @@ void PRSSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
AssDialogue *diag = NULL;
PClip clip1 = script1.AsClip();
PClip clip2 = script2.AsClip();
wxArrayInt frames;
int id = 0;
for (entryIter cur=ass->Line.begin();cur!=ass->Line.end();cur++) {
diag = AssEntry::GetAsDialogue(*cur);
// Dialogue found
if (diag) {
// Parse tags
diag->ParseASSTags();
// Check if there is any animation tag
bool hasAnimation = false;
int blocks = diag->Blocks.size();
AssDialogueBlockOverride *block;
for (int i=0;i<blocks;i++) {
block = AssDialogueBlock::GetAsOverride(diag->Blocks[i]);
if (block) {
hasAnimation = true;
}
}
// If it has animation, include all frames, otherwise, just the first
if (hasAnimation) {
int start = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
int end = VFR_Output.GetFrameAtTime(diag->End.GetMS(),false);
for (int i=start;i<=end;i++) frames.Add(i);
}
else frames.Add(VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true));
// Clean up
diag->ClearBlocks();
}
}
// Render all frames that were detected to contain subtitles
int totalFrames = frames.Count();
for (int i=0;i<totalFrames;i++) {
// Read its image
int framen = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
int framen = frames[i];
PVideoFrame frame1 = clip1->GetFrame(framen,env1);
PVideoFrame frame2 = clip2->GetFrame(framen,env2);
@ -143,7 +174,6 @@ void PRSSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
file.AddEntry(display);
id++;
}
}
// Save file
file.Save((const char*)filename.mb_str(wxConvLocal));

View File

@ -56,6 +56,7 @@ TipOfTheDay::TipOfTheDay (size_t currentTip): wxTipProvider(currentTip) {
tips.push_back(_("The fonts collector is one of the most useful features, which resumes the boring task of hunting down fonts into a matter of a few clicks."));
tips.push_back(_("When you are done with your subtitles and ready to distribute them, remember: say no to MP4, OGM or AVI. Matroska is your friend."));
tips.push_back(_("Much like anything loaded via DirectShow, certain files may have a strange structure (such as h.264 into AVI or XviD will null frames) which may cause unreliable seeking (that is, video frames might be off by one frame). This is not an Aegisub bug - you may consider reencoding those videos before working with them."));
tips.push_back(_("If anything goes wrong, blame movax."));
//tips.push_back(_(""));
}