diff options
author | jonasno <jonasno@users.sourceforge.net> | 2010-02-21 21:50:41 +0300 |
---|---|---|
committer | jonasno <jonasno@users.sourceforge.net> | 2010-02-21 21:50:41 +0300 |
commit | 3244957f4563575d22bf109de27a703558611b19 (patch) | |
tree | 749080f5503fe3fd31e28587000b60b90aacf995 /include/vd2 | |
parent | c7a41c0086a8bfcd07530779645d98c80039bd84 (diff) |
Merged VSFilterMod rev20, only 64 bit code enabled for the time being
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1688 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'include/vd2')
24 files changed, 2910 insertions, 0 deletions
diff --git a/include/vd2/Copying b/include/vd2/Copying new file mode 100644 index 000000000..928511020 --- /dev/null +++ b/include/vd2/Copying @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/include/vd2/OldFilterSDK/Filter.h b/include/vd2/OldFilterSDK/Filter.h new file mode 100644 index 000000000..40515ba7e --- /dev/null +++ b/include/vd2/OldFilterSDK/Filter.h @@ -0,0 +1,57 @@ +#ifndef f_FILTER_H
+#define f_FILTER_H
+
+#include <vd2\plugin\vdvideofilt.h>
+#include <windows.h>
+
+// This is really dumb, but necessary to support VTbls in C++.
+
+typedef struct VDXFilterVTbls {
+ void *pvtblVBitmap;
+} FilterVTbls;
+
+#ifdef VDEXT_MAIN
+ VDXFilterVTbls g_vtbls;
+#elif defined(VDEXT_NOTMAIN)
+ extern VDXFilterVTbls g_vtbls;
+#endif
+
+#define INITIALIZE_VTBLS ff->InitVTables(&g_vtbls)
+
+#include "VBitmap.h"
+
+typedef ::VDXFilterInitProc FilterInitProc;
+typedef ::VDXFilterDeinitProc FilterDeinitProc;
+typedef ::VDXFilterRunProc FilterRunProc;
+typedef ::VDXFilterParamProc FilterParamProc;
+typedef ::VDXFilterConfigProc FilterConfigProc;
+typedef ::VDXFilterStringProc FilterStringProc;
+typedef ::VDXFilterStartProc FilterStartProc;
+typedef ::VDXFilterEndProc FilterEndProc;
+typedef ::VDXFilterScriptStrProc FilterScriptStrProc;
+typedef ::VDXFilterStringProc2 FilterStringProc2;
+typedef ::VDXFilterSerialize FilterSerialize;
+typedef ::VDXFilterDeserialize FilterDeserialize;
+typedef ::VDXFilterCopy FilterCopy;
+
+typedef ::VDXFilterModuleInitProc FilterModuleInitProc;
+typedef ::VDXFilterModuleDeinitProc FilterModuleDeinitProc;
+
+//////////
+
+typedef ::VDXFilterPreviewButtonCallback FilterPreviewButtonCallback;
+typedef ::VDXFilterPreviewSampleCallback FilterPreviewSampleCallback;
+
+typedef ::IVDXFilterPreview IFilterPreview;
+
+//////////
+
+typedef ::VDXFilterModule FilterModule;
+typedef ::VDXFilterDefinition FilterDefinition;
+typedef ::VDXFilterStateInfo FilterStateInfo;
+typedef ::VDXFBitmap VFBitmap;
+
+typedef ::VDXFilterActivation FilterActivation;
+typedef ::VDXFilterFunctions FilterFunctions;
+
+#endif
diff --git a/include/vd2/OldFilterSDK/ScriptError.h b/include/vd2/OldFilterSDK/ScriptError.h new file mode 100644 index 000000000..900a9fc07 --- /dev/null +++ b/include/vd2/OldFilterSDK/ScriptError.h @@ -0,0 +1,8 @@ +#ifndef f_SYLIA_SCRIPTERROR_H
+#define f_SYLIA_SCRIPTERROR_H
+
+#include <vd2/plugin/vdvideofilt.h>
+
+typedef ::VDXScriptError CScriptError;
+
+#endif
diff --git a/include/vd2/OldFilterSDK/ScriptInterpreter.h b/include/vd2/OldFilterSDK/ScriptInterpreter.h new file mode 100644 index 000000000..fd12e969e --- /dev/null +++ b/include/vd2/OldFilterSDK/ScriptInterpreter.h @@ -0,0 +1,11 @@ +#ifndef f_SYLIA_SCRIPTINTERPRETER_H
+#define f_SYLIA_SCRIPTINTERPRETER_H
+
+#include <vd2/plugin/vdvideofilt.h>
+
+typedef ::VDXScriptValue CScriptValue;
+typedef ::VDXScriptError CScriptError;
+typedef ::VDXScriptObject CScriptObject;
+typedef ::IVDXScriptInterpreter IScriptInterpreter;
+
+#endif
diff --git a/include/vd2/OldFilterSDK/ScriptValue.h b/include/vd2/OldFilterSDK/ScriptValue.h new file mode 100644 index 000000000..0d8628469 --- /dev/null +++ b/include/vd2/OldFilterSDK/ScriptValue.h @@ -0,0 +1,17 @@ +#ifndef f_SYLIA_SCRIPTVALUE_H
+#define f_SYLIA_SCRIPTVALUE_H
+
+#include <vd2/plugin/vdvideofilt.h>
+
+typedef ::VDXScriptObject CScriptObject;
+typedef ::VDXScriptValue CScriptValue;
+typedef ::IVDXScriptInterpreter IScriptInterpreter;
+
+typedef ::VDXScriptFunctionPtr ScriptFunctionPtr;
+typedef ::VDXVoidScriptFunctionPtr ScriptVoidFunctionPtr;
+typedef ::VDXIntScriptFunctionPtr ScriptIntFunctionPtr;
+
+typedef ::VDXScriptFunctionDef ScriptFunctionDef;
+typedef ::VDXScriptObject CScriptObject;
+
+#endif
diff --git a/include/vd2/OldFilterSDK/VBitmap.h b/include/vd2/OldFilterSDK/VBitmap.h new file mode 100644 index 000000000..08795ac5f --- /dev/null +++ b/include/vd2/OldFilterSDK/VBitmap.h @@ -0,0 +1,16 @@ +#ifndef f_VIRTUALDUB_VBITMAP_H
+#define f_VIRTUALDUB_VBITMAP_H
+
+#include <windows.h>
+#include <vd2/plugin/vdvideofilt.h>
+
+typedef unsigned Pixel;
+typedef unsigned Pixel32;
+typedef unsigned char Pixel8;
+typedef int PixCoord;
+typedef int PixDim;
+typedef ptrdiff_t PixOffset;
+
+typedef ::VDXBitmap VBitmap;
+
+#endif
diff --git a/include/vd2/OldFilterSDK/VirtualDub.h b/include/vd2/OldFilterSDK/VirtualDub.h new file mode 100644 index 000000000..25e5fd475 --- /dev/null +++ b/include/vd2/OldFilterSDK/VirtualDub.h @@ -0,0 +1,7 @@ +#pragma once
+
+#include "Filter.h"
+#include "ScriptInterpreter.h"
+#include "ScriptError.h"
+#include "ScriptValue.h"
+#include "VBitmap.h"
diff --git a/include/vd2/PluginSDK.chm b/include/vd2/PluginSDK.chm Binary files differnew file mode 100644 index 000000000..1eaccd9dc --- /dev/null +++ b/include/vd2/PluginSDK.chm diff --git a/include/vd2/VDXFrame/Unknown.h b/include/vd2/VDXFrame/Unknown.h new file mode 100644 index 000000000..34de61f46 --- /dev/null +++ b/include/vd2/VDXFrame/Unknown.h @@ -0,0 +1,110 @@ +// VDXFrame - Helper library for VirtualDub plugins
+// Copyright (C) 2008 Avery Lee
+//
+// The plugin headers in the VirtualDub plugin SDK are licensed differently
+// differently than VirtualDub and the Plugin SDK themselves. This
+// particular file is thus licensed as follows (the "zlib" license):
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any
+// damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must
+// not claim that you wrote the original software. If you use this
+// software in a product, an acknowledgment in the product
+// documentation would be appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must
+// not be misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
+
+#ifndef f_VD2_VDXFRAME_UNKNOWN_H
+#define f_VD2_VDXFRAME_UNKNOWN_H
+
+#include <vd2/plugin/vdplugin.h>
+
+extern "C" long _InterlockedExchangeAdd(volatile long *p, long v);
+#pragma intrinsic(_InterlockedExchangeAdd)
+
+template<class T> class vdxunknown : public T {
+public:
+ vdxunknown() : mRefCount(0) {}
+ vdxunknown(const vdxunknown<T>& src) : mRefCount(0) {} // do not copy the refcount
+ virtual ~vdxunknown() {}
+
+ vdxunknown<T>& operator=(const vdxunknown<T>&) {} // do not copy the refcount
+
+ virtual int VDXAPIENTRY AddRef() {
+ return _InterlockedExchangeAdd(&mRefCount, 1) + 1;
+ }
+
+ virtual int VDXAPIENTRY Release() {
+ long rc = _InterlockedExchangeAdd(&mRefCount, -1) - 1;
+ if (!mRefCount) {
+ mRefCount = 1;
+ delete this;
+ return 0;
+ }
+
+ return rc;
+ }
+
+ virtual void *VDXAPIENTRY AsInterface(uint32 iid) {
+ if (iid == T::kIID)
+ return static_cast<T *>(this);
+
+ if (iid == IVDXUnknown::kIID)
+ return static_cast<IVDXUnknown *>(this);
+
+ return NULL;
+ }
+
+protected:
+ volatile long mRefCount;
+};
+
+template<class T1, class T2> class vdxunknown2 : public T1, public T2 {
+public:
+ vdxunknown2() : mRefCount(0) {}
+ vdxunknown2(const vdxunknown2& src) : mRefCount(0) {} // do not copy the refcount
+ virtual ~vdxunknown2() {}
+
+ vdxunknown2& operator=(const vdxunknown2&) {} // do not copy the refcount
+
+ virtual int VDXAPIENTRY AddRef() {
+ return _InterlockedExchangeAdd(&mRefCount, 1) + 1;
+ }
+
+ virtual int VDXAPIENTRY Release() {
+ long rc = _InterlockedExchangeAdd(&mRefCount, -1) - 1;
+ if (!mRefCount) {
+ mRefCount = 1;
+ delete this;
+ return 0;
+ }
+
+ return rc;
+ }
+
+ virtual void *VDXAPIENTRY AsInterface(uint32 iid) {
+ if (iid == T1::kIID)
+ return static_cast<T1 *>(this);
+
+ if (iid == T2::kIID)
+ return static_cast<T2 *>(this);
+
+ if (iid == IVDXUnknown::kIID)
+ return static_cast<IVDXUnknown *>(static_cast<T1 *>(this));
+
+ return NULL;
+ }
+
+protected:
+ volatile long mRefCount;
+};
+
+#endif
diff --git a/include/vd2/VDXFrame/VideoFilter.h b/include/vd2/VDXFrame/VideoFilter.h new file mode 100644 index 000000000..78ef03bd1 --- /dev/null +++ b/include/vd2/VDXFrame/VideoFilter.h @@ -0,0 +1,221 @@ +// VDXFrame - Helper library for VirtualDub plugins
+// Copyright (C) 2008 Avery Lee
+//
+// The plugin headers in the VirtualDub plugin SDK are licensed differently
+// differently than VirtualDub and the Plugin SDK themselves. This
+// particular file is thus licensed as follows (the "zlib" license):
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any
+// damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must
+// not claim that you wrote the original software. If you use this
+// software in a product, an acknowledgment in the product
+// documentation would be appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must
+// not be misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
+
+#ifndef f_VD2_VDXFRAME_VIDEOFILTER_H
+#define f_VD2_VDXFRAME_VIDEOFILTER_H
+
+#include <stdlib.h>
+#include <stddef.h>
+#include <new>
+
+#include <vd2/plugin/vdvideofilt.h>
+
+///////////////////////////////////////////////////////////////////////////
+/// \class VDXVideoFilter
+///
+/// This class handles most of the grimy work of creating the interface
+/// between your filter and VirtualDub.
+///
+class VDXVideoFilter {
+public:
+ VDXVideoFilter();
+ virtual ~VDXVideoFilter();
+
+ void SetHooks(VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+
+ // linkage routines
+
+ virtual bool Init();
+ virtual uint32 GetParams()=0;
+ virtual void Start();
+ virtual void Run() = 0;
+ virtual void End();
+ virtual bool Configure(VDXHWND hwnd);
+ virtual void GetSettingString(char *buf, int maxlen);
+ virtual void GetScriptString(char *buf, int maxlen);
+ virtual int Serialize(char *buf, int maxbuf);
+ virtual int Deserialize(const char *buf, int maxbuf);
+ virtual sint64 Prefetch(sint64 frame);
+ virtual bool Prefetch2(sint64 frame, IVDXVideoPrefetcher *prefetcher);
+
+ virtual bool OnEvent(uint32 event, const void *eventData);
+ virtual bool OnInvalidateCaches();
+
+ static void __cdecl FilterDeinit (VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+ static int __cdecl FilterRun (const VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+ static long __cdecl FilterParam (VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+ static int __cdecl FilterConfig (VDXFilterActivation *fa, const VDXFilterFunctions *ff, VDXHWND hWnd);
+ static int __cdecl FilterStart (VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+ static int __cdecl FilterEnd (VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+ static void __cdecl FilterString (const VDXFilterActivation *fa, const VDXFilterFunctions *ff, char *buf);
+ static bool __cdecl FilterScriptStr(VDXFilterActivation *fa, const VDXFilterFunctions *, char *, int);
+ static void __cdecl FilterString2 (const VDXFilterActivation *fa, const VDXFilterFunctions *ff, char *buf, int maxlen);
+ static int __cdecl FilterSerialize (VDXFilterActivation *fa, const VDXFilterFunctions *ff, char *buf, int maxbuf);
+ static void __cdecl FilterDeserialize (VDXFilterActivation *fa, const VDXFilterFunctions *ff, const char *buf, int maxbuf);
+ static sint64 __cdecl FilterPrefetch(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, sint64 frame);
+ static bool __cdecl FilterPrefetch2(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, sint64 frame, IVDXVideoPrefetcher *prefetcher);
+ static bool __cdecl FilterEvent(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, uint32 event, const void *eventData);
+
+ // member variables
+ VDXFilterActivation *fa;
+ const VDXFilterFunctions *ff;
+
+ static const VDXScriptFunctionDef sScriptMethods[];
+
+protected:
+ void SafePrintf(char *buf, int maxbuf, const char *format, ...);
+};
+
+///////////////////////////////////////////////////////////////////////////
+// Script method support
+//
+// To declare a Config() script method, add
+//
+// VDXVF_DECLARE_SCRIPT_METHODS()
+//
+// to the public portion of your class definition, and then add a method
+// table at namespace scope:
+//
+// VDXVF_BEGIN_SCRIPT_METHODS(YUVTransformFilter)
+// VDXVF_DEFINE_SCRIPT_METHOD(YUVTransformFilter, ScriptConfig, "iii")
+// VDXVF_END_SCRIPT_METHODS()
+//
+// Use VDXVF_DEFINE_SCRIPT_METHOD() for the first method, and then
+// VDXVF_DEFINE_SCRIPT_METHOD2() for any overloads.
+
+#define VDXVF_DECLARE_SCRIPT_METHODS() static const VDXScriptFunctionDef sScriptMethods[]
+
+#define VDXVF_BEGIN_SCRIPT_METHODS(klass) const VDXScriptFunctionDef klass::sScriptMethods[] = {
+#define VDXVF_DEFINE_SCRIPT_METHOD(klass, method, args) { (VDXScriptFunctionPtr)VDXVideoFilterScriptAdapter<klass, &klass::method>::AdaptFn, "Config", "0" args },
+#define VDXVF_DEFINE_SCRIPT_METHOD2(klass, method, args) { (VDXScriptFunctionPtr)VDXVideoFilterScriptAdapter<klass, &klass::method>::AdaptFn, NULL, "0" args },
+#define VDXVF_END_SCRIPT_METHODS() { NULL } };
+
+extern char VDXVideoFilterConfigureOverloadTest(bool (VDXVideoFilter::*)(VDXHWND));
+extern double VDXVideoFilterConfigureOverloadTest(...);
+extern char VDXVideoFilterPrefetchOverloadTest(sint64 (VDXVideoFilter::*)(sint64));
+extern double VDXVideoFilterPrefetchOverloadTest(...);
+extern char VDXVideoFilterPrefetch2OverloadTest(bool (VDXVideoFilter::*)(sint64, IVDXVideoPrefetcher *));
+extern double VDXVideoFilterPrefetch2OverloadTest(...);
+
+template<class T, void (T::*T_Method)(IVDXScriptInterpreter *, const VDXScriptValue *, int)>
+class VDXVideoFilterScriptAdapter
+{
+public:
+ static void AdaptFn(IVDXScriptInterpreter *isi, void *fa0, const VDXScriptValue *argv, int argc) {
+ VDXFilterActivation *fa = (VDXFilterActivation *)fa0;
+ VDXVideoFilter *base = *(VDXVideoFilter **)fa->filter_data;
+ (static_cast<T *>(base)->*T_Method)(isi, argv, argc);
+ }
+};
+
+template<class T>
+class VDXVideoFilterScriptObjectAdapter {
+public:
+ static const VDXScriptObject sScriptObject;
+};
+
+template<class T>
+const VDXScriptObject VDXVideoFilterScriptObjectAdapter<T>::sScriptObject = {
+ NULL, (T::sScriptMethods == VDXVideoFilter::sScriptMethods) ? NULL : (VDXScriptFunctionDef *)static_cast<const VDXScriptFunctionDef *>(T::sScriptMethods), NULL
+};
+
+///////////////////////////////////////////////////////////////////////////
+/// \class VDXVideoFilterDefinition
+///
+/// This template creates the FilterDefinition structure for you based on
+/// your filter class.
+///
+template<class T>
+class VDXVideoFilterDefinition : public VDXFilterDefinition {
+public:
+ VDXVideoFilterDefinition(const char *pszAuthor, const char *pszName, const char *pszDescription) {
+ _next = NULL;
+ _prev = NULL;
+ _module = NULL;
+
+ name = pszName;
+ desc = pszDescription;
+ maker = pszAuthor;
+ private_data = NULL;
+ inst_data_size = sizeof(T) + sizeof(VDXVideoFilter *);
+
+ initProc = FilterInit;
+ deinitProc = T::FilterDeinit;
+ runProc = T::FilterRun;
+ paramProc = T::FilterParam;
+ configProc = sizeof(VDXVideoFilterConfigureOverloadTest(&T::Configure)) > 1 ? T::FilterConfig : NULL;
+ stringProc = T::FilterString;
+ startProc = T::FilterStart;
+ endProc = T::FilterEnd;
+
+ script_obj = T::sScriptMethods ? const_cast<VDXScriptObject *>(&VDXVideoFilterScriptObjectAdapter<T>::sScriptObject) : 0;
+ fssProc = T::FilterScriptStr;
+
+ stringProc2 = T::FilterString2;
+ serializeProc = T::FilterSerialize;
+ deserializeProc = T::FilterDeserialize;
+ copyProc = FilterCopy;
+ copyProc2 = FilterCopy2;
+
+ prefetchProc = sizeof(VDXVideoFilterPrefetchOverloadTest(&T::Prefetch)) > 1 ? T::FilterPrefetch : NULL;
+ prefetchProc2 = sizeof(VDXVideoFilterPrefetch2OverloadTest(&T::Prefetch2)) > 1 || sizeof(VDXVideoFilterPrefetchOverloadTest(&T::Prefetch)) > 1 ? T::FilterPrefetch2 : NULL;
+
+ eventProc = T::FilterEvent;
+ }
+
+private:
+ static int __cdecl FilterInit (VDXFilterActivation *fa, const VDXFilterFunctions *ff) {
+ T *pThis = new((char *)fa->filter_data + sizeof(VDXVideoFilter *)) T;
+ *(VDXVideoFilter **)fa->filter_data = static_cast<VDXVideoFilter *>(pThis);
+
+ pThis->SetHooks(fa, ff);
+
+ try {
+ if (!pThis->Init()) {
+ pThis->~T();
+ return 1;
+ }
+
+ return 0;
+ } catch(...) {
+ pThis->~T();
+ throw;
+ }
+ }
+
+ static void __cdecl FilterCopy (VDXFilterActivation *fa, const VDXFilterFunctions *ff, void *dst) {
+ T *p = new((char *)dst + sizeof(VDXVideoFilter *)) T(*static_cast<T *>(*reinterpret_cast<VDXVideoFilter **>(fa->filter_data)));
+ p->ff = ff;
+ *(VDXVideoFilter **)dst = p;
+ }
+
+ static void __cdecl FilterCopy2 (VDXFilterActivation *fa, const VDXFilterFunctions *ff, void *dst, VDXFilterActivation *fanew, const VDXFilterFunctions *ffnew) {
+ T *p = new((char *)dst + sizeof(VDXVideoFilter *)) T(*static_cast<T *>(*reinterpret_cast<VDXVideoFilter **>(fa->filter_data)));
+ p->ff = ffnew;
+ p->fa = fanew;
+ *(VDXVideoFilter **)dst = p;
+ }
+};
+
+#endif
diff --git a/include/vd2/VDXFrame/VideoFilterDialog.h b/include/vd2/VDXFrame/VideoFilterDialog.h new file mode 100644 index 000000000..1e9aa4917 --- /dev/null +++ b/include/vd2/VDXFrame/VideoFilterDialog.h @@ -0,0 +1,46 @@ +// VDXFrame - Helper library for VirtualDub plugins
+// Copyright (C) 2008 Avery Lee
+//
+// The plugin headers in the VirtualDub plugin SDK are licensed differently
+// differently than VirtualDub and the Plugin SDK themselves. This
+// particular file is thus licensed as follows (the "zlib" license):
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any
+// damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must
+// not claim that you wrote the original software. If you use this
+// software in a product, an acknowledgment in the product
+// documentation would be appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must
+// not be misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
+
+#ifndef f_VD2_VDXFRAME_VIDEOFILTERDIALOG_H
+#define f_VD2_VDXFRAME_VIDEOFILTERDIALOG_H
+
+#include <windows.h>
+
+class VDXVideoFilterDialog {
+public:
+ VDXVideoFilterDialog();
+
+protected:
+ HWND mhdlg;
+
+ LRESULT Show(HINSTANCE hInst, LPCSTR templName, HWND parent);
+ LRESULT Show(HINSTANCE hInst, LPCWSTR templName, HWND parent);
+ HWND ShowModeless(HINSTANCE hInst, LPCSTR templName, HWND parent);
+ HWND ShowModeless(HINSTANCE hInst, LPCWSTR templName, HWND parent);
+
+ static INT_PTR CALLBACK StaticDlgProc(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam);
+ virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
+};
+
+#endif
diff --git a/include/vd2/VDXFrame/VideoFilterEntry.h b/include/vd2/VDXFrame/VideoFilterEntry.h new file mode 100644 index 000000000..112f02c3f --- /dev/null +++ b/include/vd2/VDXFrame/VideoFilterEntry.h @@ -0,0 +1,84 @@ +// VDXFrame - Helper library for VirtualDub plugins
+// Copyright (C) 2008 Avery Lee
+//
+// The plugin headers in the VirtualDub plugin SDK are licensed differently
+// differently than VirtualDub and the Plugin SDK themselves. This
+// particular file is thus licensed as follows (the "zlib" license):
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any
+// damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must
+// not claim that you wrote the original software. If you use this
+// software in a product, an acknowledgment in the product
+// documentation would be appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must
+// not be misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
+
+#ifndef f_VD2_VDXFRAME_VIDEOFILTERENTRY_H
+#define f_VD2_VDXFRAME_VIDEOFILTERENTRY_H
+
+#include <vd2/plugin/vdvideofilt.h>
+
+#ifdef _MSC_VER
+ #pragma once
+#endif
+
+struct VDXFilterModule;
+struct VDXFilterFunctions;
+struct VDXFilterDefinition;
+
+///////////////////////////////////////////////////////////////////////////////
+/// Video filter module entry point declaration macros
+///
+/// To declare the module init and deinit functions:
+///
+/// VDX_DECLARE_VFMODULE()
+///
+/// By default this declares the module as requiring copy contructor support
+/// (V9 / VirtualDub 1.4.12). If you need to declare a different minimum
+/// version, use:
+///
+/// VDX_DECLARE_VFMODULE_APIVER(version)
+///
+#define VDX_DECLARE_VFMODULE() VDX_DECLARE_VFMODULE_APIVER(VIRTUALDUB_FILTERDEF_COMPATIBLE_COPYCTOR)
+#define VDX_DECLARE_VFMODULE_APIVER(apiver) \
+ extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(struct VDXFilterModule *fm, const VDXFilterFunctions *ff, int& vdfd_ver, int& vdfd_compat) { \
+ return VDXVideoFilterModuleInit2(fm, ff, vdfd_ver, vdfd_compat, (apiver)); \
+ } \
+ \
+ extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(struct VDXFilterModule *fm, const VDXFilterFunctions *ff) { \
+ VDXVideoFilterModuleDeinit(fm, ff); \
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+/// Video filter declaration macros
+///
+/// To declare video filters, use the following pattern:
+///
+/// VDX_DECLARE_VIDEOFILTERS_BEGIN()
+/// VDX_DECLARE_VIDEOFILTER(definitionSymbolName)
+/// VDX_DECLARE_VIDEOFILTERS_END()
+///
+/// Each entry points to a variable of type VDXFilterDefinition. Note that these must
+/// be declared as _non-const_ for compatibility with older versions of VirtualDub.
+/// Video filters declared this way are automatically registered by the module init
+/// routine.
+///
+#define VDX_DECLARE_VIDEOFILTERS_BEGIN() VDXFilterDefinition *VDXGetVideoFilterDefinition(int index) {
+#define VDX_DECLARE_VIDEOFILTER(defVarName) if (!index--) { extern VDXFilterDefinition defVarName; return &defVarName; }
+#define VDX_DECLARE_VIDEOFILTERS_END() return NULL; \
+ }
+int VDXVideoFilterModuleInit2(struct VDXFilterModule *fm, const VDXFilterFunctions *ff, int& vdfd_ver, int& vdfd_compat, int ver_compat_target);
+void VDXVideoFilterModuleDeinit(struct VDXFilterModule *fm, const VDXFilterFunctions *ff);
+
+int VDXGetVideoFilterAPIVersion();
+
+#endif
diff --git a/include/vd2/extras/FilterSDK/Filter.h b/include/vd2/extras/FilterSDK/Filter.h new file mode 100644 index 000000000..a8747a4a6 --- /dev/null +++ b/include/vd2/extras/FilterSDK/Filter.h @@ -0,0 +1,244 @@ +// VirtualDub - Video processing and capture application
+// Copyright (C) 1998-2002 Avery Lee
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+//
+// FILTER EXEMPTION:
+//
+// As a special exemption to the GPL in order to permit creation of
+// filters that work with multiple programs as well as VirtualDub,
+// compiling with this header file shall not be considered creation
+// of a derived work; that is, the act of compiling with this header
+// file does not require your source code or the resulting module
+// to be released in source code form or under a GPL-compatible
+// license according to parts (2) and (3) of the GPL. A filter built
+// using this header file may thus be licensed or dual-licensed so
+// that it may be used with VirtualDub as well as an alternative
+// product whose license is incompatible with the GPL.
+//
+// Nothing in this exemption shall be construed as applying to
+// VirtualDub itself -- that is, this exemption does not give you
+// permission to use parts of VirtualDub's source besides this
+// header file, or to dynamically link with VirtualDub as part
+// of the filter load process, in a fashion not permitted by the
+// GPL.
+
+
+#ifndef f_FILTER_H
+#define f_FILTER_H
+
+#include <windows.h>
+
+// This is really dumb, but necessary to support VTbls in C++.
+
+struct FilterVTbls {
+ void *pvtblVBitmap;
+};
+
+#ifdef VDEXT_MAIN
+struct FilterVTbls g_vtbls;
+#elif defined(VDEXT_NOTMAIN)
+extern struct FilterVTbls g_vtbls;
+#endif
+
+#define INITIALIZE_VTBLS ff->InitVTables(&g_vtbls)
+
+#include "VBitmap.h"
+
+//////////////////
+
+struct CScriptObject;
+
+//////////////////
+
+enum {
+ FILTERPARAM_SWAP_BUFFERS = 0x00000001L,
+ FILTERPARAM_NEEDS_LAST = 0x00000002L,
+};
+
+#define FILTERPARAM_HAS_LAG(frames) ((int)(frames) << 16)
+
+///////////////////
+
+class VFBitmap;
+class FilterActivation;
+struct FilterFunctions;
+
+typedef int (*FilterInitProc )(FilterActivation *fa, const FilterFunctions *ff);
+typedef void (*FilterDeinitProc )(FilterActivation *fa, const FilterFunctions *ff);
+typedef int (*FilterRunProc )(const FilterActivation *fa, const FilterFunctions *ff);
+typedef long (*FilterParamProc )(FilterActivation *fa, const FilterFunctions *ff);
+typedef int (*FilterConfigProc )(FilterActivation *fa, const FilterFunctions *ff, HWND hWnd);
+typedef void (*FilterStringProc )(const FilterActivation *fa, const FilterFunctions *ff, char *buf);
+typedef int (*FilterStartProc )(FilterActivation *fa, const FilterFunctions *ff);
+typedef int (*FilterEndProc )(FilterActivation *fa, const FilterFunctions *ff);
+typedef bool (*FilterScriptStrProc)(FilterActivation *fa, const FilterFunctions *, char *, int);
+typedef void (*FilterStringProc2 )(const FilterActivation *fa, const FilterFunctions *ff, char *buf, int maxlen);
+typedef int (*FilterSerialize )(FilterActivation *fa, const FilterFunctions *ff, char *buf, int maxbuf);
+typedef void (*FilterDeserialize )(FilterActivation *fa, const FilterFunctions *ff, const char *buf, int maxbuf);
+typedef void (*FilterCopy )(FilterActivation *fa, const FilterFunctions *ff, void *dst);
+
+typedef int (__cdecl *FilterModuleInitProc)(struct FilterModule *fm, const FilterFunctions *ff, int& vdfd_ver, int& vdfd_compat);
+typedef void (__cdecl *FilterModuleDeinitProc)(struct FilterModule *fm, const FilterFunctions *ff);
+
+//////////
+
+typedef void (__cdecl *FilterPreviewButtonCallback)(bool fNewState, void *pData);
+typedef void (__cdecl *FilterPreviewSampleCallback)(VFBitmap *, long lFrame, long lCount, void *pData);
+
+class IFilterPreview {
+public:
+ virtual void SetButtonCallback(FilterPreviewButtonCallback, void *)=0;
+ virtual void SetSampleCallback(FilterPreviewSampleCallback, void *)=0;
+
+ virtual bool isPreviewEnabled()=0;
+ virtual void Toggle(HWND)=0;
+ virtual void Display(HWND, bool)=0;
+ virtual void RedoFrame()=0;
+ virtual void RedoSystem()=0;
+ virtual void UndoSystem()=0;
+ virtual void InitButton(HWND)=0;
+ virtual void Close()=0;
+ virtual bool SampleCurrentFrame()=0;
+ virtual long SampleFrames()=0;
+};
+
+//////////
+
+#define VIRTUALDUB_FILTERDEF_VERSION (8)
+#define VIRTUALDUB_FILTERDEF_COMPATIBLE (4)
+
+// v3: added lCurrentSourceFrame to FrameStateInfo
+// v4 (1.2): lots of additions (VirtualDub 1.2)
+// v5 (1.3d): lots of bugfixes - stretchblt bilinear, and non-zero startproc
+// v6 (1.4): added error handling functions
+// v7 (1.4d): added frame lag, exception handling
+// v8 (1.4.11):
+
+typedef struct FilterModule {
+ struct FilterModule *next, *prev;
+ HINSTANCE hInstModule;
+ FilterModuleInitProc initProc;
+ FilterModuleDeinitProc deinitProc;
+} FilterModule;
+
+typedef struct FilterDefinition {
+
+ struct FilterDefinition *next, *prev;
+ FilterModule *module;
+
+ const char * name;
+ const char * desc;
+ const char * maker;
+ void * private_data;
+ int inst_data_size;
+
+ FilterInitProc initProc;
+ FilterDeinitProc deinitProc;
+ FilterRunProc runProc;
+ FilterParamProc paramProc;
+ FilterConfigProc configProc;
+ FilterStringProc stringProc;
+ FilterStartProc startProc;
+ FilterEndProc endProc;
+
+ CScriptObject *script_obj;
+
+ FilterScriptStrProc fssProc;
+
+ // NEW - 1.4.11
+ FilterStringProc2 stringProc2;
+ FilterSerialize serializeProc;
+ FilterDeserialize deserializeProc;
+ FilterCopy copyProc;
+} FilterDefinition;
+
+//////////
+
+// FilterStateInfo: contains dynamic info about file being processed
+
+class FilterStateInfo {
+public:
+ long lCurrentFrame; // current output frame
+ long lMicrosecsPerFrame; // microseconds per output frame
+ long lCurrentSourceFrame; // current source frame
+ long lMicrosecsPerSrcFrame; // microseconds per source frame
+ long lSourceFrameMS; // source frame timestamp
+ long lDestFrameMS; // output frame timestamp
+};
+
+// VFBitmap: VBitmap extended to hold filter-specific information
+
+class VFBitmap : public VBitmap {
+public:
+ enum {
+ NEEDS_HDC = 0x00000001L,
+ };
+
+ DWORD dwFlags;
+ HDC hdc;
+};
+
+// FilterActivation: This is what is actually passed to filters at runtime.
+
+class FilterActivation {
+public:
+ FilterDefinition *filter;
+ void *filter_data;
+ VFBitmap &dst, &src;
+ VFBitmap *__reserved0, *const last;
+ unsigned long x1, y1, x2, y2;
+
+ FilterStateInfo *pfsi;
+ IFilterPreview *ifp;
+
+ FilterActivation(VFBitmap& _dst, VFBitmap& _src, VFBitmap *_last) : dst(_dst), src(_src), last(_last) {}
+ FilterActivation(const FilterActivation& fa, VFBitmap& _dst, VFBitmap& _src, VFBitmap *_last);
+};
+
+// These flags must match those in cpuaccel.h!
+
+#ifndef f_VIRTUALDUB_CPUACCEL_H
+#define CPUF_SUPPORTS_CPUID (0x00000001L)
+#define CPUF_SUPPORTS_FPU (0x00000002L)
+#define CPUF_SUPPORTS_MMX (0x00000004L)
+#define CPUF_SUPPORTS_INTEGER_SSE (0x00000008L)
+#define CPUF_SUPPORTS_SSE (0x00000010L)
+#define CPUF_SUPPORTS_SSE2 (0x00000020L)
+#define CPUF_SUPPORTS_3DNOW (0x00000040L)
+#define CPUF_SUPPORTS_3DNOW_EXT (0x00000080L)
+#endif
+
+struct FilterFunctions {
+ FilterDefinition *(*addFilter)(FilterModule *, FilterDefinition *, int fd_len);
+ void (*removeFilter)(FilterDefinition *);
+ bool (*isFPUEnabled)();
+ bool (*isMMXEnabled)();
+ void (*InitVTables)(struct FilterVTbls *);
+
+ // These functions permit you to throw MyError exceptions from a filter.
+ // YOU MUST ONLY CALL THESE IN runProc, initProc, and startProc.
+
+ void (*ExceptOutOfMemory)(); // ADDED: V6 (VirtualDub 1.4)
+ void (*Except)(const char *format, ...); // ADDED: V6 (VirtualDub 1.4)
+
+ // These functions are callable at any time.
+
+ long (*getCPUFlags)(); // ADDED: V6 (VirtualDub 1.4)
+ long (*getHostVersionInfo)(char *buffer, int len); // ADDED: V7 (VirtualDub 1.4d)
+};
+
+#endif
diff --git a/include/vd2/extras/FilterSDK/ScriptError.h b/include/vd2/extras/FilterSDK/ScriptError.h new file mode 100644 index 000000000..ceaad8bb0 --- /dev/null +++ b/include/vd2/extras/FilterSDK/ScriptError.h @@ -0,0 +1,93 @@ +// VirtualDub - Video processing and capture application
+// Copyright (C) 1998-2002 Avery Lee
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+//
+// FILTER EXEMPTION:
+//
+// As a special exemption to the GPL in order to permit creation of
+// filters that work with multiple programs as well as VirtualDub,
+// compiling with this header file shall not be considered creation
+// of a derived work; that is, the act of compiling with this header
+// file does not require your source code or the resulting module
+// to be released in source code form or under a GPL-compatible
+// license according to parts (2) and (3) of the GPL. A filter built
+// using this header file may thus be licensed or dual-licensed so
+// that it may be used with VirtualDub as well as an alternative
+// product whose license is incompatible with the GPL.
+//
+// Nothing in this exemption shall be construed as applying to
+// VirtualDub itself -- that is, this exemption does not give you
+// permission to use parts of VirtualDub's source besides this
+// header file, or to dynamically link with VirtualDub as part
+// of the filter load process, in a fashion not permitted by the
+// GPL.
+
+#ifndef f_SYLIA_SCRIPTERROR_H
+#define f_SYLIA_SCRIPTERROR_H
+
+class CScriptError {
+public:
+ int err;
+
+ enum {
+ PARSE_ERROR=1,
+ SEMICOLON_EXPECTED,
+ IDENTIFIER_EXPECTED,
+
+ TYPE_INT_REQUIRED,
+ TYPE_ARRAY_REQUIRED,
+ TYPE_FUNCTION_REQUIRED,
+ TYPE_OBJECT_REQUIRED,
+
+ OBJECT_MEMBER_NAME_REQUIRED,
+ FUNCCALLEND_EXPECTED,
+ TOO_MANY_PARAMS,
+ DIVIDE_BY_ZERO,
+ VAR_NOT_FOUND,
+ MEMBER_NOT_FOUND,
+ OVERLOADED_FUNCTION_NOT_FOUND,
+ IDENT_TOO_LONG,
+ OPERATOR_EXPECTED,
+ CLOSEPARENS_EXPECTED,
+ CLOSEBRACKET_EXPECTED,
+
+ VAR_UNDEFINED,
+
+ OUT_OF_STRING_SPACE,
+ OUT_OF_MEMORY,
+ INTERNAL_ERROR,
+ EXTERNAL_ERROR,
+
+ FCALL_OUT_OF_RANGE,
+ FCALL_INVALID_PTYPE,
+ FCALL_UNKNOWN_STR,
+ };
+
+ CScriptError(int err_num) : err(err_num) { }
+
+ int getErr() { return err; }
+};
+
+#define SCRIPT_ERROR(x) throw CScriptError(CScriptError::##x)
+
+extern "C" __declspec(dllexport) char * __stdcall TranslateScriptError(int);
+
+char inline *TranslateScriptError(CScriptError cse) {
+ return TranslateScriptError(cse.getErr());
+}
+
+#endif
diff --git a/include/vd2/extras/FilterSDK/ScriptInterpreter.h b/include/vd2/extras/FilterSDK/ScriptInterpreter.h new file mode 100644 index 000000000..ad0197118 --- /dev/null +++ b/include/vd2/extras/FilterSDK/ScriptInterpreter.h @@ -0,0 +1,70 @@ +// VirtualDub - Video processing and capture application
+// Copyright (C) 1998-2002 Avery Lee
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+//
+// FILTER EXEMPTION:
+//
+// As a special exemption to the GPL in order to permit creation of
+// filters that work with multiple programs as well as VirtualDub,
+// compiling with this header file shall not be considered creation
+// of a derived work; that is, the act of compiling with this header
+// file does not require your source code or the resulting module
+// to be released in source code form or under a GPL-compatible
+// license according to parts (2) and (3) of the GPL. A filter built
+// using this header file may thus be licensed or dual-licensed so
+// that it may be used with VirtualDub as well as an alternative
+// product whose license is incompatible with the GPL.
+//
+// Nothing in this exemption shall be construed as applying to
+// VirtualDub itself -- that is, this exemption does not give you
+// permission to use parts of VirtualDub's source besides this
+// header file, or to dynamically link with VirtualDub as part
+// of the filter load process, in a fashion not permitted by the
+// GPL.
+
+#ifndef f_SYLIA_SCRIPTINTERPRETER_H
+#define f_SYLIA_SCRIPTINTERPRETER_H
+
+class CScriptValue;
+class CScriptError;
+struct CScriptObject;
+class IScriptInterpreter;
+
+typedef CScriptValue (*ScriptRootHandlerPtr)(IScriptInterpreter *,char *,void *);
+
+class IScriptInterpreter {
+public:
+ virtual void Destroy() =0;
+
+ virtual void SetRootHandler(ScriptRootHandlerPtr, void *) =0;
+
+ virtual void ExecuteLine(char *s) =0;
+
+ virtual void ScriptError(int e) =0;
+ virtual char* TranslateScriptError(CScriptError& cse) =0;
+ virtual char** AllocTempString(long l) =0;
+
+ virtual CScriptValue LookupObjectMember(CScriptObject *obj, void *, char *szIdent) = 0;
+};
+
+extern "C" __declspec(dllexport) IScriptInterpreter * __stdcall CreateScriptInterpreter();
+
+#define GETPROC_CREATESCRIPTINTERPRETER(hInst) ((IScriptInterpreter *(__stdcall *)())GetProcAddress(hInst, "_CreateScriptInterpreter@0"))
+
+#define EXT_SCRIPT_ERROR(x) (isi->ScriptError((CScriptError::x)))
+
+#endif
diff --git a/include/vd2/extras/FilterSDK/ScriptValue.h b/include/vd2/extras/FilterSDK/ScriptValue.h new file mode 100644 index 000000000..52e629a3f --- /dev/null +++ b/include/vd2/extras/FilterSDK/ScriptValue.h @@ -0,0 +1,126 @@ +// VirtualDub - Video processing and capture application
+// Copyright (C) 1998-2002 Avery Lee
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+//
+// FILTER EXEMPTION:
+//
+// As a special exemption to the GPL in order to permit creation of
+// filters that work with multiple programs as well as VirtualDub,
+// compiling with this header file shall not be considered creation
+// of a derived work; that is, the act of compiling with this header
+// file does not require your source code or the resulting module
+// to be released in source code form or under a GPL-compatible
+// license according to parts (2) and (3) of the GPL. A filter built
+// using this header file may thus be licensed or dual-licensed so
+// that it may be used with VirtualDub as well as an alternative
+// product whose license is incompatible with the GPL.
+//
+// Nothing in this exemption shall be construed as applying to
+// VirtualDub itself -- that is, this exemption does not give you
+// permission to use parts of VirtualDub's source besides this
+// header file, or to dynamically link with VirtualDub as part
+// of the filter load process, in a fashion not permitted by the
+// GPL.
+
+#ifndef f_SYLIA_SCRIPTVALUE_H
+#define f_SYLIA_SCRIPTVALUE_H
+
+class CScriptArray;
+struct CScriptObject;
+class CScriptValue;
+class IScriptInterpreter;
+class VariableTableEntry;
+
+typedef CScriptValue (*ScriptObjectLookupFuncPtr)(IScriptInterpreter *, CScriptObject *, void *lpVoid, char *szName);
+typedef CScriptValue (*ScriptFunctionPtr)(IScriptInterpreter *, void *, CScriptValue *, int);
+typedef void (*ScriptVoidFunctionPtr)(IScriptInterpreter *, void *, CScriptValue *, int);
+typedef int (*ScriptIntFunctionPtr)(IScriptInterpreter *, void *, CScriptValue *, int);
+typedef CScriptValue (*ScriptArrayFunctionPtr)(IScriptInterpreter *, void *, int);
+
+typedef struct ScriptFunctionDef {
+ ScriptFunctionPtr func_ptr;
+ char *name;
+ char *arg_list;
+} ScriptFunctionDef;
+
+typedef struct ScriptObjectDef {
+ char *name;
+ CScriptObject *obj;
+} ScriptObjectDef;
+
+typedef struct CScriptObject {
+ ScriptObjectLookupFuncPtr Lookup;
+ ScriptFunctionDef *func_list;
+ ScriptObjectDef *obj_list;
+} CScriptObject;
+
+class CScriptValue {
+public:
+ enum { T_VOID, T_INT, T_PINT, T_STR, T_ARRAY, T_OBJECT, T_FNAME, T_FUNCTION, T_VARLV } type;
+ CScriptObject *thisPtr;
+ union {
+ int i;
+ int *pi;
+ char **s;
+ ScriptArrayFunctionPtr ary;
+ CScriptObject *obj;
+ ScriptFunctionPtr func;
+ ScriptFunctionDef *fname;
+ VariableTableEntry *vte;
+ } u;
+ void *lpVoid;
+
+ CScriptValue() { type = T_VOID; }
+ CScriptValue(int i) { type = T_INT; u.i = i; }
+ CScriptValue(int *pi) { type = T_PINT; u.pi = pi; }
+ CScriptValue(char **s) { type = T_STR; u.s = s; }
+ CScriptValue(CScriptObject *obj) { type = T_OBJECT; u.obj = obj; }
+ CScriptValue(CScriptObject *_thisPtr, ScriptArrayFunctionPtr csa) {
+ type = T_ARRAY;
+ u.ary = csa;
+ thisPtr = _thisPtr;
+ }
+ CScriptValue(CScriptObject *_thisPtr, ScriptFunctionDef *sfd) {
+ type = T_FNAME;
+ u.fname = sfd;
+ thisPtr = _thisPtr;
+ }
+ CScriptValue(CScriptObject *_thisPtr, ScriptFunctionPtr fn) {
+ type = T_FUNCTION;
+ u.func = fn;
+ thisPtr = _thisPtr;
+ }
+ CScriptValue(VariableTableEntry *vte) { type = T_VARLV; u.vte = vte; }
+
+ bool isVoid() { return type == T_VOID; }
+ bool isInt() { return type == T_INT; }
+ bool isString() { return type == T_STR; }
+ bool isArray() { return type == T_ARRAY; }
+ bool isObject() { return type == T_OBJECT; }
+ bool isFName() { return type == T_FNAME; }
+ bool isFunction() { return type == T_FUNCTION; }
+ bool isVarLV() { return type == T_VARLV; }
+
+ int asInt() { return u.i; }
+ char ** asString() { return u.s; }
+ ScriptArrayFunctionPtr asArray() { return u.ary; }
+ CScriptObject * asObject() { return u.obj; }
+ ScriptFunctionPtr asFunction() { return u.func; }
+ VariableTableEntry* asVarLV() { return u.vte; }
+};
+
+#endif
diff --git a/include/vd2/extras/FilterSDK/VBitmap.h b/include/vd2/extras/FilterSDK/VBitmap.h new file mode 100644 index 000000000..0b95066fc --- /dev/null +++ b/include/vd2/extras/FilterSDK/VBitmap.h @@ -0,0 +1,172 @@ +// VirtualDub - Video processing and capture application
+// Copyright (C) 1998-2002 Avery Lee
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+//
+// FILTER EXEMPTION:
+//
+// As a special exemption to the GPL in order to permit creation of
+// filters that work with multiple programs as well as VirtualDub,
+// compiling with this header file shall not be considered creation
+// of a derived work; that is, the act of compiling with this header
+// file does not require your source code or the resulting module
+// to be released in source code form or under a GPL-compatible
+// license according to parts (2) and (3) of the GPL. A filter built
+// using this header file may thus be licensed or dual-licensed so
+// that it may be used with VirtualDub as well as an alternative
+// product whose license is incompatible with the GPL.
+//
+// Nothing in this exemption shall be construed as applying to
+// VirtualDub itself -- that is, this exemption does not give you
+// permission to use parts of VirtualDub's source besides this
+// header file, or to dynamically link with VirtualDub as part
+// of the filter load process, in a fashion not permitted by the
+// GPL.
+
+#ifndef f_VIRTUALDUB_VBITMAP_H
+#define f_VIRTUALDUB_VBITMAP_H
+
+#include <windows.h>
+
+typedef unsigned long Pixel;
+typedef unsigned long Pixel32;
+typedef unsigned char Pixel8;
+typedef long PixCoord;
+typedef long PixDim;
+typedef long PixOffset;
+
+#ifdef VDEXT_VIDEO_FILTER
+#define NOVTABLE __declspec(novtable)
+#else
+#define NOVTABLE
+#endif
+
+class NOVTABLE VBitmap {
+public:
+ Pixel * data;
+ Pixel * palette;
+ int depth;
+ PixCoord w, h;
+ PixOffset pitch;
+ PixOffset modulo;
+ PixOffset size;
+ PixOffset offset;
+
+ Pixel *Address(PixCoord x, PixCoord y) const {
+ return Addressi(x, h-y-1);
+ }
+
+ Pixel *Addressi(PixCoord x, PixCoord y) const {
+ return (Pixel *)((char *)data + y*pitch + x*(depth>>3));
+ }
+
+ Pixel *Address16(PixCoord x, PixCoord y) const {
+ return Address16i(x, h-y-1);
+ }
+
+ Pixel *Address16i(PixCoord x, PixCoord y) const {
+ return (Pixel *)((char *)data + y*pitch + x*2);
+ }
+
+ Pixel *Address32(PixCoord x, PixCoord y) const {
+ return Address32i(x, h-y-1);
+ }
+
+ Pixel *Address32i(PixCoord x, PixCoord y) const {
+ return (Pixel *)((char *)data + y*pitch + x*sizeof(Pixel));
+ }
+
+ PixOffset PitchAlign4() {
+ return ((w * depth + 31)/32)*4;
+ }
+
+ PixOffset PitchAlign8() {
+ return ((w * depth + 63)/64)*8;
+ }
+
+ PixOffset Modulo() {
+ return pitch - (w*depth+7)/8;
+ }
+
+ PixOffset Size() {
+ return pitch*h;
+ }
+
+ //////
+
+ VBitmap() throw() {
+#ifdef VDEXT_VIDEO_FILTER
+ init();
+#endif
+ }
+ VBitmap(void *data, PixDim w, PixDim h, int depth) throw();
+ VBitmap(void *data, BITMAPINFOHEADER *) throw();
+
+#ifdef VDEXT_VIDEO_FILTER
+ void init() throw() { *(void **)this = g_vtbls.pvtblVBitmap; }
+#endif
+
+ virtual VBitmap& init(void *data, PixDim w, PixDim h, int depth) throw();
+ virtual VBitmap& init(void *data, BITMAPINFOHEADER *) throw();
+
+ virtual void MakeBitmapHeader(BITMAPINFOHEADER *bih) const throw();
+
+ virtual void AlignTo4() throw();
+ virtual void AlignTo8() throw();
+
+ virtual void BitBlt(PixCoord x2, PixCoord y2, const VBitmap *src, PixCoord x1, PixCoord y1, PixDim dx, PixDim dy) const throw();
+ virtual void BitBltDither(PixCoord x2, PixCoord y2, const VBitmap *src, PixDim x1, PixDim y1, PixDim dx, PixDim dy, bool to565) const throw();
+ virtual void BitBlt565(PixCoord x2, PixCoord y2, const VBitmap *src, PixDim x1, PixDim y1, PixDim dx, PixDim dy) const throw();
+
+ virtual bool BitBltXlat1(PixCoord x2, PixCoord y2, const VBitmap *src, PixCoord x1, PixCoord y1, PixDim dx, PixDim dy, const Pixel8 *tbl) const throw();
+ virtual bool BitBltXlat3(PixCoord x2, PixCoord y2, const VBitmap *src, PixCoord x1, PixCoord y1, PixDim dx, PixDim dy, const Pixel32 *tbl) const throw();
+
+ virtual bool StretchBltNearestFast(PixCoord x1, PixCoord y1, PixDim dx, PixDim dy, const VBitmap *src, double x2, double y2, double dx1, double dy1) const throw();
+
+ virtual bool StretchBltBilinearFast(PixCoord x1, PixCoord y1, PixDim dx, PixDim dy, const VBitmap *src, double x2, double y2, double dx1, double dy1) const throw();
+
+ virtual bool RectFill(PixCoord x1, PixCoord y1, PixDim dx, PixDim dy, Pixel32 c) const throw();
+
+ enum {
+ HISTO_LUMA,
+ HISTO_GRAY,
+ HISTO_RED,
+ HISTO_GREEN,
+ HISTO_BLUE,
+ };
+
+ virtual bool Histogram(PixCoord x, PixCoord y, PixCoord dx, PixCoord dy, long *pHisto, int iHistoType) const throw();
+
+ //// NEW AS OF VIRTUALDUB V1.2B
+
+ virtual bool BitBltFromYUY2(PixCoord x2, PixCoord y2, const VBitmap *src, PixCoord x1, PixCoord y1, PixDim dx, PixDim dy) const throw();
+ virtual bool BitBltFromI420(PixCoord x2, PixCoord y2, const VBitmap *src, PixCoord x1, PixCoord y1, PixDim dx, PixDim dy) const throw();
+
+ //// NEW AS OF VIRTUALDUB V1.4C
+
+ virtual void MakeBitmapHeaderNoPadding(BITMAPINFOHEADER *bih) const throw();
+
+ ///////////
+
+ bool BitBltFromYUY2Fullscale(PixCoord x2, PixCoord y2, const VBitmap *src, PixCoord x1, PixCoord y1, PixDim dx, PixDim dy) const throw();
+
+private:
+ bool dualrectclip(PixCoord& x2, PixCoord& y2, const VBitmap *src, PixCoord& x1, PixCoord& y1, PixDim& dx, PixDim& dy) const throw();
+};
+
+#undef NOVTABLE
+
+#endif
diff --git a/include/vd2/extras/FilterSDK/VirtualDub.h b/include/vd2/extras/FilterSDK/VirtualDub.h new file mode 100644 index 000000000..25e5fd475 --- /dev/null +++ b/include/vd2/extras/FilterSDK/VirtualDub.h @@ -0,0 +1,7 @@ +#pragma once
+
+#include "Filter.h"
+#include "ScriptInterpreter.h"
+#include "ScriptError.h"
+#include "ScriptValue.h"
+#include "VBitmap.h"
diff --git a/include/vd2/extras/FilterSDK/readme.txt b/include/vd2/extras/FilterSDK/readme.txt new file mode 100644 index 000000000..5ccf63548 --- /dev/null +++ b/include/vd2/extras/FilterSDK/readme.txt @@ -0,0 +1,6 @@ +There are the header files that were included with the last version of the
+Filter SDK. You can use these if you need to rebuild a filter that doesn't
+compile with the new headers, or otherwise need to know the full API supported
+by that SDK (such as if you are building a new filter host). If possible,
+you should use the migration headers in include/vd2/OldFilterSDK instead,
+and new filters should use <vd2/plugin/vdvideofilt.h> directly.
diff --git a/include/vd2/plugin/vdaudiofilt.h b/include/vd2/plugin/vdaudiofilt.h new file mode 100644 index 000000000..2680ad794 --- /dev/null +++ b/include/vd2/plugin/vdaudiofilt.h @@ -0,0 +1,148 @@ +#ifndef f_VD2_PLUGIN_VDAUDIOFILT_H
+#define f_VD2_PLUGIN_VDAUDIOFILT_H
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Audio filter support
+
+struct VDAudioFilterDefinition;
+struct VDXWaveFormat;
+struct VDPluginCallbacks;
+
+enum {
+ kVDPlugin_AudioAPIVersion = 2
+};
+
+struct VDAudioFilterPin {
+ unsigned mGranularity; // Block size a filter reads/writes this pin.
+ unsigned mDelay; // Delay in samples on this input.
+ unsigned mBufferSize; // The size, in samples, of the buffer.
+ unsigned mCurrentLevel; // The number of samples currently in the buffer.
+ sint64 mLength; // Approximate length of this stream in us.
+ const VDXWaveFormat *mpFormat;
+ bool mbVBR;
+ bool mbEnded;
+ char _pad[2];
+ void *mpBuffer;
+ unsigned mSamplesWritten; // The number of samples just written to the buffer.
+ unsigned mAvailSpace; // Available room pointed to by mpBuffer (output pins only).
+
+ uint32 (VDAPIENTRY *mpReadProc)(VDAudioFilterPin *pPin, void *dst, uint32 samples, bool bAllowFill, int format);
+
+ // These helpers are non-virtual inlines and are compiled into filters.
+ uint32 Read(void *dst, uint32 samples, bool bAllowFill, int format) {
+ return mpReadProc(this, dst, samples, bAllowFill, format);
+ }
+};
+
+struct VDAudioFilterContext;
+
+struct VDAudioFilterCallbacks {
+ VDXWaveFormat *(VDAPIENTRY *AllocPCMWaveFormat)(unsigned sampling_rate, unsigned channels, unsigned bits, bool bFloat);
+ VDXWaveFormat *(VDAPIENTRY *AllocCustomWaveFormat)(unsigned extra_size);
+ VDXWaveFormat *(VDAPIENTRY *CopyWaveFormat)(const VDXWaveFormat *);
+ void (VDAPIENTRY *FreeWaveFormat)(const VDXWaveFormat *);
+ void (VDAPIENTRY *Wake)(const VDAudioFilterContext *pContext);
+};
+
+struct VDAudioFilterContext {
+ void *mpFilterData;
+ VDAudioFilterPin **mpInputs;
+ VDAudioFilterPin **mpOutputs;
+ IVDPluginCallbacks *mpServices;
+ const VDAudioFilterCallbacks *mpAudioCallbacks;
+ const VDAudioFilterDefinition *mpDefinition;
+ uint32 mAPIVersion;
+ uint32 mInputSamples; // Number of input samples available on all pins.
+ uint32 mInputGranules; // Number of input granules available on all pins.
+ uint32 mInputsEnded; // Number of inputs that have ended.
+ uint32 mOutputSamples; // Number of output sample spaces available on all pins.
+ uint32 mOutputGranules; // Number of output granule spaces available on all pins.
+ uint32 mCommonSamples; // Number of input samples and output sample spaces.
+ uint32 mCommonGranules; // Number of input and output granules.
+};
+
+// This structure is intentionally identical to WAVEFORMATEX, with one
+// exception -- mExtraSize is *always* present, even for PCM.
+
+struct VDXWaveFormat {
+ enum { kTagPCM = 1 };
+
+ uint16 mTag;
+ uint16 mChannels;
+ uint32 mSamplingRate;
+ uint32 mDataRate;
+ uint16 mBlockSize;
+ uint16 mSampleBits;
+ uint16 mExtraSize;
+};
+
+enum {
+ kVFARun_OK = 0,
+ kVFARun_Finished = 1,
+ kVFARun_InternalWork = 2,
+
+ kVFAPrepare_OK = 0,
+ kVFAPrepare_BadFormat = 1
+};
+
+enum {
+ kVFARead_Native = 0,
+ kVFARead_PCM8 = 1,
+ kVFARead_PCM16 = 2,
+ kVFARead_PCM32F = 3
+};
+
+typedef void * (VDAPIENTRY *VDAudioFilterExtProc )(const VDAudioFilterContext *pContext, const char *pInterfaceName);
+typedef uint32 (VDAPIENTRY *VDAudioFilterRunProc )(const VDAudioFilterContext *pContext);
+typedef sint64 (VDAPIENTRY *VDAudioFilterSeekProc )(const VDAudioFilterContext *pContext, sint64 microsecs);
+typedef uint32 (VDAPIENTRY *VDAudioFilterPrepareProc )(const VDAudioFilterContext *pContext);
+typedef void (VDAPIENTRY *VDAudioFilterStartProc )(const VDAudioFilterContext *pContext);
+typedef void (VDAPIENTRY *VDAudioFilterStopProc )(const VDAudioFilterContext *pContext);
+typedef void (VDAPIENTRY *VDAudioFilterInitProc )(const VDAudioFilterContext *pContext);
+typedef void (VDAPIENTRY *VDAudioFilterDestroyProc )(const VDAudioFilterContext *pContext);
+typedef unsigned (VDAPIENTRY *VDAudioFilterSuspendProc )(const VDAudioFilterContext *pContext, void *dst, unsigned size);
+typedef void (VDAPIENTRY *VDAudioFilterResumeProc )(const VDAudioFilterContext *pContext, const void *src, unsigned size);
+typedef unsigned (VDAPIENTRY *VDAudioFilterGetParamProc )(const VDAudioFilterContext *pContext, unsigned idx, void *dst, unsigned size);
+typedef void (VDAPIENTRY *VDAudioFilterSetParamProc )(const VDAudioFilterContext *pContext, unsigned idx, const void *src, unsigned variant_count);
+typedef bool (VDAPIENTRY *VDAudioFilterConfigProc )(const VDAudioFilterContext *pContext, struct HWND__ *hwnd);
+
+enum {
+ kVFAF_Zero = 0,
+ kVFAF_HasConfig = 1, // Filter has a configuration dialog.
+ kVFAF_SerializedIO = 2, // Filter must execute in the serialized I/O thread.
+
+ kVFAF_Max = 0xFFFFFFFF,
+};
+
+struct VDAudioFilterVtbl {
+ uint32 mSize;
+ VDAudioFilterDestroyProc mpDestroy;
+ VDAudioFilterPrepareProc mpPrepare;
+ VDAudioFilterStartProc mpStart;
+ VDAudioFilterStopProc mpStop;
+ VDAudioFilterRunProc mpRun;
+ VDAudioFilterSeekProc mpSeek;
+ VDAudioFilterSuspendProc mpSuspend;
+ VDAudioFilterResumeProc mpResume;
+ VDAudioFilterGetParamProc mpGetParam;
+ VDAudioFilterSetParamProc mpSetParam;
+ VDAudioFilterConfigProc mpConfig;
+ VDAudioFilterExtProc mpExt;
+};
+
+struct VDAudioFilterDefinition {
+ uint32 mSize; // size of this structure in bytes
+ uint32 mFlags;
+
+ uint32 mFilterDataSize;
+ uint32 mInputPins;
+ uint32 mOutputPins;
+
+ const VDXPluginConfigEntry *mpConfigInfo;
+
+ VDAudioFilterInitProc mpInit;
+ const VDAudioFilterVtbl *mpVtbl;
+};
+
+#endif
diff --git a/include/vd2/plugin/vdinputdriver.h b/include/vd2/plugin/vdinputdriver.h new file mode 100644 index 000000000..b75738c98 --- /dev/null +++ b/include/vd2/plugin/vdinputdriver.h @@ -0,0 +1,284 @@ +// VirtualDub - Video processing and capture application
+// Plugin headers
+// Copyright (C) 1998-2007 Avery Lee, All Rights Reserved.
+//
+// The plugin headers in the VirtualDub plugin SDK are licensed differently
+// differently than VirtualDub and the Plugin SDK themselves. This
+// particular file is thus licensed as follows (the "zlib" license):
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any
+// damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must
+// not claim that you wrote the original software. If you use this
+// software in a product, an acknowledgment in the product
+// documentation would be appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must
+// not be misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
+
+#ifndef f_VD2_PLUGIN_VDINPUTDRIVER_H
+#define f_VD2_PLUGIN_VDINPUTDRIVER_H
+
+#ifdef _MSC_VER
+ #pragma once
+ #pragma pack(push, 8)
+#endif
+
+#include "vdplugin.h"
+
+/// Unsigned 32-bit fraction.
+struct VDXFraction {
+ uint32 mNumerator;
+ uint32 mDenominator;
+};
+
+typedef struct VDXHWNDStruct *VDXHWND;
+typedef struct VDXBITMAPINFOHEADERStruct {
+ enum { kCompressionRGB = 0 };
+ uint32 mSize;
+ sint32 mWidth;
+ sint32 mHeight;
+ uint16 mPlanes;
+ uint16 mBitCount;
+ uint32 mCompression;
+ uint32 mSizeImage;
+ sint32 mXPelsPerMeter;
+ sint32 mYPelsPerMeter;
+ uint32 mClrUsed;
+ uint32 mClrImportant;
+} VDXBITMAPINFOHEADER;
+
+typedef struct VDXWAVEFORMATEXStruct {
+ enum { kFormatPCM = 1 };
+ uint16 mFormatTag;
+ uint16 mChannels;
+ uint32 mSamplesPerSec;
+ uint32 mAvgBytesPerSec;
+ uint16 mBlockAlign;
+ uint16 mBitsPerSample;
+ uint16 mExtraSize;
+} VDXWAVEFORMATEX;
+
+struct VDXStreamSourceInfo {
+ VDXFraction mSampleRate;
+ sint64 mSampleCount;
+ VDXFraction mPixelAspectRatio;
+};
+
+// V3+ (1.7.X) only
+struct VDXStreamSourceInfoV3 {
+ VDXStreamSourceInfo mInfo;
+
+ enum {
+ kFlagVariableSizeSamples = 0x00000001
+ };
+
+ uint32 mFlags;
+ uint32 mfccHandler; ///< If non-zero, specifies the FOURCC of a codec handler that should be preferred.
+};
+
+class IVDXStreamSource : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 's', 't', 's') };
+
+ virtual void VDXAPIENTRY GetStreamSourceInfo(VDXStreamSourceInfo&) = 0;
+
+ virtual bool VDXAPIENTRY Read(sint64 lStart, uint32 lCount, void *lpBuffer, uint32 cbBuffer, uint32 *lBytesRead, uint32 *lSamplesRead) = 0;
+
+ virtual const void * VDXAPIENTRY GetDirectFormat() = 0;
+ virtual int VDXAPIENTRY GetDirectFormatLen() = 0;
+
+ enum ErrorMode {
+ kErrorModeReportAll = 0,
+ kErrorModeConceal,
+ kErrorModeDecodeAnyway,
+ kErrorModeCount
+ };
+
+ virtual ErrorMode VDXAPIENTRY GetDecodeErrorMode() = 0;
+ virtual void VDXAPIENTRY SetDecodeErrorMode(ErrorMode mode) = 0;
+ virtual bool VDXAPIENTRY IsDecodeErrorModeSupported(ErrorMode mode) = 0;
+
+ virtual bool VDXAPIENTRY IsVBR() = 0;
+ virtual sint64 VDXAPIENTRY TimeToPositionVBR(sint64 us) = 0;
+ virtual sint64 VDXAPIENTRY PositionToTimeVBR(sint64 samples) = 0;
+};
+
+// V3+ (1.7.X)
+class IVDXStreamSourceV3 : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 's', 't', '2') };
+
+ virtual void VDXAPIENTRY GetStreamSourceInfoV3(VDXStreamSourceInfoV3&) = 0;
+};
+
+class IVDXVideoDecoderModel : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'v', 'd', 'm') };
+
+ virtual void VDXAPIENTRY Reset() = 0;
+ virtual void VDXAPIENTRY SetDesiredFrame(sint64 frame_num) = 0;
+ virtual sint64 VDXAPIENTRY GetNextRequiredSample(bool& is_preroll) = 0;
+ virtual int VDXAPIENTRY GetRequiredCount() = 0;
+};
+
+class IVDXVideoDecoder : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'v', 'd', 'e') };
+
+ virtual const void * VDXAPIENTRY DecodeFrame(const void *inputBuffer, uint32 data_len, bool is_preroll, sint64 sampleNumber, sint64 targetFrame) = 0;
+ virtual uint32 VDXAPIENTRY GetDecodePadding() = 0;
+ virtual void VDXAPIENTRY Reset() = 0;
+ virtual bool VDXAPIENTRY IsFrameBufferValid() = 0;
+ virtual const VDXPixmap& VDXAPIENTRY GetFrameBuffer() = 0;
+ virtual bool VDXAPIENTRY SetTargetFormat(int format, bool useDIBAlignment) = 0;
+ virtual bool VDXAPIENTRY SetDecompressedFormat(const VDXBITMAPINFOHEADER *pbih) = 0;
+
+ virtual bool VDXAPIENTRY IsDecodable(sint64 sample_num) = 0;
+ virtual const void * VDXAPIENTRY GetFrameBufferBase() = 0;
+};
+
+enum VDXVideoFrameType {
+ kVDXVFT_Independent,
+ kVDXVFT_Predicted,
+ kVDXVFT_Bidirectional,
+ kVDXVFT_Null,
+};
+
+struct VDXVideoFrameInfo {
+ char mTypeChar;
+ uint8 mFrameType;
+ sint64 mBytePosition;
+};
+
+struct VDXVideoSourceInfo {
+ enum DecoderModel {
+ kDecoderModelCustom, ///< A custom decoder model is provided.
+ kDecoderModelDefaultIP ///< Use the default I/P decoder model.
+ };
+
+ enum Flags {
+ kFlagNone = 0,
+ kFlagKeyframeOnly = 0x00000001,
+ kFlagAll = 0xFFFFFFFF
+ };
+
+public:
+ uint32 mFlags;
+ uint32 mWidth;
+ uint32 mHeight;
+ uint8 mDecoderModel;
+ uint8 unused[3];
+};
+
+class IVDXVideoSource : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'v', 'd', 's') };
+
+ virtual void VDXAPIENTRY GetVideoSourceInfo(VDXVideoSourceInfo& info) = 0;
+
+ virtual bool VDXAPIENTRY CreateVideoDecoderModel(IVDXVideoDecoderModel **) = 0;
+ virtual bool VDXAPIENTRY CreateVideoDecoder(IVDXVideoDecoder **) = 0;
+
+ virtual void VDXAPIENTRY GetSampleInfo(sint64 sample_num, VDXVideoFrameInfo& frameInfo) = 0;
+
+ virtual bool VDXAPIENTRY IsKey(sint64 sample_num) = 0;
+
+ virtual sint64 VDXAPIENTRY GetFrameNumberForSample(sint64 sample_num) = 0;
+ virtual sint64 VDXAPIENTRY GetSampleNumberForFrame(sint64 frame_num) = 0;
+ virtual sint64 VDXAPIENTRY GetRealFrame(sint64 frame_num) = 0;
+
+ virtual sint64 VDXAPIENTRY GetSampleBytePosition(sint64 sample_num) = 0;
+};
+
+struct VDXAudioSourceInfo {
+public:
+ uint32 mFlags;
+};
+
+class IVDXAudioSource : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'a', 'd', 's') };
+
+ virtual void VDXAPIENTRY GetAudioSourceInfo(VDXAudioSourceInfo& info) = 0;
+};
+
+class IVDXInputOptions : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'i', 'o', 'p') };
+
+ virtual uint32 VDXAPIENTRY Write(void *buf, uint32 buflen) = 0;
+};
+
+class IVDXInputFile : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'i', 'f', 'l') };
+
+ virtual bool VDXAPIENTRY PromptForOptions(VDXHWND, IVDXInputOptions **ppOptions) = 0;
+ virtual bool VDXAPIENTRY CreateOptions(const void *buf, uint32 len, IVDXInputOptions **ppOptions) = 0;
+
+ virtual void VDXAPIENTRY Init(const wchar_t *path, IVDXInputOptions *options) = 0;
+ virtual bool VDXAPIENTRY Append(const wchar_t *path) = 0;
+
+ virtual void VDXAPIENTRY DisplayInfo(VDXHWND hwndParent) = 0;
+
+ virtual bool VDXAPIENTRY GetVideoSource(int index, IVDXVideoSource **ppVS) = 0;
+ virtual bool VDXAPIENTRY GetAudioSource(int index, IVDXAudioSource **ppAS) = 0;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// IVDXInputFileDriver
+//
+class IVDXInputFileDriver : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'i', 'f', 'd') };
+
+ virtual int VDXAPIENTRY DetectBySignature(const void *pHeader, sint32 nHeaderSize, const void *pFooter, sint32 nFooterSize, sint64 nFileSize) = 0;
+ virtual bool VDXAPIENTRY CreateInputFile(uint32 flags, IVDXInputFile **ppFile) = 0;
+};
+
+struct VDXInputDriverContext {
+ uint32 mAPIVersion;
+ IVDPluginCallbacks *mpCallbacks;
+};
+
+typedef bool (VDXAPIENTRY *VDXInputDriverCreateProc)(const VDXInputDriverContext *pContext, IVDXInputFileDriver **);
+
+struct VDXInputDriverDefinition {
+ enum {
+ kFlagNone = 0x00000000,
+ kFlagSupportsVideo = 0x00000001,
+ kFlagSupportsAudio = 0x00000002,
+ kFlagCustomSignature = 0x00010000,
+ kFlagAll = 0xFFFFFFFF
+ };
+ uint32 mSize; // size of this structure in bytes
+ uint32 mFlags;
+ sint32 mPriority;
+ uint32 mSignatureLength;
+ const void *mpSignature;
+ const wchar_t *mpFilenameDetectPattern;
+ const wchar_t *mpFilenamePattern;
+ const wchar_t *mpDriverTagName;
+
+ VDXInputDriverCreateProc mpCreate;
+};
+
+enum {
+ // V1 (1.7.4.28204): Initial version
+ // V2 (1.7.5): Default I/P frame model fixed.
+ kVDXPlugin_InputDriverAPIVersion = 2
+};
+
+#ifdef _MSC_VER
+ #pragma pack(pop)
+#endif
+
+#endif
diff --git a/include/vd2/plugin/vdplugin.h b/include/vd2/plugin/vdplugin.h new file mode 100644 index 000000000..cec344d37 --- /dev/null +++ b/include/vd2/plugin/vdplugin.h @@ -0,0 +1,206 @@ +// VirtualDub - Video processing and capture application
+// Plugin headers
+// Copyright (C) 1998-2007 Avery Lee, All Rights Reserved.
+//
+// The plugin headers in the VirtualDub plugin SDK are licensed differently
+// differently than VirtualDub and the Plugin SDK themselves. This
+// particular file is thus licensed as follows (the "zlib" license):
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any
+// damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must
+// not claim that you wrote the original software. If you use this
+// software in a product, an acknowledgment in the product
+// documentation would be appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must
+// not be misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
+
+#ifndef f_VD2_PLUGIN_VDPLUGIN_H
+#define f_VD2_PLUGIN_VDPLUGIN_H
+
+#ifdef _MSC_VER
+ #pragma once
+ #pragma pack(push, 8)
+#endif
+
+#include <stddef.h>
+
+// Copied from <vd2/system/vdtypes.h>. Must be in sync.
+#ifndef VD_STANDARD_TYPES_DECLARED
+ #if defined(_MSC_VER)
+ typedef signed __int64 sint64;
+ typedef unsigned __int64 uint64;
+ #elif defined(__GNUC__)
+ typedef signed long long sint64;
+ typedef unsigned long long uint64;
+ #endif
+ typedef signed int sint32;
+ typedef unsigned int uint32;
+ typedef signed short sint16;
+ typedef unsigned short uint16;
+ typedef signed char sint8;
+ typedef unsigned char uint8;
+
+ typedef sint64 int64;
+ typedef sint32 int32;
+ typedef sint16 int16;
+ typedef sint8 int8;
+
+ typedef ptrdiff_t sintptr;
+ typedef size_t uintptr;
+#endif
+
+#ifndef VDXAPIENTRY
+ #define VDXAPIENTRY __stdcall
+#endif
+
+#ifndef VDXAPIENTRYV
+ #define VDXAPIENTRYV __cdecl
+#endif
+
+enum VDXCPUFeatureFlags {
+ kVDXCPUF_CPUID = 0x00000001,
+ kVDXCPUF_MMX = 0x00000004,
+ kVDXCPUF_ISSE = 0x00000008,
+ kVDXCPUF_SSE = 0x00000010,
+ kVDXCPUF_SSE2 = 0x00000020,
+ kVDXCPUF_3DNOW = 0x00000040,
+ kVDXCPUF_3DNOW_EXT = 0x00000080,
+ kVDXCPUF_SSE3 = 0x00000100,
+ kVDXCPUF_SSSE3 = 0x00000200
+};
+
+enum {
+ kVDXPlugin_APIVersion = 10
+};
+
+
+enum {
+ kVDXPluginType_Video, // Updated video filter API is not yet complete.
+ kVDXPluginType_Audio,
+ kVDXPluginType_Input
+};
+
+struct VDXPluginInfo {
+ uint32 mSize; // size of this structure in bytes
+ const wchar_t *mpName;
+ const wchar_t *mpAuthor;
+ const wchar_t *mpDescription;
+ uint32 mVersion; // (major<<24) + (minor<<16) + build. 1.4.1000 would be 0x010403E8.
+ uint32 mType;
+ uint32 mFlags;
+ uint32 mAPIVersionRequired;
+ uint32 mAPIVersionUsed;
+ uint32 mTypeAPIVersionRequired;
+ uint32 mTypeAPIVersionUsed;
+ const void * mpTypeSpecificInfo;
+};
+
+typedef const VDXPluginInfo *const *(VDXAPIENTRY *tpVDXGetPluginInfo)();
+
+typedef VDXPluginInfo VDPluginInfo;
+typedef tpVDXGetPluginInfo tpVDPluginInfo;
+
+class IVDXPluginCallbacks {
+public:
+ virtual void * VDXAPIENTRY GetExtendedAPI(const char *pExtendedAPIName) = 0;
+ virtual void VDXAPIENTRYV SetError(const char *format, ...) = 0;
+ virtual void VDXAPIENTRY SetErrorOutOfMemory() = 0;
+ virtual uint32 VDXAPIENTRY GetCPUFeatureFlags() = 0;
+};
+
+typedef IVDXPluginCallbacks IVDPluginCallbacks;
+
+struct VDXPluginConfigEntry {
+ enum Type {
+ kTypeInvalid = 0,
+ kTypeU32 = 1,
+ kTypeS32,
+ kTypeU64,
+ kTypeS64,
+ kTypeDouble,
+ kTypeAStr,
+ kTypeWStr,
+ kTypeBlock
+ };
+
+ const VDXPluginConfigEntry *next;
+
+ unsigned idx;
+ uint32 type;
+ const wchar_t *name;
+ const wchar_t *label;
+ const wchar_t *desc;
+};
+
+struct VDXPixmap {
+ void *data;
+ const uint32 *palette;
+ sint32 w;
+ sint32 h;
+ ptrdiff_t pitch;
+ sint32 format;
+
+ // Auxiliary planes are always byte-per-pixel.
+ void *data2; // Cb (U) for YCbCr
+ ptrdiff_t pitch2;
+ void *data3; // Cr (V) for YCbCr
+ ptrdiff_t pitch3;
+};
+
+struct VDXPixmapLayout {
+ ptrdiff_t data;
+ const uint32 *palette;
+ sint32 w;
+ sint32 h;
+ ptrdiff_t pitch;
+ sint32 format;
+
+ // Auxiliary planes are always byte-per-pixel.
+ ptrdiff_t data2; // Cb (U) for YCbCr
+ ptrdiff_t pitch2;
+ ptrdiff_t data3; // Cr (V) for YCbCr
+ ptrdiff_t pitch3;
+};
+
+namespace nsVDXPixmap {
+ enum VDXPixmapFormat {
+ kPixFormat_Null = 0,
+ kPixFormat_XRGB1555 = 5,
+ kPixFormat_RGB565 = 6,
+ kPixFormat_RGB888 = 7,
+ kPixFormat_XRGB8888 = 8,
+ kPixFormat_Y8 = 9,
+ kPixFormat_YUV422_UYVY = 10,
+ kPixFormat_YUV422_YUYV = 11,
+ kPixFormat_YUV444_Planar = 13,
+ kPixFormat_YUV422_Planar = 14,
+ kPixFormat_YUV420_Planar = 15,
+ kPixFormat_YUV411_Planar = 16,
+ kPixFormat_YUV410_Planar = 17
+ };
+};
+
+#define VDXMAKEFOURCC(a, b, c, d) ((uint32)(uint8)(d) + ((uint32)(uint8)(c) << 8) + ((uint32)(uint8)(b) << 16) + ((uint32)(uint8)(a) << 24))
+
+class IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'u', 'n', 'k') };
+ virtual int VDXAPIENTRY AddRef() = 0;
+ virtual int VDXAPIENTRY Release() = 0;
+ virtual void *VDXAPIENTRY AsInterface(uint32 iid) = 0;
+};
+
+#ifdef _MSC_VER
+ #pragma pack(pop)
+#endif
+
+#endif
diff --git a/include/vd2/plugin/vdvideofilt.h b/include/vd2/plugin/vdvideofilt.h new file mode 100644 index 000000000..aab8e023f --- /dev/null +++ b/include/vd2/plugin/vdvideofilt.h @@ -0,0 +1,517 @@ +// VirtualDub - Video processing and capture application
+// Plugin headers
+// Copyright (C) 1998-2007 Avery Lee, All Rights Reserved.
+//
+// The plugin headers in the VirtualDub plugin SDK are licensed differently
+// differently than VirtualDub and the Plugin SDK themselves. This
+// particular file is thus licensed as follows (the "zlib" license):
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any
+// damages arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must
+// not claim that you wrote the original software. If you use this
+// software in a product, an acknowledgment in the product
+// documentation would be appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must
+// not be misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
+
+#ifndef f_VD2_PLUGIN_VDVIDEOFILT_H
+#define f_VD2_PLUGIN_VDVIDEOFILT_H
+
+#ifdef _MSC_VER
+ #pragma once
+ #pragma pack(push, 8)
+#endif
+
+#include <stddef.h>
+
+#include "vdplugin.h"
+
+typedef struct VDXHINSTANCEStruct *VDXHINSTANCE;
+typedef struct VDXHDCStruct *VDXHDC;
+typedef struct VDXHWNDStruct *VDXHWND;
+
+//////////////////
+
+struct VDXScriptObject;
+struct VDXFilterVTbls;
+
+//////////////////
+
+enum {
+ /// Request distinct source and destination buffers. Otherwise, the source and destination buffers
+ /// alias (in-place mode).
+ FILTERPARAM_SWAP_BUFFERS = 0x00000001L,
+
+ /// Request an extra buffer for the previous source frame.
+ FILTERPARAM_NEEDS_LAST = 0x00000002L,
+
+ /// Filter supports image formats other than RGB32. Filters that support format negotiation must
+ /// set this flag for all calls to paramProc.
+ FILTERPARAM_SUPPORTS_ALTFORMATS = 0x00000004L,
+
+ /// Filter requests 16 byte alignment for source and destination buffers. This guarantees that:
+ ///
+ /// - data and pitch fields are multiples of 16 bytes (aligned)
+ /// - an integral number of 16 byte vectors may be read, even if the last vector includes
+ /// some bytes beyond the end of the scanline (their values are undefined)
+ /// - an integral number of 16 byte vectors may be written, even if the last vector includes
+ /// some bytes beyong the end of the scanline (their values are ignored)
+ ///
+ FILTERPARAM_ALIGN_SCANLINES = 0x00000008L,
+
+ /// Filter's output is purely a function of configuration parameters and source image data, and not
+ /// source or output frame numbers. In other words, two output frames produced by a filter instance
+ /// can be assumed to be identical images if:
+ ///
+ /// - the same number of source frames are prefetched
+ /// - the same type of prefetches are performed (direct vs. non-direct)
+ /// - the frame numbers for the two prefetch lists, taken in order, correspond to identical
+ /// source frames
+ /// - the prefetch cookies match
+ ///
+ /// Enabling this flag improves the ability of the host to identify identical frames and drop them
+ /// in preview or in the output file.
+ ///
+ FILTERPARAM_PURE_TRANSFORM = 0x00000010L,
+
+ /// Filter cannot support the requested source format. Note that this sets all bits, so the meaning
+ /// of other bits is ignored. The one exception is that FILTERPARAM_SUPPORTS_ALTFORMATS is assumed
+ /// to be implicitly set.
+ FILTERPARAM_NOT_SUPPORTED = (long)0xFFFFFFFF
+};
+
+/// The filter has a delay from source to output. For instance, a lag of 3 indicates that the
+/// filter internally buffers three frames, so when it is fed frames in sequence, frame 0 emerges
+/// after frame 3 has been processed. The host attempts to correct timestamps in order to compensate.
+///
+/// VirtualDub 1.9.1 or later: Setting this flag can have a performance penalty, as it causes the host
+/// to request additional frames to try to produce the correct requested output frames.
+///
+#define FILTERPARAM_HAS_LAG(frames) ((int)(frames) << 16)
+
+///////////////////
+
+class VDXFBitmap;
+class VDXFilterActivation;
+struct VDXFilterFunctions;
+struct VDXFilterModule;
+class IVDXVideoPrefetcher;
+
+enum {
+ kVDXVFEvent_None = 0,
+ kVDXVFEvent_InvalidateCaches = 1
+};
+
+typedef int (__cdecl *VDXFilterInitProc )(VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+typedef void (__cdecl *VDXFilterDeinitProc )(VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+typedef int (__cdecl *VDXFilterRunProc )(const VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+typedef long (__cdecl *VDXFilterParamProc )(VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+typedef int (__cdecl *VDXFilterConfigProc )(VDXFilterActivation *fa, const VDXFilterFunctions *ff, VDXHWND hWnd);
+typedef void (__cdecl *VDXFilterStringProc )(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, char *buf);
+typedef int (__cdecl *VDXFilterStartProc )(VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+typedef int (__cdecl *VDXFilterEndProc )(VDXFilterActivation *fa, const VDXFilterFunctions *ff);
+typedef bool (__cdecl *VDXFilterScriptStrProc)(VDXFilterActivation *fa, const VDXFilterFunctions *, char *, int);
+typedef void (__cdecl *VDXFilterStringProc2 )(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, char *buf, int maxlen);
+typedef int (__cdecl *VDXFilterSerialize )(VDXFilterActivation *fa, const VDXFilterFunctions *ff, char *buf, int maxbuf);
+typedef void (__cdecl *VDXFilterDeserialize )(VDXFilterActivation *fa, const VDXFilterFunctions *ff, const char *buf, int maxbuf);
+typedef void (__cdecl *VDXFilterCopy )(VDXFilterActivation *fa, const VDXFilterFunctions *ff, void *dst);
+typedef sint64 (__cdecl *VDXFilterPrefetch )(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, sint64 frame);
+typedef void (__cdecl *VDXFilterCopy2Proc )(VDXFilterActivation *fa, const VDXFilterFunctions *ff, void *dst, VDXFilterActivation *fa2, const VDXFilterFunctions *ff2);
+typedef bool (__cdecl *VDXFilterPrefetch2Proc)(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, sint64 frame, IVDXVideoPrefetcher *prefetcher);
+typedef bool (__cdecl *VDXFilterEventProc )(const VDXFilterActivation *fa, const VDXFilterFunctions *ff, uint32 event, const void *eventData);
+
+typedef int (__cdecl *VDXFilterModuleInitProc)(VDXFilterModule *fm, const VDXFilterFunctions *ff, int& vdfd_ver, int& vdfd_compat);
+typedef void (__cdecl *VDXFilterModuleDeinitProc)(VDXFilterModule *fm, const VDXFilterFunctions *ff);
+
+//////////
+
+typedef void (__cdecl *VDXFilterPreviewButtonCallback)(bool fNewState, void *pData);
+typedef void (__cdecl *VDXFilterPreviewSampleCallback)(VDXFBitmap *, long lFrame, long lCount, void *pData);
+
+class IVDXFilterPreview {
+public:
+ virtual void SetButtonCallback(VDXFilterPreviewButtonCallback, void *)=0;
+ virtual void SetSampleCallback(VDXFilterPreviewSampleCallback, void *)=0;
+
+ virtual bool isPreviewEnabled()=0;
+ virtual void Toggle(VDXHWND)=0;
+ virtual void Display(VDXHWND, bool)=0;
+ virtual void RedoFrame()=0;
+ virtual void RedoSystem()=0;
+ virtual void UndoSystem()=0;
+ virtual void InitButton(VDXHWND)=0;
+ virtual void Close()=0;
+ virtual bool SampleCurrentFrame()=0;
+ virtual long SampleFrames()=0;
+};
+
+class IVDXFilterPreview2 : public IVDXFilterPreview {
+public:
+ virtual bool IsPreviewDisplayed() = 0;
+};
+
+class IVDXVideoPrefetcher : public IVDXUnknown {
+public:
+ enum { kIID = VDXMAKEFOURCC('X', 'v', 'p', 'f') };
+
+ /// Request a video frame fetch from an upstream source.
+ virtual void VDXAPIENTRY PrefetchFrame(sint32 srcIndex, sint64 frame, uint64 cookie) = 0;
+
+ /// Request a video frame fetch from an upstream source in direct mode.
+ /// This specifies that the output frame is the same as the input frame.
+ /// There cannot be more than one direct fetch and there must be no standard
+ /// fetches at the same time. There can, however, be symbolic fetches.
+ virtual void VDXAPIENTRY PrefetchFrameDirect(sint32 srcIndex, sint64 frame) = 0;
+
+ /// Request a symbolic fetch from a source. This does not actually fetch
+ /// any frames, but marks an association from source to output. This is
+ /// useful for indicating the approximate center of where an output derives
+ /// in a source, even if those frames aren't fetched (perhaps due to caching).
+ /// There may be either zero or one symbolic fetch per source.
+ ///
+ /// If no symbolic fetches are performed, the symbolic frame is assumed to
+ /// be the rounded mean of the fetched source frames.
+ virtual void VDXAPIENTRY PrefetchFrameSymbolic(sint32 srcIndex, sint64 frame) = 0;
+};
+
+//////////
+
+enum {
+ // This is the highest API version supported by this header file.
+ VIRTUALDUB_FILTERDEF_VERSION = 14,
+
+ // This is the absolute lowest API version supported by this header file.
+ // Note that V4 is rather old, corresponding to VirtualDub 1.2.
+ // Chances are you will need to declare a higher version.
+ VIRTUALDUB_FILTERDEF_COMPATIBLE = 4,
+
+ // API V9 is a slightly saner baseline, since it is the first API
+ // version that has copy constructor support. You may still need to
+ // declare a higher vdfd_compat version in your module init if you
+ // need features beyond V9 (VirtualDub 1.4.12).
+ VIRTUALDUB_FILTERDEF_COMPATIBLE_COPYCTOR = 9
+
+};
+
+// v3: added lCurrentSourceFrame to FrameStateInfo
+// v4 (1.2): lots of additions (VirtualDub 1.2)
+// v5 (1.3d): lots of bugfixes - stretchblt bilinear, and non-zero startproc
+// v6 (1.4): added error handling functions
+// v7 (1.4d): added frame lag, exception handling
+// v8 (1.4.11): added string2 proc
+// v9 (1.4.12): added (working) copy constructor
+// v10 (1.5.10): added preview flag
+// v11 (1.7.0): guaranteed src structure setup before configProc; added IVDFilterPreview2
+// v12 (1.8.0): support for frame alteration
+// v13 (1.8.2): added mOutputFrame field to VDXFilterStateInfo
+// v14 (1.9.1): added copyProc2, prefetchProc2, input/output frame arrays
+
+struct VDXFilterDefinition {
+ void *_next; // deprecated - set to NULL
+ void *_prev; // deprecated - set to NULL
+ void *_module; // deprecated - set to NULL
+
+ const char * name;
+ const char * desc;
+ const char * maker;
+ void * private_data;
+ int inst_data_size;
+
+ VDXFilterInitProc initProc;
+ VDXFilterDeinitProc deinitProc;
+ VDXFilterRunProc runProc;
+ VDXFilterParamProc paramProc;
+ VDXFilterConfigProc configProc;
+ VDXFilterStringProc stringProc;
+ VDXFilterStartProc startProc;
+ VDXFilterEndProc endProc;
+
+ VDXScriptObject *script_obj;
+
+ VDXFilterScriptStrProc fssProc;
+
+ // NEW - 1.4.11
+ VDXFilterStringProc2 stringProc2;
+ VDXFilterSerialize serializeProc;
+ VDXFilterDeserialize deserializeProc;
+ VDXFilterCopy copyProc;
+
+ VDXFilterPrefetch prefetchProc; // (V12/V1.7.4+)
+
+ // NEW - V14 / 1.9.1
+ VDXFilterCopy2Proc copyProc2;
+ VDXFilterPrefetch2Proc prefetchProc2;
+ VDXFilterEventProc eventProc;
+};
+
+//////////
+
+// FilterStateInfo: contains dynamic info about file being processed
+
+class VDXFilterStateInfo {
+public:
+ sint32 lCurrentFrame; // current sequence frame (previously called output frame)
+ sint32 lMicrosecsPerFrame; // microseconds per sequence frame
+ sint32 lCurrentSourceFrame; // current source frame
+ sint32 lMicrosecsPerSrcFrame; // microseconds per source frame
+ sint32 lSourceFrameMS; // source frame timestamp
+ sint32 lDestFrameMS; // output frame timestamp
+
+ enum {
+ kStateNone = 0x00000000,
+ kStatePreview = 0x00000001, // (V1.5.10+) Job output is not being saved to disk.
+ kStateRealTime = 0x00000002, // (V1.5.10+) Operation is running in real-time (capture, playback).
+ kStateMax = 0xFFFFFFFF
+ };
+
+ uint32 flags; // (V10 / 1.5.10+ only)
+
+ sint32 mOutputFrame; // (V13/V1.8.2+) current output frame
+};
+
+// VDXFBitmap: VBitmap extended to hold filter-specific information
+
+class VDXBitmap {
+public:
+ void * _vtable; // Reserved - do not use.
+ uint32 * data; // Pointer to start of _bottom-most_ scanline of plane 0.
+ uint32 * palette; // Pointer to palette (reserved - set to NULL).
+ sint32 depth; // Bit depth, in bits. Set to zero if mpPixmap/mpPixmapLayout are active.
+ sint32 w; // Width of bitmap, in pixels.
+ sint32 h; // Height of bitmap, in pixels.
+ ptrdiff_t pitch; // Distance, in bytes, from the start of one scanline in plane 0 to the next.
+ ptrdiff_t modulo; // Distance, in bytes, from the end of one scanline in plane 0 to the start of the next.
+ ptrdiff_t size; // Size of plane 0, including padding.
+ ptrdiff_t offset; // Offset from beginning of buffer to beginning of plane 0.
+
+ uint32 *Address32(int x, int y) const {
+ return Address32i(x, h-y-1);
+ }
+
+ uint32 *Address32i(int x, int y) const {
+ return (uint32 *)((char *)data + y*pitch + x*4);
+ }
+
+ void AlignTo4() {
+ pitch = w << 2;
+ }
+
+ void AlignTo8() {
+ pitch = ((w+1)&~1) << 2;
+ }
+};
+
+class VDXFBitmap : public VDXBitmap {
+public:
+ enum {
+ /// Set in paramProc if the filter requires a Win32 GDI display context
+ /// for a bitmap. (Deprecated as of API V12 - do not use)
+ NEEDS_HDC = 0x00000001L,
+ };
+
+ uint32 dwFlags;
+ VDXHDC hdc;
+
+ uint32 mFrameRateHi; // Frame rate numerator (V1.7.4+)
+ uint32 mFrameRateLo; // Frame rate denominator (V1.7.4+)
+ sint64 mFrameCount; // Frame count; -1 if unlimited or indeterminate (V1.7.4+)
+
+ VDXPixmapLayout *mpPixmapLayout;
+ const VDXPixmap *mpPixmap;
+
+ uint32 mAspectRatioHi; ///< Pixel aspect ratio fraction (numerator). 0/0 = unknown
+ uint32 mAspectRatioLo; ///< Pixel aspect ratio fraction (denominator).
+
+ sint64 mFrameNumber; ///< Current frame number (zero based).
+ sint64 mFrameTimestampStart; ///< Starting timestamp of frame, in 100ns units.
+ sint64 mFrameTimestampEnd; ///< Ending timestamp of frame, in 100ns units.
+ sint64 mCookie; ///< Cookie supplied when frame was requested.
+};
+
+// VDXFilterActivation: This is what is actually passed to filters at runtime.
+
+class VDXFilterActivation {
+public:
+ const VDXFilterDefinition *filter; //
+ void *filter_data;
+ VDXFBitmap& dst;
+ VDXFBitmap& src;
+ VDXFBitmap *_reserved0;
+ VDXFBitmap *const last;
+ uint32 x1;
+ uint32 y1;
+ uint32 x2;
+ uint32 y2;
+
+ VDXFilterStateInfo *pfsi;
+ IVDXFilterPreview *ifp;
+ IVDXFilterPreview2 *ifp2; // (V11+)
+
+ uint32 mSourceFrameCount; // (V14+)
+ VDXFBitmap *const *mpSourceFrames; // (V14+)
+ VDXFBitmap *const *mpOutputFrames; // (V14+)
+};
+
+// These flags must match those in cpuaccel.h!
+
+#ifndef f_VIRTUALDUB_CPUACCEL_H
+#define CPUF_SUPPORTS_CPUID (0x00000001L)
+#define CPUF_SUPPORTS_FPU (0x00000002L)
+#define CPUF_SUPPORTS_MMX (0x00000004L)
+#define CPUF_SUPPORTS_INTEGER_SSE (0x00000008L)
+#define CPUF_SUPPORTS_SSE (0x00000010L)
+#define CPUF_SUPPORTS_SSE2 (0x00000020L)
+#define CPUF_SUPPORTS_3DNOW (0x00000040L)
+#define CPUF_SUPPORTS_3DNOW_EXT (0x00000080L)
+#endif
+
+struct VDXFilterFunctions {
+ VDXFilterDefinition *(__cdecl *addFilter)(VDXFilterModule *, VDXFilterDefinition *, int fd_len);
+ void (__cdecl *removeFilter)(VDXFilterDefinition *);
+ bool (__cdecl *isFPUEnabled)();
+ bool (__cdecl *isMMXEnabled)();
+ void (__cdecl *InitVTables)(VDXFilterVTbls *);
+
+ // These functions permit you to throw MyError exceptions from a filter.
+ // YOU MUST ONLY CALL THESE IN runProc, initProc, and startProc.
+
+ void (__cdecl *ExceptOutOfMemory)(); // ADDED: V6 (VirtualDub 1.4)
+ void (__cdecl *Except)(const char *format, ...); // ADDED: V6 (VirtualDub 1.4)
+
+ // These functions are callable at any time.
+
+ long (__cdecl *getCPUFlags)(); // ADDED: V6 (VirtualDub 1.4)
+ long (__cdecl *getHostVersionInfo)(char *buffer, int len); // ADDED: V7 (VirtualDub 1.4d)
+};
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////
+
+class VDXScriptValue;
+class VDXScriptError;
+struct VDXScriptObject;
+
+class VDXScriptError {
+public:
+ enum {
+ PARSE_ERROR=1,
+ SEMICOLON_EXPECTED,
+ IDENTIFIER_EXPECTED,
+
+ TYPE_INT_REQUIRED,
+ TYPE_ARRAY_REQUIRED,
+ TYPE_FUNCTION_REQUIRED,
+ TYPE_OBJECT_REQUIRED,
+
+ OBJECT_MEMBER_NAME_REQUIRED,
+ FUNCCALLEND_EXPECTED,
+ TOO_MANY_PARAMS,
+ DIVIDE_BY_ZERO,
+ VAR_NOT_FOUND,
+ MEMBER_NOT_FOUND,
+ OVERLOADED_FUNCTION_NOT_FOUND,
+ IDENT_TOO_LONG,
+ OPERATOR_EXPECTED,
+ CLOSEPARENS_EXPECTED,
+ CLOSEBRACKET_EXPECTED,
+
+ VAR_UNDEFINED,
+
+ OUT_OF_STRING_SPACE,
+ OUT_OF_MEMORY,
+ INTERNAL_ERROR,
+ EXTERNAL_ERROR,
+
+ FCALL_OUT_OF_RANGE,
+ FCALL_INVALID_PTYPE,
+ FCALL_UNKNOWN_STR,
+
+ ARRAY_INDEX_OUT_OF_BOUNDS,
+
+ NUMERIC_OVERFLOW,
+ STRING_NOT_AN_INTEGER_VALUE,
+ STRING_NOT_A_REAL_VALUE,
+
+ ASSERTION_FAILED,
+ AMBIGUOUS_CALL,
+ CANNOT_CAST
+ };
+};
+
+class IVDXScriptInterpreter {
+public:
+ virtual void _placeholder1() {}
+ virtual void _placeholder2(void *, void *) {}
+ virtual void _placeholder3(char *s) {}
+
+ virtual void ScriptError(int e)=0;
+ virtual void _placeholder4(VDXScriptError& cse) {}
+ virtual char** AllocTempString(long l)=0;
+
+ virtual void _placeholder5() {}
+};
+
+#define EXT_SCRIPT_ERROR(x) (isi->ScriptError((VDXScriptError::x)))
+
+typedef VDXScriptValue (*VDXScriptFunctionPtr)(IVDXScriptInterpreter *, void *, const VDXScriptValue *, int);
+typedef void (*VDXScriptVoidFunctionPtr)(IVDXScriptInterpreter *, void *, const VDXScriptValue *, int);
+typedef int (*VDXScriptIntFunctionPtr)(IVDXScriptInterpreter *, void *, const VDXScriptValue *, int);
+
+struct VDXScriptFunctionDef {
+ VDXScriptFunctionPtr func_ptr;
+ char *name;
+ char *arg_list;
+};
+
+struct VDXScriptObject {
+ void *_lookup; // reserved - set to NULL
+ VDXScriptFunctionDef *func_list;
+ void *_obj_list; // reserved - set to NULL
+};
+
+class VDXScriptValue {
+public:
+ enum { T_VOID, T_INT, T_PINT, T_STR, T_ARRAY, T_OBJECT, T_FNAME, T_FUNCTION, T_VARLV, T_LONG, T_DOUBLE } type;
+ VDXScriptObject *thisPtr;
+ union {
+ int i;
+ char **s;
+ sint64 l;
+ double d;
+ } u;
+
+ VDXScriptValue() { type = T_VOID; }
+ VDXScriptValue(int i) { type = T_INT; u.i = i; }
+ VDXScriptValue(sint64 l) { type = T_LONG; u.l = l; }
+ VDXScriptValue(double d) { type = T_DOUBLE; u.d = d; }
+ VDXScriptValue(char **s) { type = T_STR; u.s = s; }
+
+ bool isVoid() const { return type == T_VOID; }
+ bool isInt() const { return type == T_INT; }
+ bool isString() const { return type == T_STR; }
+ bool isLong() const { return type == T_LONG; }
+ bool isDouble() const { return type == T_DOUBLE; }
+
+ int asInt() const { return u.i; }
+ sint64 asLong() const { return u.l; }
+ double asDouble() const { return u.d; }
+ char ** asString() const { return u.s; }
+};
+
+#ifdef _MSC_VER
+ #pragma pack(pop)
+#endif
+
+#endif
diff --git a/include/vd2/plugin/vdvideoutil.h b/include/vd2/plugin/vdvideoutil.h new file mode 100644 index 000000000..8379e4f7d --- /dev/null +++ b/include/vd2/plugin/vdvideoutil.h @@ -0,0 +1,121 @@ +#ifndef f_VD2_PLUGIN_VDVIDEOUTIL_H
+#define f_VD2_PLUGIN_VDVIDEOUTIL_H
+
+template<class T>
+T *vd_ptroffset(T *p, ptrdiff_t diff) {
+ return (T *)((char *)p + diff);
+}
+
+template<class T>
+class vd_row_iter {
+public:
+ vd_row_iter() {}
+ vd_row_iter(T *p, ptrdiff_t pitch) : mp(p), mpitch(pitch) {}
+ vd_row_iter(T *p, ptrdiff_t pitch, int y) : mp(vd_ptroffset(p, pitch*y)), mpitch(pitch) {}
+
+ vd_row_iter(const VFBitmap& bm, int x = 0, int y = 0) : mp(vd_ptroffset((T*)bm.data, bm.pitch*(bm.h - 1 - y))+x), mpitch(-bm.pitch) {}
+
+ operator T*() const { return mp; }
+ T& operator[](int x) const { return mp[x]; }
+
+ void mulstep(int x) {
+ mpitch *= x;
+ }
+
+ const vd_row_iter<T>& operator+=(int y) {
+ mp = vd_ptroffset(mp, mpitch * y);
+ return *this;
+ }
+
+ const vd_row_iter<T>& operator-=(int y) {
+ mp = vd_ptroffset(mp, -(mpitch * y));
+ return *this;
+ }
+
+ const vd_row_iter<T>& operator++() {
+ mp = vd_ptroffset(mp, mpitch);
+ return *this;
+ }
+
+ const vd_row_iter<T> operator++(int) {
+ const vd_row_iter<T> temp(*this);
+ mp = vd_ptroffset(mp, mpitch);
+ return temp;
+ }
+
+ const vd_row_iter<T>& operator--() {
+ mp = vd_ptroffset(mp, -mpitch);
+ return *this;
+ }
+
+ const vd_row_iter<T> operator--(int) {
+ const vd_row_iter<T> temp(*this);
+ mp = vd_ptroffset(mp, -mpitch);
+ return temp;
+ }
+
+protected:
+ T *mp;
+ ptrdiff_t mpitch;
+};
+
+typedef vd_row_iter<uint32> vd_pixrow_iter;
+
+inline uint32 vd_pixavg_down(uint32 x, uint32 y) {
+ return (x&y) + (((x^y)&0xfefefefe)>>1);
+}
+
+inline uint32 vd_pixavg_up(uint32 x, uint32 y) {
+ return (x|y) - (((x^y)&0xfefefefe)>>1);
+}
+
+inline void vd_pixunpack(uint32 px, int& r, int& g, int& b) {
+ r = (px>>16)&255;
+ g = (px>> 8)&255;
+ b = (px )&255;
+}
+
+inline uint32 vd_pixpack(int r, int g, int b) {
+ if ((unsigned)r >= 256) r = ~(r>>31) & 255;
+ if ((unsigned)g >= 256) g = ~(g>>31) & 255;
+ if ((unsigned)b >= 256) b = ~(b>>31) & 255;
+
+ return (r<<16) + (g<<8) + b;
+}
+
+inline uint32 vd_pixpackfast(int r, int g, int b) {
+ return (r<<16) + (g<<8) + b;
+}
+
+struct vd_transform_pixmap_helper {
+ vd_transform_pixmap_helper(const VFBitmap& dst)
+ : p((uint32 *)dst.data)
+ , pitch(dst.pitch)
+ , w(dst.w)
+ , h(dst.h) {}
+
+ operator bool() const { return false; }
+
+ uint32 *p;
+ const ptrdiff_t pitch;
+ const int w, h;
+};
+
+#define vd_transform_pixmap_blt(dst, src) \
+ if(vd_transform_pixmap_helper dstinfo = dst);else \
+ if(vd_transform_pixmap_helper srcinfo = src);else \
+ for(int y = 0, h = dstinfo.h, w = dstinfo.w; y < h; ++y, dstinfo.p=vd_ptroffset(dstinfo.p, dstinfo.pitch), srcinfo.p=vd_ptroffset(srcinfo.p, srcinfo.pitch)) \
+ for(int x = 0; x < dstinfo.w; ++x) \
+ switch(unsigned& out = dstinfo.p[x]) case 0: default: \
+ switch(const unsigned& in = srcinfo.p[x]) case 0: default:
+
+#define vd_transform_pixmap_inplace(dst) \
+ if(vd_transform_pixmap_helper dstinfo = dst);else \
+ for(int y = 0, h = dstinfo.h, w = dstinfo.w; y < h; ++y, dstinfo.p=vd_ptroffset(dstinfo.p, dstinfo.pitch)) \
+ for(int x = 0; x < dstinfo.w; ++x) \
+ switch(unsigned& px = dstinfo.p[x]) case 0: default: \
+
+#define vd_maketable256_16(x) formula((x+0)),formula((x+1)),formula((x+2)),formula((x+3)),formula((x+4)),formula((x+5)),formula((x+6)),formula((x+7)),formula((x+8)),formula((x+9)),formula((x+10)),formula((x+11)),formula((x+12)),formula((x+13)),formula((x+14)),formula((x+15))
+#define vd_maketable256 vd_maketable256_16(0x00),vd_maketable256_16(0x10),vd_maketable256_16(0x20),vd_maketable256_16(0x30),vd_maketable256_16(0x40),vd_maketable256_16(0x50),vd_maketable256_16(0x60),vd_maketable256_16(0x70),vd_maketable256_16(0x80),vd_maketable256_16(0x90),vd_maketable256_16(0xA0),vd_maketable256_16(0xB0),vd_maketable256_16(0xC0),vd_maketable256_16(0xD0),vd_maketable256_16(0xE0),vd_maketable256_16(0xF0),
+
+#endif
|