1 /*****************************************************************************
2
3 VideoFilterBase.cpp
4 Author: Laurent de Soras, 2021
5
6 --- Legal stuff ---
7
8 This program is free software. It comes without any warranty, to
9 the extent permitted by applicable law. You can redistribute it
10 and/or modify it under the terms of the Do What The Fuck You Want
11 To Public License, Version 2, as published by Sam Hocevar. See
12 http://www.wtfpl.net/ for more details.
13
14 *Tab=3***********************************************************************/
15
16
17
18 #if defined (_MSC_VER)
19 #pragma warning (1 : 4130 4223 4705 4706)
20 #pragma warning (4 : 4355 4786 4800)
21 #endif
22
23
24
25 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
26
27 #include "avsutl/VideoFilterBase.h"
28
29 #include <cassert>
30
31
32
33 namespace avsutl
34 {
35
36
37
38 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
39
40
41
VideoFilterBase(::IScriptEnvironment & env,::PClip c)42 VideoFilterBase::VideoFilterBase (::IScriptEnvironment &env, ::PClip c)
43 : Inherited (c)
44 {
45 try
46 {
47 env.CheckVersion (8);
48 _prop_flag = true;
49 }
50 catch (const ::AvisynthError &)
51 {
52 _prop_flag = false;
53 }
54 }
55
56
57
supports_props() const58 bool VideoFilterBase::supports_props () const noexcept
59 {
60 return _prop_flag;
61 }
62
63
64
build_new_frame(::IScriptEnvironment & env,const::VideoInfo & vi_n,::PVideoFrame * src_ptr,int align)65 ::PVideoFrame VideoFilterBase::build_new_frame (::IScriptEnvironment &env, const ::VideoInfo &vi_n, ::PVideoFrame *src_ptr, int align)
66 {
67 if (supports_props ())
68 {
69 return env.NewVideoFrameP (vi_n, src_ptr, align);
70 }
71 else
72 {
73 return env.NewVideoFrame (vi_n, align);
74 }
75 }
76
77
78
79 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
80
81
82
83 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
84
85
86
87 } // namespace avsutl
88
89
90
91 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
92