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

@ -1,76 +1,76 @@
// Copyright (c) 2008, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// -----------------------------------------------------------------------------
//
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "athenastring.h"
#include "tr1.h"
#include "format.h"
namespace Athenasub {
// Prototypes
class Model;
class ActionList;
typedef shared_ptr<ActionList> ActionListPtr;
// Controller class
class Controller {
private:
Model &model;
public:
Controller (Model &model);
ActionListPtr CreateActionList(const String title,const String owner=L"",bool undoAble=true);
void LoadFile(const String filename,const String encoding=L"");
void SaveFile(const String filename,const String encoding=L"UTF-8");
bool CanUndo(const String owner=L"") const;
bool CanRedo(const String owner=L"") const;
void Undo(const String owner=L"");
void Redo(const String owner=L"");
DialoguePtr CreateDialogue() const;
StylePtr CreateStyle() const;
DialogueConstPtr GetDialogue(size_t n) const;
DialogueConstPtr GetStyle(size_t n) const;
StyleConstPtr GetStyle(String name) const;
EntryConstPtr GetEntry(size_t n,String section) const;
const FormatPtr GetFormat() const;
};
}
// Copyright (c) 2008, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// -----------------------------------------------------------------------------
//
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "athenastring.h"
#include "tr1.h"
#include "format.h"
namespace Athenasub {
// Prototypes
class Model;
class ActionList;
typedef shared_ptr<ActionList> ActionListPtr;
// Controller class
class Controller {
private:
Model &model;
public:
Controller (Model &model);
ActionListPtr CreateActionList(const String title,const String owner=L"",bool undoAble=true);
void LoadFile(const String filename,const String encoding=L"");
void SaveFile(const String filename,const String encoding=L"UTF-8");
bool CanUndo(const String owner=L"") const;
bool CanRedo(const String owner=L"") const;
void Undo(const String owner=L"");
void Redo(const String owner=L"");
DialoguePtr CreateDialogue() const;
StylePtr CreateStyle() const;
DialogueConstPtr GetDialogue(size_t n) const;
DialogueConstPtr GetStyle(size_t n) const;
StyleConstPtr GetStyle(String name) const;
EntryConstPtr GetEntry(size_t n,String section) const;
const FormatPtr GetFormat() const;
};
}

View File

@ -238,19 +238,26 @@ 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) {
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;
ms = tt % 1000; tt /= 1000;
s = tt % 60; tt /= 60;
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();
} else {
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;
ms = tt % 1000; tt /= 1000;
s = tt % 60; tt /= 60;
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"));
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