View Single Post
Old 25th March 2009, 22:38   #1  |  Link
PhilR
Registered User
 
Join Date: Aug 2008
Posts: 6
avs2yuv.exe v0.24 and TFM()

I was trying to use TFM with the output option under avs2yuv.exe, but the stats file was always empty.

The reason is that TFM doesn't write out the statistics file until its destructor is invoked. avs2yuv never deletes its IScriptEnvironment, so this never occurs.

Here is one possible fix:

Code:
--- avs2yuv.cpp.orig.cpp	2009-03-25 14:36:08.417734300 -0700
+++ avs2yuv.cpp	2009-03-25 14:23:34.209782400 -0700
@@ -10,6 +10,7 @@
 #include <string.h>
 #include <io.h>
 #include <fcntl.h>
+#include <memory>
 #include "internal.h"
 
 #ifdef _MSC_VER
@@ -113,7 +114,7 @@
 		if(!CreateScriptEnvironment)
 			{fprintf(stderr, "failed to load CreateScriptEnvironment()\n"); return 1;}
 	
-		IScriptEnvironment* env = CreateScriptEnvironment(AVISYNTH_INTERFACE_VERSION);
+		std::auto_ptr<IScriptEnvironment> env(CreateScriptEnvironment(AVISYNTH_INTERFACE_VERSION));
 		AVSValue arg(infile);
 		AVSValue res = env->Invoke("Import", AVSValue(&arg, 1));
 		if(!res.IsClip())
@@ -197,7 +198,7 @@
 					frm = inf.num_frames-1;
 			}
 
-			PVideoFrame f = clip->GetFrame(frm, env);
+			PVideoFrame f = clip->GetFrame(frm, env.get());
 	
 			if(out_fhs) {
 				static const int planes[] = {PLANAR_Y, PLANAR_U, PLANAR_V};
PhilR is offline   Reply With Quote