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

View File

@ -238,19 +238,26 @@ void DialogDummyVideo::OnLengthChange(wxCommandEvent &evt)
void DialogDummyVideo::UpdateLengthDisplay() void DialogDummyVideo::UpdateLengthDisplay()
{ {
double fpsval; double fpsval;
int lengthval = length->GetValue(); int lengthval = 0;
if (!length_display) return; if (!length_display) return;
if ((fps->GetValue().ToDouble(&fpsval)) && fpsval > 0 && lengthval > 0) { bool valid = false;
int tt = int(lengthval / fpsval * 1000); // frames / (frames/seconds) * 1000 = milliseconds if (fps->GetValue().ToDouble(&fpsval)) {
// 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 lengthval = length->GetValue();
int ms, s, m, h; if (lengthval && fpsval > 0 && lengthval > 0) {
ms = tt % 1000; tt /= 1000; valid = true;
s = tt % 60; tt /= 60; int tt = int(lengthval / fpsval * 1000); // frames / (frames/seconds) * 1000 = milliseconds
m = tt % 60; tt /= 60; // 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
h = tt; int ms, s, m, h;
length_display->SetLabel(wxString::Format(_("Resulting duration: %d:%02d:%02d.%03d"), h, m, s, ms)); ms = tt % 1000; tt /= 1000;
ok_button->Enable(); s = tt % 60; tt /= 60;
} else { m = tt % 60; tt /= 60;
h = tt;
length_display->SetLabel(wxString::Format(_("Resulting duration: %d:%02d:%02d.%03d"), h, m, s, ms));
ok_button->Enable();
}
}
if (!valid) {
length_display->SetLabel(_("Invalid fps or length value")); length_display->SetLabel(_("Invalid fps or length value"));
ok_button->Disable(); ok_button->Disable();
} }

View File

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