Wilbert
30th October 2003, 22:38
I want to invoke ConvertToRGB to make a new frame:
#include "windows.h"
#include "avisynth.h"
class color : public GenericVideoFilter {
PClip clip;
public:
color(PClip _child, IScriptEnvironment* env);
~color();
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
};
color::color(PClip _child, IScriptEnvironment* env) :
GenericVideoFilter(_child) {
AVSValue args[1] = { child };
clip = env->Invoke("ConvertToRGB",AVSValue(args,1)).AsClip();
}
color::~color() {
}
PVideoFrame __stdcall color::GetFrame(int n, IScriptEnvironment* env) {
//PVideoFrame src = child->GetFrame(n, env);
//PVideoFrame dst = env->NewVideoFrame(vi);
PVideoFrame test = clip->GetFrame(n, env);
return test;
}
AVSValue __cdecl Create_color(AVSValue args, void* user_data, IScriptEnvironment* env) {
return new color(args[0].AsClip(), env);
}
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env)
{
env->AddFunction("color", "c", Create_color, 0);
return 0;
}
Of course this is not correct. WMP gives an access violation (feeding avs with an YUY2 clip). What am I doing wrong?
#include "windows.h"
#include "avisynth.h"
class color : public GenericVideoFilter {
PClip clip;
public:
color(PClip _child, IScriptEnvironment* env);
~color();
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
};
color::color(PClip _child, IScriptEnvironment* env) :
GenericVideoFilter(_child) {
AVSValue args[1] = { child };
clip = env->Invoke("ConvertToRGB",AVSValue(args,1)).AsClip();
}
color::~color() {
}
PVideoFrame __stdcall color::GetFrame(int n, IScriptEnvironment* env) {
//PVideoFrame src = child->GetFrame(n, env);
//PVideoFrame dst = env->NewVideoFrame(vi);
PVideoFrame test = clip->GetFrame(n, env);
return test;
}
AVSValue __cdecl Create_color(AVSValue args, void* user_data, IScriptEnvironment* env) {
return new color(args[0].AsClip(), env);
}
extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env)
{
env->AddFunction("color", "c", Create_color, 0);
return 0;
}
Of course this is not correct. WMP gives an access violation (feeding avs with an YUY2 clip). What am I doing wrong?