mirror of https://github.com/odrling/Aegisub
Kill VideoContext::Get()
This commit is contained in:
parent
aa46c49403
commit
c4c0f6f125
|
@ -41,6 +41,7 @@
|
|||
#include "compat.h"
|
||||
#include "include/aegisub/context.h"
|
||||
#include "subtitle_format.h"
|
||||
#include "video_context.h"
|
||||
|
||||
#include <memory>
|
||||
#include <wx/sizer.h>
|
||||
|
@ -93,7 +94,7 @@ void AssExporter::Export(agi::fs::path const& filename, std::string const& chars
|
|||
if (!writer)
|
||||
throw "Unknown file type.";
|
||||
|
||||
writer->WriteFile(&subs, filename, charset);
|
||||
writer->WriteFile(&subs, filename, c->videoController->FPS(), charset);
|
||||
}
|
||||
|
||||
wxSizer *AssExporter::GetSettingsSizer(std::string const& name) {
|
||||
|
|
|
@ -589,7 +589,7 @@ void DialogStyleManager::OnCurrentImport() {
|
|||
if (!reader)
|
||||
wxMessageBox("Unsupported subtitle format", "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
else
|
||||
reader->ReadFile(&temp, filename, charset);
|
||||
reader->ReadFile(&temp, filename, 0, charset);
|
||||
}
|
||||
catch (agi::Exception const& err) {
|
||||
wxMessageBox(to_wx(err.GetChainedMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
|
||||
|
|
|
@ -206,7 +206,6 @@ bool AegisubApp::OnInit() {
|
|||
agi::util::SetThreadName("AegiMain");
|
||||
|
||||
StartupLog("Inside OnInit");
|
||||
frame = nullptr;
|
||||
try {
|
||||
// Initialize randomizer
|
||||
StartupLog("Initialize random generator");
|
||||
|
|
|
@ -67,11 +67,11 @@ class AegisubApp : public wxApp {
|
|||
// our ticket to catch exceptions happening in event handlers.
|
||||
void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const override;
|
||||
|
||||
FrameMain *frame;
|
||||
FrameMain *frame = nullptr;
|
||||
public:
|
||||
AegisubApp();
|
||||
AegisubLocale locale;
|
||||
Automation4::AutoloadScriptManager *global_scripts;
|
||||
Automation4::AutoloadScriptManager *global_scripts = nullptr;
|
||||
|
||||
// Apple events
|
||||
void MacOpenFile(const wxString &filename);
|
||||
|
|
|
@ -186,7 +186,7 @@ void SubsController::Load(agi::fs::path const& filename, std::string charset) {
|
|||
const SubtitleFormat *reader = SubtitleFormat::GetReader(filename, charset);
|
||||
|
||||
AssFile temp;
|
||||
reader->ReadFile(&temp, filename, charset);
|
||||
reader->ReadFile(&temp, filename, context->videoController->FPS(), charset);
|
||||
|
||||
// Make sure the file has at least one style and one dialogue line
|
||||
if (temp.Styles.empty())
|
||||
|
@ -256,7 +256,7 @@ void SubsController::Save(agi::fs::path const& filename, std::string const& enco
|
|||
|
||||
FileSave();
|
||||
|
||||
writer->WriteFile(context->ass.get(), filename, encoding);
|
||||
writer->WriteFile(context->ass.get(), filename, 0, encoding);
|
||||
}
|
||||
catch (...) {
|
||||
autosaved_commit_id = old_autosaved_commit_id;
|
||||
|
@ -311,7 +311,7 @@ agi::fs::path SubsController::AutoSave() {
|
|||
|
||||
path /= str(boost::format("%s.%s.AUTOSAVE.ass") % name.string() % agi::util::strftime("%Y-%m-%d-%H-%M-%S"));
|
||||
|
||||
SubtitleFormat::GetWriter(path)->WriteFile(context->ass.get(), path);
|
||||
SubtitleFormat::GetWriter(path)->WriteFile(context->ass.get(), path, 0);
|
||||
autosaved_commit_id = commit_id;
|
||||
|
||||
return path;
|
||||
|
|
|
@ -106,15 +106,14 @@ bool SubtitleFormat::CanSave(const AssFile *subs) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
agi::vfr::Framerate SubtitleFormat::AskForFPS(bool allow_vfr, bool show_smpte) {
|
||||
agi::vfr::Framerate SubtitleFormat::AskForFPS(bool allow_vfr, bool show_smpte, agi::vfr::Framerate const& fps) {
|
||||
wxArrayString choices;
|
||||
|
||||
// Video FPS
|
||||
VideoContext *context = VideoContext::Get();
|
||||
bool vidLoaded = context->TimecodesLoaded();
|
||||
if (vidLoaded) {
|
||||
if (!context->FPS().IsVFR())
|
||||
choices.Add(wxString::Format(_("From video (%g)"), context->FPS().FPS()));
|
||||
bool vidLoaded = false;
|
||||
if (fps.IsLoaded()) {
|
||||
vidLoaded = true;
|
||||
if (!fps.IsVFR())
|
||||
choices.Add(wxString::Format(_("From video (%g)"), fps.FPS()));
|
||||
else if (allow_vfr)
|
||||
choices.Add(_("From video (VFR)"));
|
||||
else
|
||||
|
@ -152,7 +151,7 @@ agi::vfr::Framerate SubtitleFormat::AskForFPS(bool allow_vfr, bool show_smpte) {
|
|||
--choice;
|
||||
|
||||
switch (choice) {
|
||||
case -1: return context->FPS(); break; // VIDEO
|
||||
case -1: return fps; break;
|
||||
case 0: return Framerate(15, 1); break;
|
||||
case 1: return Framerate(24000, 1001); break;
|
||||
case 2: return Framerate(24, 1); break;
|
||||
|
@ -166,9 +165,7 @@ agi::vfr::Framerate SubtitleFormat::AskForFPS(bool allow_vfr, bool show_smpte) {
|
|||
case 10: return Framerate(120000, 1001); break;
|
||||
case 11: return Framerate(120, 1); break;
|
||||
}
|
||||
|
||||
assert(false);
|
||||
return Framerate();
|
||||
throw agi::InternalError("Out of bounds result from wxGetSingleChoiceIndex?", nullptr);
|
||||
}
|
||||
|
||||
void SubtitleFormat::StripTags(AssFile &file) {
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
//
|
||||
// Aegisub Project http://www.aegisub.org/
|
||||
|
||||
/// @file subtitle_format.h
|
||||
/// @see subtitle_format.cpp
|
||||
/// @ingroup subtitle_io
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libaegisub/exception.h>
|
||||
|
@ -70,7 +65,7 @@ public:
|
|||
/// Prompt the user for a frame rate to use
|
||||
/// @param allow_vfr Include video frame rate as an option even if it's vfr
|
||||
/// @param show_smpte Show SMPTE drop frame option
|
||||
static agi::vfr::Framerate AskForFPS(bool allow_vfr, bool show_smpte);
|
||||
static agi::vfr::Framerate AskForFPS(bool allow_vfr, bool show_smpte, agi::vfr::Framerate const& fps);
|
||||
|
||||
/// Constructor
|
||||
/// @param Subtitle format name
|
||||
|
@ -103,13 +98,13 @@ public:
|
|||
/// @param[out] target Destination to read lines into
|
||||
/// @param filename File to load
|
||||
/// @param encoding Encoding to use. May be ignored by the reader.
|
||||
virtual void ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& encoding) const { }
|
||||
virtual void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const { }
|
||||
|
||||
/// Save a subtitle file
|
||||
/// @param src Data to write
|
||||
/// @param filename File to write to
|
||||
/// @param forceEncoding Encoding to use or empty string for default
|
||||
virtual void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding="") const { }
|
||||
virtual void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding="") const { }
|
||||
|
||||
/// Get the wildcards for a save or load dialog
|
||||
/// @param mode 0: load 1: save
|
||||
|
|
|
@ -45,7 +45,7 @@ std::vector<std::string> AssSubtitleFormat::GetWriteWildcards() const {
|
|||
return {"ass", "ssa"};
|
||||
}
|
||||
|
||||
void AssSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void AssSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
TextFileReader file(filename, encoding);
|
||||
int version = !agi::fs::HasExtension(filename, "ssa");
|
||||
AssParser parser(target, version);
|
||||
|
@ -119,7 +119,7 @@ struct Writer {
|
|||
};
|
||||
}
|
||||
|
||||
void AssSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void AssSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
Writer writer(filename, encoding);
|
||||
|
||||
writer.Write(src->Info);
|
||||
|
|
|
@ -44,6 +44,6 @@ public:
|
|||
// Naturally the ASS subtitle format can save all Ass files
|
||||
bool CanSave(const AssFile*) const override { return true; }
|
||||
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
};
|
||||
|
|
|
@ -635,7 +635,7 @@ std::vector<std::string> Ebu3264SubtitleFormat::GetWriteWildcards() const
|
|||
return formats;
|
||||
}
|
||||
|
||||
void Ebu3264SubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const&) const
|
||||
void Ebu3264SubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const&) const
|
||||
{
|
||||
// collect data from user
|
||||
EbuExportSettings export_settings = get_export_config(nullptr);
|
||||
|
|
|
@ -28,7 +28,7 @@ class Ebu3264SubtitleFormat final : public SubtitleFormat {
|
|||
public:
|
||||
Ebu3264SubtitleFormat();
|
||||
std::vector<std::string> GetWriteWildcards() const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
|
||||
DEFINE_SIMPLE_EXCEPTION(ConversionFailed, agi::InvalidInputException, "subtitle_io/ebu3264/conversion_error")
|
||||
};
|
||||
|
|
|
@ -55,8 +55,8 @@ std::vector<std::string> EncoreSubtitleFormat::GetWriteWildcards() const {
|
|||
return formats;
|
||||
}
|
||||
|
||||
void EncoreSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const&) const {
|
||||
agi::vfr::Framerate fps = AskForFPS(false, true);
|
||||
void EncoreSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& video_fps, std::string const&) const {
|
||||
agi::vfr::Framerate fps = AskForFPS(false, true, video_fps);
|
||||
if (!fps.IsLoaded()) return;
|
||||
|
||||
// Convert to encore
|
||||
|
|
|
@ -38,5 +38,5 @@ class EncoreSubtitleFormat final : public SubtitleFormat {
|
|||
public:
|
||||
EncoreSubtitleFormat();
|
||||
std::vector<std::string> GetWriteWildcards() const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const&) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const&) const override;
|
||||
};
|
||||
|
|
|
@ -80,7 +80,7 @@ bool MicroDVDSubtitleFormat::CanReadFile(agi::fs::path const& filename, std::str
|
|||
return false;
|
||||
}
|
||||
|
||||
void MicroDVDSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void MicroDVDSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& vfps, std::string const& encoding) const {
|
||||
TextFileReader file(filename, encoding);
|
||||
|
||||
target->LoadDefault(false);
|
||||
|
@ -106,7 +106,7 @@ void MicroDVDSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& file
|
|||
}
|
||||
|
||||
// If it wasn't an fps line, ask the user for it
|
||||
fps = AskForFPS(true, false);
|
||||
fps = AskForFPS(true, false, vfps);
|
||||
if (!fps.IsLoaded()) return;
|
||||
}
|
||||
|
||||
|
@ -123,8 +123,8 @@ void MicroDVDSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& file
|
|||
}
|
||||
}
|
||||
|
||||
void MicroDVDSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
agi::vfr::Framerate fps = AskForFPS(true, false);
|
||||
void MicroDVDSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& vfps, std::string const& encoding) const {
|
||||
agi::vfr::Framerate fps = AskForFPS(true, false, vfps);
|
||||
if (!fps.IsLoaded()) return;
|
||||
|
||||
AssFile copy(*src);
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
std::vector<std::string> GetWriteWildcards() const override;
|
||||
|
||||
bool CanReadFile(agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& forceEncoding) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& forceEncoding) const override;
|
||||
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
};
|
||||
|
|
|
@ -51,6 +51,6 @@ std::vector<std::string> MKVSubtitleFormat::GetReadWildcards() const {
|
|||
return formats;
|
||||
}
|
||||
|
||||
void MKVSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, std::string const&) const {
|
||||
void MKVSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const&) const {
|
||||
MatroskaWrapper::GetSubtitles(filename, target);
|
||||
}
|
||||
|
|
|
@ -39,5 +39,5 @@ public:
|
|||
MKVSubtitleFormat();
|
||||
std::vector<std::string> GetReadWildcards() const override;
|
||||
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& forceEncoding) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& forceEncoding) const override;
|
||||
};
|
||||
|
|
|
@ -351,7 +351,7 @@ enum ParseState {
|
|||
STATE_LAST_WAS_BLANK
|
||||
};
|
||||
|
||||
void SRTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void SRTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
using namespace std;
|
||||
|
||||
TextFileReader file(filename, encoding);
|
||||
|
@ -463,7 +463,7 @@ found_timestamps:
|
|||
line->Text = tag_parser.ToAss(text);
|
||||
}
|
||||
|
||||
void SRTSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void SRTSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
TextFileWriter file(filename, encoding);
|
||||
|
||||
// Convert to SRT
|
||||
|
|
|
@ -45,6 +45,6 @@ public:
|
|||
|
||||
bool CanSave(const AssFile *file) const override;
|
||||
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
};
|
||||
|
|
|
@ -59,8 +59,8 @@ std::vector<std::string> TranStationSubtitleFormat::GetWriteWildcards() const {
|
|||
return formats;
|
||||
}
|
||||
|
||||
void TranStationSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
agi::vfr::Framerate fps = AskForFPS(false, true);
|
||||
void TranStationSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& vfps, std::string const& encoding) const {
|
||||
agi::vfr::Framerate fps = AskForFPS(false, true, vfps);
|
||||
if (!fps.IsLoaded()) return;
|
||||
|
||||
// Convert to TranStation
|
||||
|
|
|
@ -43,5 +43,5 @@ class TranStationSubtitleFormat final : public SubtitleFormat {
|
|||
public:
|
||||
TranStationSubtitleFormat();
|
||||
std::vector<std::string> GetWriteWildcards() const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ std::vector<std::string> TTXTSubtitleFormat::GetWriteWildcards() const {
|
|||
return GetReadWildcards();
|
||||
}
|
||||
|
||||
void TTXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void TTXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
target->LoadDefault(false);
|
||||
|
||||
// Load XML document
|
||||
|
@ -160,7 +160,7 @@ void TTXTSubtitleFormat::ProcessHeader(wxXmlNode *node) const {
|
|||
// TODO
|
||||
}
|
||||
|
||||
void TTXTSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void TTXTSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
// Convert to TTXT
|
||||
AssFile copy(*src);
|
||||
ConvertToTTXT(copy);
|
||||
|
|
|
@ -51,6 +51,6 @@ public:
|
|||
std::vector<std::string> GetReadWildcards() const override;
|
||||
std::vector<std::string> GetWriteWildcards() const override;
|
||||
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
};
|
||||
|
|
|
@ -68,7 +68,7 @@ bool TXTSubtitleFormat::CanWriteFile(agi::fs::path const& filename) const {
|
|||
return boost::iends_with(str, ".txt") && !(boost::iends_with(str, ".encore.txt") || boost::iends_with(str, ".transtation.txt"));
|
||||
}
|
||||
|
||||
void TXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void TXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
DialogTextImport dlg;
|
||||
if (dlg.ShowModal() == wxID_CANCEL) return;
|
||||
|
||||
|
@ -125,7 +125,7 @@ void TXTSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& filename,
|
|||
}
|
||||
}
|
||||
|
||||
void TXTSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const {
|
||||
void TXTSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
size_t num_actor_names = 0, num_dialogue_lines = 0;
|
||||
|
||||
// Detect number of lines with Actor field filled out
|
||||
|
|
|
@ -44,6 +44,6 @@ public:
|
|||
bool CanSave(const AssFile*) const override { return false; }
|
||||
|
||||
bool CanWriteFile(agi::fs::path const& filename) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, std::string const& encoding) const override;
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
};
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <libaegisub/path.h>
|
||||
#include <libaegisub/scoped_ptr.h>
|
||||
#include <libaegisub/util.h>
|
||||
#include <libaegisub/vfr.h>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <mutex>
|
||||
|
@ -98,7 +99,7 @@ CSRISubtitlesProvider::~CSRISubtitlesProvider() {
|
|||
void CSRISubtitlesProvider::LoadSubtitles(AssFile *subs) {
|
||||
if (tempfile.empty())
|
||||
tempfile = unique_path(config::path->Decode("?temp/csri-%%%%-%%%%-%%%%-%%%%.ass"));
|
||||
SubtitleFormat::GetWriter(tempfile)->WriteFile(subs, tempfile, "utf-8");
|
||||
SubtitleFormat::GetWriter(tempfile)->WriteFile(subs, tempfile, 0, "utf-8");
|
||||
|
||||
std::lock_guard<std::mutex> lock(csri_mutex);
|
||||
instance = csri_open_file(renderer, tempfile.string().c_str(), nullptr);
|
||||
|
|
|
@ -60,14 +60,11 @@
|
|||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
static VideoContext *instance;
|
||||
|
||||
VideoContext::VideoContext(agi::Context *c)
|
||||
: context(c)
|
||||
, playback(this)
|
||||
, playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
|
||||
{
|
||||
instance = this;
|
||||
context->ass->AddCommitListener(&VideoContext::OnSubtitlesCommit, this);
|
||||
context->subsController->AddFileSaveListener(&VideoContext::OnSubtitlesSave, this);
|
||||
|
||||
|
@ -89,10 +86,6 @@ VideoContext::VideoContext(agi::Context *c)
|
|||
|
||||
VideoContext::~VideoContext () { }
|
||||
|
||||
VideoContext *VideoContext::Get() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
void VideoContext::Reset() {
|
||||
config::path->SetToken("?video", "");
|
||||
|
||||
|
|
|
@ -269,6 +269,4 @@ public:
|
|||
|
||||
int TimeAtFrame(int frame, agi::vfr::Time type = agi::vfr::EXACT) const;
|
||||
int FrameAtTime(int time, agi::vfr::Time type = agi::vfr::EXACT) const;
|
||||
|
||||
static VideoContext *Get();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue