Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
16th June 2005, 10:46 | #1 | Link |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Run... the simplest filter I can imagine
Run
Brief description: Runs a system command. Search keywords: run, execute, command line, command prompt, app, application, simple minimal filter. Full description: Run(clip, string command) - runs command and returns clip unchanged. Example: Blankclip Run("Echo some text > test.txt") Notes: - I should really have made it work without the clip argument... but then I would have had to spend time and space figuring out IClip instead of GenericVideoFilter, and that would defeat the other point, which is: - The title wasn't entirely tongue in cheek; I thought someone might at some point find really really minimal filter code (W/O any graphics processing) useful when starting to program them... so here it is. #include "stdafx.h" //includes avisynth.h #include <stdlib.h> class Run : public GenericVideoFilter { public: Run(PClip _child, const char *command, IScriptEnvironment *env); }; Run::Run(PClip _child, const char *command, IScriptEnvironment *env) : GenericVideoFilter(_child) { system(command); } AVSValue __cdecl Create_FilterName(AVSValue args, void *user_data, IScriptEnvironment *env) { return new Run(args[0].AsClip(), args[1].AsString(), env); } extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment *env) { env->AddFunction("Run", "cs", Create_FilterName, 0); return "Run plugin"; } Edit: After I wrote this I thought of a few more keywords to search for and... http://forum.doom9.org/showthread.php?t=46506 ('CALL' plug-in.) Last edited by mg262; 16th June 2005 at 19:00. |
16th June 2005, 12:45 | #3 | Link | |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Quote:
But actually where I want it the pass-through is quite convenient. I've never (despite a few searches) been sure whether overloading is legal in AVISynth? I.e. env->AddFunction("Run", "cs", RunPassThrough, 0); env->AddFunction("Run", "s", RunDirect, 0); Edit: (I know the pass-through can be done with the function as well!) |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|