forked from mia/Aegisub
Kill DEBUG_AVISYNTH_CODE as it hasn't actually worked for 3.5 years.
Originally committed to SVN as r4708.
This commit is contained in:
parent
428fc78623
commit
6040334278
3 changed files with 15 additions and 120 deletions
|
@ -34,71 +34,33 @@
|
||||||
/// @ingroup video_input audio_input
|
/// @ingroup video_input audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
////////////
|
|
||||||
// Includes
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
#include "avisynth_wrap.h"
|
#include "avisynth_wrap.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#ifdef DEBUG_AVISYNTH_CODE
|
|
||||||
#ifndef AGI_PRE
|
|
||||||
#include <wx/textfile.h>
|
|
||||||
#endif
|
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
wxTextFile avs_trace_file;
|
|
||||||
|
|
||||||
/// @brief DOCME
|
|
||||||
/// @param s
|
|
||||||
///
|
|
||||||
void DoAvsTrace(const wxString &s)
|
|
||||||
{
|
|
||||||
if (!avs_trace_file.IsOpened()) {
|
|
||||||
if (!avs_trace_file.Open(AegisubApp::folderName + _T("avstrace.txt"))) {
|
|
||||||
avs_trace_file.Create(AegisubApp::folderName + _T("avstrace.txt"));
|
|
||||||
}
|
|
||||||
avs_trace_file.AddLine(_T(""));
|
|
||||||
avs_trace_file.AddLine(_T("======= NEW SESSION ======="));
|
|
||||||
}
|
|
||||||
avs_trace_file.AddLine(s);
|
|
||||||
avs_trace_file.Write();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Allocate storage for and initialise static members
|
// Allocate storage for and initialise static members
|
||||||
int AviSynthWrapper::avs_refcount = 0;
|
int AviSynthWrapper::avs_refcount = 0;
|
||||||
HINSTANCE AviSynthWrapper::hLib = NULL;
|
HINSTANCE AviSynthWrapper::hLib = NULL;
|
||||||
IScriptEnvironment *AviSynthWrapper::env = NULL;
|
IScriptEnvironment *AviSynthWrapper::env = NULL;
|
||||||
wxMutex AviSynthWrapper::AviSynthMutex;
|
wxMutex AviSynthWrapper::AviSynthMutex;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief AviSynth constructor
|
/// @brief AviSynth constructor
|
||||||
///
|
///
|
||||||
AviSynthWrapper::AviSynthWrapper() {
|
AviSynthWrapper::AviSynthWrapper() {
|
||||||
if (!avs_refcount) {
|
if (!avs_refcount) {
|
||||||
AVSTRACE(_T("Avisynth not loaded, trying to load it now..."));
|
|
||||||
hLib=LoadLibrary(_T("avisynth.dll"));
|
hLib=LoadLibrary(_T("avisynth.dll"));
|
||||||
|
|
||||||
if (hLib == NULL) {
|
if (hLib == NULL) {
|
||||||
AVSTRACE(_T("Avisynth loading failed"));
|
|
||||||
throw wxString(_T("Could not load avisynth.dll"));
|
throw wxString(_T("Could not load avisynth.dll"));
|
||||||
}
|
}
|
||||||
AVSTRACE(_T("Avisynth loading successful"));
|
|
||||||
|
|
||||||
FUNC *CreateScriptEnv = (FUNC*)GetProcAddress(hLib, "CreateScriptEnvironment");
|
FUNC *CreateScriptEnv = (FUNC*)GetProcAddress(hLib, "CreateScriptEnvironment");
|
||||||
|
|
||||||
if (CreateScriptEnv == NULL) {
|
if (CreateScriptEnv == NULL) {
|
||||||
AVSTRACE(_T("Failed to get address of CreateScriptEnv"));
|
throw wxString(_T("Failed to get address of CreateScriptEnv from avisynth.dll"));
|
||||||
throw wxString(_T("Failed to get function from avisynth.dll"));
|
|
||||||
}
|
}
|
||||||
AVSTRACE(_T("Got address of CreateScriptEnv"));
|
|
||||||
|
|
||||||
// Require Avisynth 2.5.6+?
|
// Require Avisynth 2.5.6+?
|
||||||
if (OPT_GET("Provider/Avisynth/Allow Ancient")->GetBool())
|
if (OPT_GET("Provider/Avisynth/Allow Ancient")->GetBool())
|
||||||
|
@ -107,45 +69,30 @@ AviSynthWrapper::AviSynthWrapper() {
|
||||||
env = CreateScriptEnv(AVISYNTH_INTERFACE_VERSION);
|
env = CreateScriptEnv(AVISYNTH_INTERFACE_VERSION);
|
||||||
|
|
||||||
if (env == NULL) {
|
if (env == NULL) {
|
||||||
AVSTRACE(_T("Failed to create script environment"));
|
|
||||||
throw wxString(_T("Failed to create a new avisynth script environment. Avisynth is too old?"));
|
throw wxString(_T("Failed to create a new avisynth script environment. Avisynth is too old?"));
|
||||||
}
|
}
|
||||||
AVSTRACE(_T("Created script environment"));
|
|
||||||
// Set memory limit
|
// Set memory limit
|
||||||
const int memoryMax = OPT_GET("Provider/Avisynth/Memory Max")->GetInt();
|
const int memoryMax = OPT_GET("Provider/Avisynth/Memory Max")->GetInt();
|
||||||
if (memoryMax != 0) {
|
if (memoryMax != 0) {
|
||||||
env->SetMemoryMax(memoryMax);
|
env->SetMemoryMax(memoryMax);
|
||||||
AVSTRACE(_T("Set Avisynth memory limit"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
avs_refcount++;
|
avs_refcount++;
|
||||||
AVSTRACE(_T("Increased reference count"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief AviSynth destructor
|
/// @brief AviSynth destructor
|
||||||
///
|
///
|
||||||
AviSynthWrapper::~AviSynthWrapper() {
|
AviSynthWrapper::~AviSynthWrapper() {
|
||||||
AVSTRACE(_T("Decreasing reference count"));
|
|
||||||
if (!--avs_refcount) {
|
if (!--avs_refcount) {
|
||||||
AVSTRACE(_T("Reference count reached zero, deleting environment"));
|
|
||||||
delete env;
|
delete env;
|
||||||
AVSTRACE(_T("Environment deleted"));
|
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
AVSTRACE(_T("Free'd library, unloading complete"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Get environment
|
/// @brief Get environment
|
||||||
///
|
///
|
||||||
IScriptEnvironment *AviSynthWrapper::GetEnv() {
|
IScriptEnvironment *AviSynthWrapper::GetEnv() {
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,6 @@
|
||||||
/// @ingroup video_input audio_input
|
/// @ingroup video_input audio_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
|
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -47,27 +41,9 @@
|
||||||
|
|
||||||
#include "avisynth.h"
|
#include "avisynth.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
typedef IScriptEnvironment* __stdcall FUNC(int);
|
typedef IScriptEnvironment* __stdcall FUNC(int);
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////
|
|
||||||
// Avisynth debugging stuff
|
|
||||||
#ifdef DEBUG_AVISYNTH_CODE
|
|
||||||
void DoAvsTrace(const wxString &s);
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
#define AVSTRACE(s) DoAvsTrace(s)
|
|
||||||
#else
|
|
||||||
|
|
||||||
/// DOCME
|
|
||||||
#define AVSTRACE(s)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
/// @class AviSynthWrapper
|
/// @class AviSynthWrapper
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
/// @ingroup video_input
|
/// @ingroup video_input
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef WITH_AVISYNTH
|
#ifdef WITH_AVISYNTH
|
||||||
|
@ -47,6 +44,7 @@
|
||||||
|
|
||||||
#include "charset_conv.h"
|
#include "charset_conv.h"
|
||||||
#include "gl_wrap.h"
|
#include "gl_wrap.h"
|
||||||
|
#include <libaegisub/log.h>
|
||||||
#include "mkv_wrap.h"
|
#include "mkv_wrap.h"
|
||||||
#include "standard_paths.h"
|
#include "standard_paths.h"
|
||||||
#include "vfw_wrap.h"
|
#include "vfw_wrap.h"
|
||||||
|
@ -58,32 +56,21 @@
|
||||||
/// @param _filename
|
/// @param _filename
|
||||||
///
|
///
|
||||||
AvisynthVideoProvider::AvisynthVideoProvider(wxString _filename) {
|
AvisynthVideoProvider::AvisynthVideoProvider(wxString _filename) {
|
||||||
AVSTRACE(wxString::Format(_T("AvisynthVideoProvider: Creating new AvisynthVideoProvider: \"%s\", \"%s\""), _filename, _subfilename));
|
|
||||||
bool mpeg2dec3_priority = true;
|
bool mpeg2dec3_priority = true;
|
||||||
RGB32Video = NULL;
|
RGB32Video = NULL;
|
||||||
num_frames = 0;
|
num_frames = 0;
|
||||||
last_fnum = -1;
|
last_fnum = -1;
|
||||||
KeyFrames.clear();
|
KeyFrames.clear();
|
||||||
|
|
||||||
AVSTRACE(_T("AvisynthVideoProvider: Opening video"));
|
|
||||||
RGB32Video = OpenVideo(_filename,mpeg2dec3_priority);
|
RGB32Video = OpenVideo(_filename,mpeg2dec3_priority);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider: Video opened"));
|
|
||||||
|
|
||||||
vi = RGB32Video->GetVideoInfo();
|
vi = RGB32Video->GetVideoInfo();
|
||||||
AVSTRACE(_T("AvisynthVideoProvider: Got video info"));
|
|
||||||
AVSTRACE(_T("AvisynthVideoProvider: Done creating AvisynthVideoProvider"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @brief Destructor
|
/// @brief Destructor
|
||||||
///
|
///
|
||||||
AvisynthVideoProvider::~AvisynthVideoProvider() {
|
AvisynthVideoProvider::~AvisynthVideoProvider() {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider: Destroying AvisynthVideoProvider"));
|
|
||||||
RGB32Video = NULL;
|
|
||||||
AVSTRACE(_T("AvisynthVideoProvider: Destroying frame"));
|
|
||||||
iframe.Clear();
|
iframe.Clear();
|
||||||
AVSTRACE(_T("AvisynthVideoProvider: AvisynthVideoProvider destroyed"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Actually open the video into Avisynth
|
/// @brief Actually open the video into Avisynth
|
||||||
|
@ -92,9 +79,7 @@ AvisynthVideoProvider::~AvisynthVideoProvider() {
|
||||||
/// @return
|
/// @return
|
||||||
///
|
///
|
||||||
PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priority) {
|
PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priority) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening video"));
|
|
||||||
wxMutexLocker lock(AviSynthMutex);
|
wxMutexLocker lock(AviSynthMutex);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Got AVS mutex"));
|
|
||||||
AVSValue script;
|
AVSValue script;
|
||||||
|
|
||||||
usedDirectShow = false;
|
usedDirectShow = false;
|
||||||
|
@ -110,34 +95,32 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
char *videoFilename = env->SaveString(fname.GetShortPath().mb_str(csConvLocal));
|
char *videoFilename = env->SaveString(fname.GetShortPath().mb_str(csConvLocal));
|
||||||
|
|
||||||
// Avisynth file, just import it
|
// Avisynth file, just import it
|
||||||
if (extension == _T(".avs")) {
|
if (extension == _T(".avs")) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening .avs file with Import"));
|
LOG_I("avisynth/video") << "Opening .avs file with Import";
|
||||||
script = env->Invoke("Import", videoFilename);
|
script = env->Invoke("Import", videoFilename);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Finished"));
|
|
||||||
decoderName = _T("Import");
|
decoderName = _T("Import");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open avi file with AviSource
|
// Open avi file with AviSource
|
||||||
else if (extension == _T(".avi")) {
|
else if (extension == _T(".avi")) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening .avi file with AviSource"));
|
LOG_I("avisynth/video") << "Opening .avi file with AviSource";
|
||||||
try {
|
try {
|
||||||
const char *argnames[2] = { 0, "audio" };
|
const char *argnames[2] = { 0, "audio" };
|
||||||
AVSValue args[2] = { videoFilename, false };
|
AVSValue args[2] = { videoFilename, false };
|
||||||
script = env->Invoke("AviSource", AVSValue(args,2), argnames);
|
script = env->Invoke("AviSource", AVSValue(args,2), argnames);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened .avi file without audio"));
|
|
||||||
decoderName = _T("AviSource");
|
decoderName = _T("AviSource");
|
||||||
}
|
}
|
||||||
|
|
||||||
// On Failure, fallback to DSS
|
// On Failure, fallback to DSS
|
||||||
catch (AvisynthError &) {
|
catch (AvisynthError &) {
|
||||||
AVSTRACE(_T("Failed to open .avi file with AviSource, switching to DirectShowSource"));
|
LOG_I("avisynth/video") << "Failed to open .avi file with AviSource, switching to DirectShowSource";
|
||||||
goto directshowOpen;
|
goto directshowOpen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open d2v with mpeg2dec3
|
// Open d2v with mpeg2dec3
|
||||||
else if (extension == _T(".d2v") && env->FunctionExists("Mpeg2Dec3_Mpeg2Source") && mpeg2dec3_priority) {
|
else if (extension == _T(".d2v") && env->FunctionExists("Mpeg2Dec3_Mpeg2Source") && mpeg2dec3_priority) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening .d2v file with Mpeg2Dec3_Mpeg2Source"));
|
LOG_I("avisynth/video") << "Opening .d2v file with Mpeg2Dec3_Mpeg2Source";
|
||||||
script = env->Invoke("Mpeg2Dec3_Mpeg2Source", videoFilename);
|
script = env->Invoke("Mpeg2Dec3_Mpeg2Source", videoFilename);
|
||||||
decoderName = _T("Mpeg2Dec3_Mpeg2Source");
|
decoderName = _T("Mpeg2Dec3_Mpeg2Source");
|
||||||
|
|
||||||
|
@ -150,7 +133,7 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
|
|
||||||
// If that fails, try opening it with DGDecode
|
// If that fails, try opening it with DGDecode
|
||||||
else if (extension == _T(".d2v") && env->FunctionExists("DGDecode_Mpeg2Source")) {
|
else if (extension == _T(".d2v") && env->FunctionExists("DGDecode_Mpeg2Source")) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening .d2v file with DGDecode_Mpeg2Source"));
|
LOG_I("avisynth/video") << "Opening .d2v file with DGDecode_Mpeg2Source";
|
||||||
script = env->Invoke("Mpeg2Source", videoFilename);
|
script = env->Invoke("Mpeg2Source", videoFilename);
|
||||||
decoderName = _T("DGDecode_Mpeg2Source");
|
decoderName = _T("DGDecode_Mpeg2Source");
|
||||||
|
|
||||||
|
@ -159,7 +142,7 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (extension == _T(".d2v") && env->FunctionExists("Mpeg2Source")) {
|
else if (extension == _T(".d2v") && env->FunctionExists("Mpeg2Source")) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening .d2v file with other Mpeg2Source"));
|
LOG_I("avisynth/video") << "Opening .d2v file with other Mpeg2Source";
|
||||||
script = env->Invoke("Mpeg2Source", videoFilename);
|
script = env->Invoke("Mpeg2Source", videoFilename);
|
||||||
decoderName = _T("Mpeg2Source");
|
decoderName = _T("Mpeg2Source");
|
||||||
|
|
||||||
|
@ -172,27 +155,21 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
else {
|
else {
|
||||||
directshowOpen:
|
directshowOpen:
|
||||||
|
|
||||||
// DirectShowSource
|
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Opening file with DirectShowSource"));
|
|
||||||
|
|
||||||
// Try loading DirectShowSource2
|
// Try loading DirectShowSource2
|
||||||
bool dss2 = false;
|
bool dss2 = false;
|
||||||
if (env->FunctionExists("dss2")) dss2 = true;
|
if (env->FunctionExists("dss2")) dss2 = true;
|
||||||
if (!dss2) {
|
if (!dss2) {
|
||||||
wxFileName dss2path(StandardPaths::DecodePath(_T("?data/avss.dll")));
|
wxFileName dss2path(StandardPaths::DecodePath(_T("?data/avss.dll")));
|
||||||
if (dss2path.FileExists()) {
|
if (dss2path.FileExists()) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loading DirectShowSource2"));
|
|
||||||
env->Invoke("LoadPlugin",env->SaveString(dss2path.GetFullPath().mb_str(csConvLocal)));
|
env->Invoke("LoadPlugin",env->SaveString(dss2path.GetFullPath().mb_str(csConvLocal)));
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loaded DirectShowSource2"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If DSS2 loaded properly, try using it
|
// If DSS2 loaded properly, try using it
|
||||||
dss2 = false;
|
dss2 = false;
|
||||||
if (env->FunctionExists("dss2")) {
|
if (env->FunctionExists("dss2")) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Invoking DSS2"));
|
LOG_I("avisynth/video") << "Opening video with DSS2";
|
||||||
script = env->Invoke("DSS2", videoFilename);
|
script = env->Invoke("DSS2", videoFilename);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS2"));
|
|
||||||
dss2 = true;
|
dss2 = true;
|
||||||
decoderName = _T("DSS2");
|
decoderName = _T("DSS2");
|
||||||
}
|
}
|
||||||
|
@ -202,24 +179,22 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
// Load DirectShowSource.dll from app dir if it exists
|
// Load DirectShowSource.dll from app dir if it exists
|
||||||
wxFileName dsspath(StandardPaths::DecodePath(_T("?data/DirectShowSource.dll")));
|
wxFileName dsspath(StandardPaths::DecodePath(_T("?data/DirectShowSource.dll")));
|
||||||
if (dsspath.FileExists()) {
|
if (dsspath.FileExists()) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loading DirectShowSource"));
|
|
||||||
env->Invoke("LoadPlugin",env->SaveString(dsspath.GetFullPath().mb_str(csConvLocal)));
|
env->Invoke("LoadPlugin",env->SaveString(dsspath.GetFullPath().mb_str(csConvLocal)));
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loaded DirectShowSource"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then try using DSS
|
// Then try using DSS
|
||||||
if (env->FunctionExists("DirectShowSource")) {
|
if (env->FunctionExists("DirectShowSource")) {
|
||||||
const char *argnames[3] = { 0, "video", "audio" };
|
const char *argnames[3] = { 0, "video", "audio" };
|
||||||
AVSValue args[3] = { videoFilename, true, false };
|
AVSValue args[3] = { videoFilename, true, false };
|
||||||
|
LOG_I("avisynth/video") << "Opening video with DirectShowSource";
|
||||||
script = env->Invoke("DirectShowSource", AVSValue(args,3), argnames);
|
script = env->Invoke("DirectShowSource", AVSValue(args,3), argnames);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Successfully opened file with DSS without audio"));
|
|
||||||
usedDirectShow = true;
|
usedDirectShow = true;
|
||||||
decoderName = _T("DirectShowSource");
|
decoderName = _T("DirectShowSource");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failed to find a suitable function
|
// Failed to find a suitable function
|
||||||
else {
|
else {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: DSS function not found"));
|
LOG_E("avisynth/video") << "DSS function not found";
|
||||||
throw AvisynthError("No function suitable for opening the video found");
|
throw AvisynthError("No function suitable for opening the video found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,13 +203,13 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
|
|
||||||
// Catch errors
|
// Catch errors
|
||||||
catch (AvisynthError &err) {
|
catch (AvisynthError &err) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Avisynth error: ") + wxString(err.msg,csConvLocal));
|
LOG_E("avisynth/video") << "Avisynth error: " << err.msg;
|
||||||
throw _T("AviSynth error: ") + wxString(err.msg,csConvLocal);
|
throw _T("AviSynth error: ") + wxString(err.msg,csConvLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if video was loaded properly
|
// Check if video was loaded properly
|
||||||
if (!script.IsClip() || !script.AsClip()->GetVideoInfo().HasVideo()) {
|
if (!script.IsClip() || !script.AsClip()->GetVideoInfo().HasVideo()) {
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: No suitable video found"));
|
LOG_E("avisynth/video") << "AvisynthVideoProvider::OpenVideo: No suitable video found";
|
||||||
throw _T("Avisynth: No usable video found in ") + _filename;
|
throw _T("Avisynth: No usable video found in ") + _filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,10 +256,8 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
|
|
||||||
// Convert to RGB32
|
// Convert to RGB32
|
||||||
script = env->Invoke("ConvertToRGB32", script);
|
script = env->Invoke("ConvertToRGB32", script);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Converted to RGB32"));
|
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Finished opening video, AVS mutex will be released now"));
|
|
||||||
return (env->Invoke("Cache", script)).AsClip();
|
return (env->Invoke("Cache", script)).AsClip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +272,6 @@ const AegiVideoFrame AvisynthVideoProvider::GetFrame(int n) {
|
||||||
n = real_fps.FrameAtTime(vfr_fps.TimeAtFrame(n));
|
n = real_fps.FrameAtTime(vfr_fps.TimeAtFrame(n));
|
||||||
}
|
}
|
||||||
// Get avs frame
|
// Get avs frame
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::GetFrame"));
|
|
||||||
wxMutexLocker lock(AviSynthMutex);
|
wxMutexLocker lock(AviSynthMutex);
|
||||||
PVideoFrame frame = RGB32Video->GetFrame(n,env);
|
PVideoFrame frame = RGB32Video->GetFrame(n,env);
|
||||||
int Bpp = vi.BitsPerPixel() / 8;
|
int Bpp = vi.BitsPerPixel() / 8;
|
||||||
|
|
Loading…
Reference in a new issue