An early and totally not working implementation of PRS writing
Originally committed to SVN as r253.
This commit is contained in:
parent
cf0a685b1f
commit
f39310a1e0
16 changed files with 635 additions and 28 deletions
|
@ -35,31 +35,28 @@
|
||||||
|
|
||||||
#ifndef NO_SPELLCHECKER
|
#ifndef NO_SPELLCHECKER
|
||||||
|
|
||||||
//
|
|
||||||
|
///////////
|
||||||
//Includes
|
//Includes
|
||||||
//
|
|
||||||
#include ".\aspell_wrap.h"
|
#include ".\aspell_wrap.h"
|
||||||
|
|
||||||
|
|
||||||
//
|
//////////////////////
|
||||||
// Aspell Constructor
|
// Aspell Constructor
|
||||||
//
|
AspellWrapper::AspellWrapper(void) {
|
||||||
AspellWrapper::AspellWrapper(void)
|
|
||||||
{
|
|
||||||
loaded = false;
|
loaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// AviSynth destructor
|
/////////////////////
|
||||||
//
|
// Aspell destructor
|
||||||
AspellWrapper::~AspellWrapper(void)
|
AspellWrapper::~AspellWrapper(void) {
|
||||||
{
|
|
||||||
Unload();
|
Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
//////////////////////
|
||||||
// Load Aspell-15.dll
|
// Load Aspell-15.dll
|
||||||
//
|
|
||||||
void AspellWrapper::Load() {
|
void AspellWrapper::Load() {
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
hLib=LoadLibrary(L"aspell-15.dll");
|
hLib=LoadLibrary(L"aspell-15.dll");
|
||||||
|
@ -71,11 +68,8 @@ void AspellWrapper::Load() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
|
||||||
//
|
|
||||||
// Unloads Aspell-15.dll
|
// Unloads Aspell-15.dll
|
||||||
//
|
|
||||||
void AspellWrapper::Unload() {
|
void AspellWrapper::Unload() {
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
//delete_aspell_config();
|
//delete_aspell_config();
|
||||||
|
@ -86,9 +80,8 @@ void AspellWrapper::Unload() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//////////////////
|
||||||
// Declare global
|
// Declare global
|
||||||
//
|
|
||||||
AspellWrapper Aspell;
|
AspellWrapper Aspell;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -41,6 +41,7 @@
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// Static field initialization
|
// Static field initialization
|
||||||
int AviSynthWrapper::avs_refcount = 0;
|
int AviSynthWrapper::avs_refcount = 0;
|
||||||
|
@ -48,6 +49,7 @@ HINSTANCE AviSynthWrapper::hLib = NULL;
|
||||||
IScriptEnvironment *AviSynthWrapper::env = NULL;
|
IScriptEnvironment *AviSynthWrapper::env = NULL;
|
||||||
wxMutex AviSynthWrapper::AviSynthMutex;
|
wxMutex AviSynthWrapper::AviSynthMutex;
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// AviSynth constructor
|
// AviSynth constructor
|
||||||
AviSynthWrapper::AviSynthWrapper() {
|
AviSynthWrapper::AviSynthWrapper() {
|
||||||
|
@ -79,6 +81,7 @@ AviSynthWrapper::AviSynthWrapper() {
|
||||||
avs_refcount++;
|
avs_refcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// AviSynth destructor
|
// AviSynth destructor
|
||||||
AviSynthWrapper::~AviSynthWrapper() {
|
AviSynthWrapper::~AviSynthWrapper() {
|
||||||
|
@ -88,4 +91,11 @@ AviSynthWrapper::~AviSynthWrapper() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////
|
||||||
|
// Get environment
|
||||||
|
IScriptEnvironment *AviSynthWrapper::GetEnv() {
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
static wxMutex AviSynthMutex;
|
static wxMutex AviSynthMutex;
|
||||||
|
|
||||||
|
IScriptEnvironment *GetEnv();
|
||||||
AviSynthWrapper();
|
AviSynthWrapper();
|
||||||
~AviSynthWrapper();
|
~AviSynthWrapper();
|
||||||
};
|
};
|
||||||
|
|
|
@ -177,7 +177,7 @@ END_EVENT_TABLE()
|
||||||
// Process start
|
// Process start
|
||||||
void DialogExport::OnProcess(wxCommandEvent &event) {
|
void DialogExport::OnProcess(wxCommandEvent &event) {
|
||||||
// Get destination
|
// Get destination
|
||||||
wxString filename = wxFileSelector(_("Export subtitles file"),_T(""),_T(""),_T(""),_T("All Supported Types (*.ass,*.ssa,*.srt)|*.ass;*.ssa;*.srt|Advanced Substation Alpha (*.ass)|*.ass|Substation Alpha (*.ssa)|*.ssa|SubRip (*.srt)|*.srt"),wxSAVE | wxOVERWRITE_PROMPT);
|
wxString filename = wxFileSelector(_("Export subtitles file"),_T(""),_T(""),_T(""),_T("All Supported Types (*.ass,*.ssa,*.srt,*.prs)|*.ass;*.ssa;*.srt;*.prs|Advanced Substation Alpha (*.ass)|*.ass|Substation Alpha (*.ssa)|*.ssa|SubRip (*.srt)|*.srt|Pre-Rendered Subtitles (*.prs)|*.prs"),wxSAVE | wxOVERWRITE_PROMPT);
|
||||||
if (filename.empty()) return;
|
if (filename.empty()) return;
|
||||||
|
|
||||||
// Add filters
|
// Add filters
|
||||||
|
|
|
@ -72,10 +72,6 @@ private:
|
||||||
bool blockVideoLoad;
|
bool blockVideoLoad;
|
||||||
|
|
||||||
wxPanel *Panel;
|
wxPanel *Panel;
|
||||||
SubtitlesGrid *SubsBox;
|
|
||||||
SubsEditBox *EditBox;
|
|
||||||
AudioBox *audioBox;
|
|
||||||
VideoBox *videoBox;
|
|
||||||
|
|
||||||
wxMenuBar *MenuBar;
|
wxMenuBar *MenuBar;
|
||||||
wxMenu *fileMenu;
|
wxMenu *fileMenu;
|
||||||
|
@ -222,6 +218,11 @@ private:
|
||||||
void SynchronizeProject(bool FromSubs=false);
|
void SynchronizeProject(bool FromSubs=false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
SubtitlesGrid *SubsBox;
|
||||||
|
SubsEditBox *EditBox;
|
||||||
|
AudioBox *audioBox;
|
||||||
|
VideoBox *videoBox;
|
||||||
|
|
||||||
wxBoxSizer *MainSizer;
|
wxBoxSizer *MainSizer;
|
||||||
wxBoxSizer *TopSizer;
|
wxBoxSizer *TopSizer;
|
||||||
wxBoxSizer *BottomSizer;
|
wxBoxSizer *BottomSizer;
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "subtitle_format_ass.h"
|
#include "subtitle_format_ass.h"
|
||||||
#include "subtitle_format_srt.h"
|
#include "subtitle_format_srt.h"
|
||||||
#include "subtitle_format_txt.h"
|
#include "subtitle_format_txt.h"
|
||||||
|
#include "subtitle_format_prs.h"
|
||||||
#include "ass_file.h"
|
#include "ass_file.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,6 +130,7 @@ void SubtitleFormat::LoadFormats () {
|
||||||
new ASSSubtitleFormat();
|
new ASSSubtitleFormat();
|
||||||
new SRTSubtitleFormat();
|
new SRTSubtitleFormat();
|
||||||
new TXTSubtitleFormat();
|
new TXTSubtitleFormat();
|
||||||
|
new PRSSubtitleFormat();
|
||||||
}
|
}
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
139
core/subtitle_format_prs.cpp
Normal file
139
core/subtitle_format_prs.cpp
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
// Copyright (c) 2006, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Headers
|
||||||
|
#include "subtitle_format_prs.h"
|
||||||
|
#include "ass_file.h"
|
||||||
|
#include "ass_dialogue.h"
|
||||||
|
#include "avisynth_wrap.h"
|
||||||
|
#include "video_box.h"
|
||||||
|
#include "video_display.h"
|
||||||
|
#include "video_provider.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "frame_main.h"
|
||||||
|
#include "vfr.h"
|
||||||
|
#include "../prs/prs_file.h"
|
||||||
|
#include "../prs/prs_image.h"
|
||||||
|
#include "../prs/prs_display.h"
|
||||||
|
#include "../prs/prs_vsfilter_reader.h"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////
|
||||||
|
// Can write to file?
|
||||||
|
bool PRSSubtitleFormat::CanWriteFile(wxString filename) {
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
return (filename.Right(4).Lower() == _T(".prs"));
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// Write file
|
||||||
|
void PRSSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
// Video loaded?
|
||||||
|
VideoDisplay *display = ((AegisubApp*)wxTheApp)->frame->videoBox->videoDisplay;
|
||||||
|
|
||||||
|
// Create file
|
||||||
|
PRSFile file;
|
||||||
|
|
||||||
|
// Open two Avisynth environments
|
||||||
|
AviSynthWrapper avs1,avs2;
|
||||||
|
IScriptEnvironment *env1 = avs1.GetEnv();
|
||||||
|
IScriptEnvironment *env2 = avs2.GetEnv();
|
||||||
|
|
||||||
|
// Prepare environments
|
||||||
|
wxString val = wxString::Format(_T("BlankClip(pixel_type=\"RGB32\",length=%i,width=%i,height=%i,fps=%f"),display->provider->GetFrameCount(),display->provider->GetWidth(),display->provider->GetHeight(),display->provider->GetFPS());
|
||||||
|
AVSValue script1 = env1->Invoke("Eval",AVSValue(wxString(val + _T(",color=$000000)")).mb_str(wxConvUTF8)));
|
||||||
|
AVSValue script2 = env2->Invoke("Eval",AVSValue(wxString(val + _T(",color=$FFFFFF)")).mb_str(wxConvUTF8)));
|
||||||
|
char temp[512];
|
||||||
|
strcpy(temp,display->GetTempWorkFile().mb_str(wxConvLocal));
|
||||||
|
AVSValue args1[2] = { script1.AsClip(), temp };
|
||||||
|
AVSValue args2[2] = { script2.AsClip(), temp };
|
||||||
|
try {
|
||||||
|
script1 = env1->Invoke("TextSub", AVSValue(args1,2));
|
||||||
|
script2 = env2->Invoke("TextSub", AVSValue(args2,2));
|
||||||
|
}
|
||||||
|
catch (AvisynthError &err) {
|
||||||
|
throw _T("AviSynth error: ") + wxString(err.msg,wxConvLocal);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through subtitles in file
|
||||||
|
AssFile *ass = AssFile::top;
|
||||||
|
AssDialogue *diag = NULL;
|
||||||
|
PClip clip1 = script1.AsClip();
|
||||||
|
PClip clip2 = script1.AsClip();
|
||||||
|
int id = 0;
|
||||||
|
for (entryIter cur=ass->Line.begin();cur!=ass->Line.end();cur++) {
|
||||||
|
diag = AssEntry::GetAsDialogue(*cur);
|
||||||
|
|
||||||
|
// Dialogue found
|
||||||
|
if (diag) {
|
||||||
|
// Read its image
|
||||||
|
int framen = VFR_Output.GetFrameAtTime(diag->Start.GetMS(),true);
|
||||||
|
PVideoFrame frame1 = clip1->GetFrame(framen,env1);
|
||||||
|
PVideoFrame frame2 = clip2->GetFrame(framen,env2);
|
||||||
|
|
||||||
|
// Create PRSImage
|
||||||
|
PRSImage *img = new PRSImage;
|
||||||
|
img->id = id;
|
||||||
|
img->dataLen = 0;
|
||||||
|
img->data = NULL;
|
||||||
|
|
||||||
|
// Create PRSDisplay
|
||||||
|
PRSDisplay *display = new PRSDisplay;
|
||||||
|
display->start = diag->Start.GetMS();
|
||||||
|
display->end = diag->End.GetMS();
|
||||||
|
display->id = id;
|
||||||
|
display->x = 0;
|
||||||
|
display->y = 0;
|
||||||
|
display->alpha = 255;
|
||||||
|
display->blend = 0;
|
||||||
|
|
||||||
|
// Insert into list
|
||||||
|
file.AddEntry(img);
|
||||||
|
file.AddEntry(display);
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save file
|
||||||
|
file.Save(filename.mb_str(wxConvLocal));
|
||||||
|
#endif
|
||||||
|
}
|
51
core/subtitle_format_prs.h
Normal file
51
core/subtitle_format_prs.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
// Copyright (c) 2006, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Headers
|
||||||
|
#include "subtitle_format.h"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// PRS writer
|
||||||
|
class PRSSubtitleFormat : public SubtitleFormat {
|
||||||
|
public:
|
||||||
|
bool CanWriteFile(wxString filename);
|
||||||
|
void WriteFile(wxString filename,wxString encoding);
|
||||||
|
};
|
|
@ -213,7 +213,6 @@ PClip AvisynthVideoProvider::ApplyDARZoom(double _zoom, double _dar, PClip video
|
||||||
|
|
||||||
wxBitmap AvisynthVideoProvider::GetFrame(int n, bool force) {
|
wxBitmap AvisynthVideoProvider::GetFrame(int n, bool force) {
|
||||||
if (n != last_fnum || force) {
|
if (n != last_fnum || force) {
|
||||||
|
|
||||||
wxMutexLocker lock(AviSynthMutex);
|
wxMutexLocker lock(AviSynthMutex);
|
||||||
|
|
||||||
PVideoFrame frame = ResizedVideo->GetFrame(n,env);
|
PVideoFrame frame = ResizedVideo->GetFrame(n,env);
|
||||||
|
@ -241,9 +240,13 @@ wxBitmap AvisynthVideoProvider::GetFrame(int n, bool force) {
|
||||||
src+=srcpitch;
|
src+=srcpitch;
|
||||||
dst-=rs;
|
dst-=rs;
|
||||||
}
|
}
|
||||||
} else if (depth == 24) {
|
}
|
||||||
|
|
||||||
|
else if (depth == 24) {
|
||||||
//fail
|
//fail
|
||||||
} else if (depth == 16) {
|
}
|
||||||
|
|
||||||
|
else if (depth == 16) {
|
||||||
const unsigned char *read_ptr = frame->GetReadPtr();
|
const unsigned char *read_ptr = frame->GetReadPtr();
|
||||||
unsigned short *write_ptr = (unsigned short*) dst;
|
unsigned short *write_ptr = (unsigned short*) dst;
|
||||||
unsigned char r,g,b;
|
unsigned char r,g,b;
|
||||||
|
@ -262,7 +265,9 @@ wxBitmap AvisynthVideoProvider::GetFrame(int n, bool force) {
|
||||||
write_ptr -= vi.width;
|
write_ptr -= vi.width;
|
||||||
read_ptr += srcpitch;
|
read_ptr += srcpitch;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
//fail
|
//fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
67
prs/prs_display.h
Normal file
67
prs/prs_display.h
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
// Copyright (c) 2005, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
///////////////
|
||||||
|
// Blend modes
|
||||||
|
enum PRSBlendMode {
|
||||||
|
NORMAL = 0,
|
||||||
|
ADD,
|
||||||
|
SUBTRACT,
|
||||||
|
INVERSE_SUBTRACT,
|
||||||
|
MULTIPLY
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Headers
|
||||||
|
#include "prs_entry.h"
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////
|
||||||
|
// Display class
|
||||||
|
class PRSDisplay : public PRSEntry {
|
||||||
|
public:
|
||||||
|
int start; // First time to show this on (INCLUSIVE) (possible first frame?)
|
||||||
|
int end; // Last time to show this on (EXCLUSIVE) (possible last frame?)
|
||||||
|
int id; // ID of picture to be shown
|
||||||
|
int layer; // Number of layer to draw this on
|
||||||
|
short x,y; // X and Y coordinates to draw picture on
|
||||||
|
unsigned char alpha; // Alpha blend of picture
|
||||||
|
unsigned char blend; // Blend mode to use
|
||||||
|
};
|
55
prs/prs_entry.h
Normal file
55
prs/prs_entry.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
// Copyright (c) 2005, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// Prototypes
|
||||||
|
class PRSDisplay;
|
||||||
|
class PRSImage;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////
|
||||||
|
// PRS Entry base class
|
||||||
|
class PRSEntry {
|
||||||
|
public:
|
||||||
|
PRSEntry() {}
|
||||||
|
~PRSEntry() {}
|
||||||
|
|
||||||
|
static PRSImage* GetImage(PRSEntry* entry);
|
||||||
|
static PRSDisplay* GetDisplay(PRSDisplay* entry);
|
||||||
|
};
|
70
prs/prs_file.cpp
Normal file
70
prs/prs_file.cpp
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
// Copyright (c) 2005, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Headers
|
||||||
|
#include "prs_file.h"
|
||||||
|
|
||||||
|
|
||||||
|
///////////////
|
||||||
|
// Constructor
|
||||||
|
PRSFile::PRSFile () {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// Destructor
|
||||||
|
PRSFile::~PRSFile() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////
|
||||||
|
// Save
|
||||||
|
void PRSFile::Save(const char *path) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////
|
||||||
|
// Load
|
||||||
|
void PRSFile::Load(const char *path, bool reset) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////
|
||||||
|
// Add entry
|
||||||
|
void PRSFile::AddEntry(PRSEntry *entry) {
|
||||||
|
entryList.push_back(entry);
|
||||||
|
}
|
65
prs/prs_file.h
Normal file
65
prs/prs_file.h
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
// Copyright (c) 2005, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// Prototypes
|
||||||
|
class PRSEntry;
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Headers
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////
|
||||||
|
// Pre-Rendered Subtitles file
|
||||||
|
class PRSFile {
|
||||||
|
private:
|
||||||
|
std::list<PRSEntry*> entryList;
|
||||||
|
void Reset();
|
||||||
|
|
||||||
|
public:
|
||||||
|
PRSFile();
|
||||||
|
~PRSFile();
|
||||||
|
|
||||||
|
void AddEntry(PRSEntry *entry);
|
||||||
|
|
||||||
|
void Save(const char *path);
|
||||||
|
void Load(const char *path,bool reset=true);
|
||||||
|
};
|
52
prs/prs_image.h
Normal file
52
prs/prs_image.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
// Copyright (c) 2005, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Headers
|
||||||
|
#include "prs_entry.h"
|
||||||
|
|
||||||
|
|
||||||
|
///////////////
|
||||||
|
// Image class
|
||||||
|
class PRSImage : public PRSEntry {
|
||||||
|
public:
|
||||||
|
int id;
|
||||||
|
int dataLen;
|
||||||
|
void *data;
|
||||||
|
};
|
46
prs/prs_vsfilter_reader.cpp
Normal file
46
prs/prs_vsfilter_reader.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright (c) 2005, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
///////////
|
||||||
|
// Headers
|
||||||
|
#include "prs_vsfilter_reader.h"
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////
|
||||||
|
// Adds content of an ASSFile to a PRSFile
|
||||||
|
void PRSVSFilterReader::ConvertFile(AssFile *subs,PRSFile *prs) {
|
||||||
|
// Open two AviSynth clips
|
||||||
|
}
|
50
prs/prs_vsfilter_reader.h
Normal file
50
prs/prs_vsfilter_reader.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright (c) 2005, 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:zeratul@cellosoft.com
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
//////////////
|
||||||
|
// Prototypes
|
||||||
|
class PRSFile;
|
||||||
|
class AssFile;
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
// VSFilter reader class
|
||||||
|
class PRSVSFilterReader {
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
void ConvertFile(AssFile *subs,PRSFile *prs);
|
||||||
|
};
|
Loading…
Reference in a new issue