Fixed dummy video provider and possibly fixed dvd sub generation.

Originally committed to SVN as r2079.
This commit is contained in:
Rodrigo Braz Monteiro 2008-03-18 05:24:21 +00:00
parent a7b73fc2da
commit b102ed05c1
4 changed files with 112 additions and 93 deletions

View File

@ -19,7 +19,7 @@
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
@ -40,6 +40,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="include/aegilib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
@ -65,11 +66,14 @@
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
@ -79,6 +83,12 @@
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
@ -108,6 +118,8 @@
/>
<Tool
Name="VCCLCompilerTool"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="include/aegilib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WINDOWS"
RuntimeLibrary="2"

View File

@ -238,9 +238,13 @@ void DialogDummyVideo::OnLengthChange(wxCommandEvent &evt)
void DialogDummyVideo::UpdateLengthDisplay()
{
double fpsval;
int lengthval = length->GetValue();
int lengthval = 0;
if (!length_display) return;
if ((fps->GetValue().ToDouble(&fpsval)) && fpsval > 0 && lengthval > 0) {
bool valid = false;
if (fps->GetValue().ToDouble(&fpsval)) {
lengthval = length->GetValue();
if (lengthval && fpsval > 0 && lengthval > 0) {
valid = true;
int tt = int(lengthval / fpsval * 1000); // frames / (frames/seconds) * 1000 = milliseconds
// 32 bit signed int can hold almost 600 positive hours when counting milliseconds, ASS allows at most just below 10 hours, so we're safe
int ms, s, m, h;
@ -250,7 +254,10 @@ void DialogDummyVideo::UpdateLengthDisplay()
h = tt;
length_display->SetLabel(wxString::Format(_("Resulting duration: %d:%02d:%02d.%03d"), h, m, s, ms));
ok_button->Enable();
} else {
}
}
if (!valid) {
length_display->SetLabel(_("Invalid fps or length value"));
ok_button->Disable();
}

View File

@ -363,8 +363,8 @@ void DVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
unsigned char delay_b2 = delay & 0xFF;
int sx = pics[i].x;
int sy = pics[i].y;
int ex = pics[i].w + sx;
int ey = pics[i].h + sy;
int ex = pics[i].w + sx - 1;
int ey = pics[i].h + sy - 1;
unsigned char dispx_b1 = (sx & 0xFF0) >> 4;
unsigned char dispx_b2 = ((sx & 0x0F) << 4) | ((ex & 0xF00) >> 8);
unsigned char dispx_b3 = (ex & 0xFF);
@ -376,11 +376,11 @@ void DVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
unsigned char control[] = {
0x00, 0x00, // Delay
comm2_b1, comm2_b2, // Next command
0x01, // Start display
0x03, 0x01, 0x23, // Set colours
0x04, 0x0F, 0xFF, // Alpha blend
0x05, dispx_b1, dispx_b2, dispx_b3, dispy_b1, dispy_b2, dispy_b3, // Display area
0x06, pix0_b1, pix0_b2, pix1_b1, pix1_b2, // Pixel pointers
0x01, // Start display
0xFF, // End block 1
delay_b1, delay_b2, // Delay
comm2_b1, comm2_b2, // This command