Log in

View Full Version : Writing to and reading from a file for a 2 pass filter plugin


vcmohan
27th January 2013, 13:00
I remember that long time back there was a facility in Avisynth for plugins to save a string but when I used it, I could not read back even within the same frame it was written. I do not know whether it still exists. My search for writing a file failed to get useful results
I am trying to code a plugin that operates in two passes ( or two plugins second operating after first one finishes , communicating through a text or hex file. Is it possible to do such I/O operations from within plugin? Similar to something from a script one can do a writeFile?
Can such a facility be available as an input spec in filter creation (c,s,i,f,a)

Mystery Keeper
27th January 2013, 15:12
Nothing prevents you from creating, reading and writing files within your plugin. Nothing prevents you to do anything at all within your plugin. You can even do as much as create windows to display custom information every time a frame is requested, or even put controls in them to adjust your filter on the fly.

vcmohan
28th January 2013, 04:28
Thanks for the information. But I have not come across any plugin that use such features. Can you give links to some such plugins?

Guest
28th January 2013, 05:10
FILE *fp;

fopen_s(&fp, "stuff.txt", "w");
if (fp == 0)
{
printf("Cannot open stuff file.\n");
return 0;
}

fprintf(fp, "%s\n", "Some data.\n");

fclose(fp);

You can do the open and close in your constructor and destructor, and do the write in GetFrame() for example.