Skip to content

Commit

Permalink
Update AVS headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Aug 2, 2022
1 parent 82c1e06 commit cbaa2dc
Show file tree
Hide file tree
Showing 16 changed files with 304 additions and 50 deletions.
45 changes: 31 additions & 14 deletions thirdparty/32/include/avisynth/avisynth.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
// Interface Version to 8 (classic 2.6 = 6)
// 20200527 Add IScriptEnvironment_Avs25, used internally
// 20200607 AVS frame property enums to match existing Avisynth enum style
// 202112xx pre V9-MakePropertyWritable, IsPropertyWritable

// http://www.avisynth.org

Expand Down Expand Up @@ -59,8 +60,8 @@
// graphical user interfaces.


#ifndef __AVISYNTH_8_H__
#define __AVISYNTH_8_H__
#ifndef __AVISYNTH_9_H__
#define __AVISYNTH_9_H__

#include "avs/config.h"
#include "avs/capi.h"
Expand All @@ -71,6 +72,10 @@
#endif

#if defined(AVS_POSIX)
#if defined(AVS_HAIKU)
#undef __stdcall
#undef __cdecl
#endif
#define __stdcall
#define __cdecl
#endif
Expand All @@ -89,7 +94,8 @@ enum {
AVISYNTH_CLASSIC_INTERFACE_VERSION_25 = 3,
AVISYNTH_CLASSIC_INTERFACE_VERSION_26BETA = 5,
AVISYNTH_CLASSIC_INTERFACE_VERSION = 6,
AVISYNTH_INTERFACE_VERSION = 8
AVISYNTH_INTERFACE_VERSION = 9,
AVISYNTHPLUS_INTERFACE_BUGFIX_VERSION = 1 // reset to zero whenever the normal interface version bumps
};

/* Compiler-specific crap */
Expand Down Expand Up @@ -403,9 +409,12 @@ struct AVS_Linkage {
const char* (PDevice::* PDevice_GetName)() const;
// end class PDevice

// V9: VideoFrame helper
bool (VideoFrame::* IsPropertyWritable)() const;

/**********************************************************************/
// Reserve pointer space for Avisynth+
void (VideoInfo::* reserved2[64 - 23])();
void (VideoInfo::* reserved2[64 - 24])();
/**********************************************************************/

// AviSynth Neo additions
Expand All @@ -416,7 +425,7 @@ struct AVS_Linkage {
// this part should be identical with AVS_Linkage entries in interface.cpp
};

#ifdef BUILDING_AVSCORE
#if defined(BUILDING_AVSCORE) || defined(AVS_STATIC_LIB)
/* Macro resolution for code inside Avisynth.dll */
# define AVS_BakedCode(arg) ;
# define AVS_LinkCall(arg)
Expand Down Expand Up @@ -995,6 +1004,8 @@ class VideoFrame {
// 0: OK, 1: NG, -1: disabled or non CPU frame
int CheckMemory() const AVS_BakedCode(return AVS_LinkCall(VideoFrame_CheckMemory)())

bool IsPropertyWritable() const AVS_BakedCode(return AVS_LinkCall(IsPropertyWritable)())

~VideoFrame() AVS_BakedCode( AVS_LinkCall_Void(VideoFrame_DESTRUCTOR)() )
#ifdef BUILDING_AVSCORE
public:
Expand Down Expand Up @@ -1272,12 +1283,10 @@ class AVSValue {
double AsFloat2(float def) const;
const char* AsString2(const char* def) const;

#ifdef NEW_AVSVALUE
void MarkArrayAsC(); // for C interface, no deep-copy and deep-free
void CONSTRUCTOR10(const AVSValue& v, bool c_arrays);
AVSValue(const AVSValue& v, bool c_arrays);
void Assign2(const AVSValue* src, bool init, bool c_arrays);
#endif

#endif
}; // end class AVSValue
Expand Down Expand Up @@ -1352,6 +1361,9 @@ enum AvsEnvProperty
AEP_FILTERCHAIN_THREADS = 4,
AEP_THREAD_ID = 5,
AEP_VERSION = 6,
AEP_HOST_SYSTEM_ENDIANNESS = 7,
AEP_INTERFACE_VERSION = 8,
AEP_INTERFACE_BUGFIX = 9,

// Neo additionals
AEP_NUM_DEVICES = 901,
Expand Down Expand Up @@ -1523,7 +1535,10 @@ class IScriptEnvironment {
virtual AVSValue __stdcall Invoke3(const AVSValue& implicit_last, const PFunction& func, const AVSValue args, const char* const* arg_names = 0) = 0;
virtual bool __stdcall Invoke3Try(AVSValue* result, const AVSValue& implicit_last, const PFunction& func, const AVSValue args, const char* const* arg_names = 0) = 0;

}; // end class IScriptEnvironment
// V9
virtual bool __stdcall MakePropertyWritable(PVideoFrame* pvf) = 0;

}; // end class IScriptEnvironment. Order is important.

// used internally
class IScriptEnvironment_Avs25 {
Expand Down Expand Up @@ -1603,7 +1618,7 @@ class IScriptEnvironment_Avs25 {
// noThrow version of GetVar
virtual AVSValue __stdcall GetVarDef(const char* name, const AVSValue& def = AVSValue()) = 0;

}; // end class IScriptEnvironment_Avs25
}; // end class IScriptEnvironment_Avs25. Order is important.


enum MtMode
Expand Down Expand Up @@ -1674,6 +1689,7 @@ class IScriptEnvironment2 : public IScriptEnvironment{
// share the same ScriptEnvironment instance. The function with the same signature
// is exactly identical and there is no limitation to switch interfaces.
// You can use any interface you like.
// Note to plugin authors : The interface is not stable, see comments in IScriptEnvironment2
class INeoEnv {
public:
virtual ~INeoEnv() {}
Expand All @@ -1693,9 +1709,7 @@ class INeoEnv {

// Generic system to ask for various properties
virtual size_t __stdcall GetEnvProperty(AvsEnvProperty prop) = 0;
#ifdef INTEL_INTRINSICS
virtual int __stdcall GetCPUFlags() = 0;
#endif

// Plugin functions
virtual bool __stdcall LoadPlugin(const char* filePath, bool throwOnError, AVSValue *result) = 0;
Expand Down Expand Up @@ -1729,6 +1743,9 @@ class INeoEnv {
AVSValue* result, const AVSValue& implicit_last,
const PFunction& func, const AVSValue args, const char* const* arg_names = 0) = 0;

// V9
virtual bool __stdcall MakePropertyWritable(PVideoFrame* pvf) = 0;

// Throws exception when the requested variable is not found.
virtual AVSValue __stdcall GetVar(const char* name) = 0;

Expand Down Expand Up @@ -1759,7 +1776,7 @@ class INeoEnv {
virtual void __stdcall PopContextGlobal() = 0;

// Allocate new video frame
// Align parameter is no longer supported
// in PNeoEnv: align parameter is no longer supported
virtual PVideoFrame __stdcall NewVideoFrame(const VideoInfo& vi) = 0; // current device is used
virtual PVideoFrame __stdcall NewVideoFrame(const VideoInfo& vi, const PDevice& device) = 0;
// as above but with property sources
Expand Down Expand Up @@ -1858,7 +1875,7 @@ struct PNeoEnv {
INeoEnv* p;
PNeoEnv() : p() { }
PNeoEnv(IScriptEnvironment* env)
#ifdef BUILDING_AVSCORE
#if defined(BUILDING_AVSCORE) || defined(AVS_STATIC_LIB)
;
#else
: p(!AVS_linkage || offsetof(AVS_Linkage, GetNeoEnv) >= AVS_linkage->Size ? 0 : AVS_linkage->GetNeoEnv(env)) { }
Expand Down Expand Up @@ -1904,4 +1921,4 @@ AVSC_API(IScriptEnvironment2*, CreateScriptEnvironment2)(int version = AVISYNTH_

#pragma pack(pop)

#endif //__AVISYNTH_8_H__
#endif //__AVISYNTH_9_H__
18 changes: 16 additions & 2 deletions thirdparty/32/include/avisynth/avisynth_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@
// Constants
//

#ifndef __AVISYNTH_8_H__
#ifndef __AVISYNTH_9_H__
enum {
AVISYNTH_INTERFACE_CLASSIC_VERSION = 6,
AVISYNTH_INTERFACE_VERSION = 8
AVISYNTH_INTERFACE_VERSION = 9,
AVISYNTHPLUS_INTERFACE_BUGFIX_VERSION = 1 // reset to zero whenever the normal interface version bumps
};
#endif

Expand Down Expand Up @@ -397,6 +398,9 @@ enum
AVS_AEP_FILTERCHAIN_THREADS = 4,
AVS_AEP_THREAD_ID = 5,
AVS_AEP_VERSION = 6,
AVS_AEP_HOST_SYSTEM_ENDIANNESS = 7,
AVS_AEP_INTERFACE_VERSION = 8,
AVS_AEP_INTERFACE_BUGFIX = 9,

// Neo additionals
AVS_AEP_NUM_DEVICES = 901,
Expand Down Expand Up @@ -685,6 +689,9 @@ AVSC_API(const BYTE *, avs_get_read_ptr_p)(const AVS_VideoFrame * p, int plane);

AVSC_API(int, avs_is_writable)(const AVS_VideoFrame * p);

// V9
AVSC_API(int, avs_is_property_writable)(const AVS_VideoFrame* p);

AVSC_API(BYTE *, avs_get_write_ptr_p)(const AVS_VideoFrame * p, int plane);

AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *);
Expand Down Expand Up @@ -1002,6 +1009,9 @@ AVSC_INLINE AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env,

AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf);

// V9
AVSC_API(int, avs_make_property_writable)(AVS_ScriptEnvironment*, AVS_VideoFrame** pvf);

AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height);

typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env);
Expand Down Expand Up @@ -1266,6 +1276,10 @@ struct AVS_Library {

AVSC_DECLARE_FUNC(avs_pool_allocate);
AVSC_DECLARE_FUNC(avs_pool_free);

// V9
AVSC_DECLARE_FUNC(avs_is_property_writable);
AVSC_DECLARE_FUNC(avs_make_property_writable);
};

#undef AVSC_DECLARE_FUNC
Expand Down
6 changes: 6 additions & 0 deletions thirdparty/32/include/avisynth/avs/arch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef _AVS_ARCH_H_
#define _AVS_ARCH_H_

#define AVS_ARCH i386 // e.g. i386

#endif // _AVS_ARCH_H_
15 changes: 13 additions & 2 deletions thirdparty/32/include/avisynth/avs/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@

#ifdef AVS_POSIX
// this is also defined in avs/posix.h
#ifndef AVS_HAIKU
#define __declspec(x)
#endif
#endif

#ifdef __cplusplus
# define EXTERN_C extern "C"
Expand Down Expand Up @@ -92,16 +94,25 @@

#ifdef BUILDING_AVSCORE
#ifdef AVS_WINDOWS
# define AVSC_EXPORT __declspec(dllexport)
# ifndef AVS_STATIC_LIB
# define AVSC_EXPORT __declspec(dllexport)
# else
# define AVSC_EXPORT
# endif
# define AVSC_API(ret, name) EXTERN_C AVSC_EXPORT ret AVSC_CC name
#else
# define AVSC_EXPORT EXTERN_C
# define AVSC_API(ret, name) EXTERN_C ret AVSC_CC name
#endif
#else
# define AVSC_EXPORT EXTERN_C __declspec(dllexport)
# ifndef AVS_STATIC_LIB
# define AVSC_IMPORT __declspec(dllimport)
# else
# define AVSC_IMPORT
# endif
# ifndef AVSC_NO_DECLSPEC
# define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name
# define AVSC_API(ret, name) EXTERN_C AVSC_IMPORT ret AVSC_CC name
# else
# define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func)
# endif
Expand Down
39 changes: 32 additions & 7 deletions thirdparty/32/include/avisynth/avs/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@
# define ARM64
#elif defined(_M_ARM) || defined(__arm__)
# define ARM32
#elif defined(__PPC64__)
# define PPC64
#elif defined(_M_PPC) || defined(__PPC__) || defined(__POWERPC__)
# define PPC32
#elif defined(__riscv)
# define RISCV
#elif defined(__sparc_v9__)
# define SPARC
#elif defined(__mips__)
# define MIPS
#else
# error Unsupported CPU architecture.
#endif
Expand Down Expand Up @@ -80,6 +90,11 @@
#elif defined(__GNUC__)
# define GCC
# define AVS_FORCEINLINE __attribute__((always_inline)) inline
#elif defined(__INTEL_COMPILER) || defined(__INTEL_LLVM_COMPILER)
// Intel C++ Compilers with MSVC command line interface will not appear here rather at _MSC_VER
# define AVS_FORCEINLINE inline
# undef __forceinline
# define __forceinline inline
#else
# error Unsupported compiler.
# define AVS_FORCEINLINE inline
Expand All @@ -98,6 +113,9 @@
#elif defined(__APPLE__)
# define AVS_MACOS
# define AVS_POSIX
#elif defined(__HAIKU__)
# define AVS_HAIKU
# define AVS_POSIX
#else
# error Operating system unsupported.
#endif
Expand Down Expand Up @@ -132,17 +150,24 @@

#endif

#if defined(AVS_POSIX)
#define NEW_AVSVALUE
#else
#define NEW_AVSVALUE
#endif

#if defined(AVS_WINDOWS)
#if defined(AVS_WINDOWS) && defined(_USING_V110_SDK71_)
// Windows XP does not have proper initialization for
// thread local variables.
// Use workaround instead __declspec(thread)
#define XP_TLS
#endif

#ifndef MSVC
// GCC and Clang can be used on big endian systems, MSVC can't.
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define AVS_ENDIANNESS "little"
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define AVS_ENDIANNESS "big"
# else
# define AVS_ENDIANNESS "middle"
# endif
#else
#define AVS_ENDIANNESS "little"
#endif

#endif //AVS_CONFIG_H
15 changes: 15 additions & 0 deletions thirdparty/32/include/avisynth/avs/filesystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

// Snippet copied from filesystem/README.md

#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
#if __has_include(<filesystem>)
#define GHC_USE_STD_FS
#include <filesystem>
namespace fs = std::filesystem;
#endif
#endif
#ifndef GHC_USE_STD_FS
#include <ghc/filesystem.hpp>
namespace fs = ghc::filesystem;
#endif
18 changes: 18 additions & 0 deletions thirdparty/32/include/avisynth/avs/posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#define __single_inheritance

// These things don't exist in Linux
#if defined(AVS_HAIKU)
#undef __declspec
#endif
#define __declspec(x)
#define lstrlen strlen
#define lstrcmp strcmp
Expand Down Expand Up @@ -104,8 +107,23 @@
#define STATUS_STACK_OVERFLOW 0xc00000fd

// Calling convension
#ifndef AVS_HAIKU
#define __stdcall
#define __cdecl
#endif

// PowerPC OS X is really niche these days, but this painless equivocation
// of the function/macro names used in posix_get_available_memory()
// is all it takes to let it work. The G5 was 64-bit, and if 10.5 Leopard
// can run in native 64-bit, it probably uses the names in that block as-is.
#ifdef AVS_MACOS
#ifdef PPC32
#define vm_statistics64_data_t vm_statistics_data_t
#define HOST_VM_INFO64_COUNT HOST_VM_INFO_COUNT
#define HOST_VM_INFO64 HOST_VM_INFO
#define host_statistics64 host_statistics
#endif // PPC32
#endif // AVS_MACOS

#endif // AVSCORE_POSIX_H
#endif // AVS_POSIX
Loading

0 comments on commit cbaa2dc

Please sign in to comment.