[FFmpeg-devel] [PATCH 1/4] avisynth: update headers against AviSynth+

Stephen Hutchinson qyot27 at gmail.com
Tue Mar 24 20:23:29 CET 2015


---
 compat/avisynth/avisynth_c.h | 296 +++++++++++++++++++++----------------------
 compat/avisynth/avs/capi.h   |  62 +++++++++
 compat/avisynth/avs/config.h |  55 ++++++++
 compat/avisynth/avs/types.h  |  51 ++++++++
 4 files changed, 313 insertions(+), 151 deletions(-)
 create mode 100644 compat/avisynth/avs/capi.h
 create mode 100644 compat/avisynth/avs/config.h
 create mode 100644 compat/avisynth/avs/types.h

diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h
index 2d3002a..cfe3f64 100644
--- a/compat/avisynth/avisynth_c.h
+++ b/compat/avisynth/avisynth_c.h
@@ -38,40 +38,9 @@
 #ifndef __AVISYNTH_C__
 #define __AVISYNTH_C__
 
-#ifdef __cplusplus
-#  define EXTERN_C extern "C"
-#else
-#  define EXTERN_C
-#endif
-
-#define AVSC_USE_STDCALL 1
-
-#ifndef AVSC_USE_STDCALL
-#  define AVSC_CC __cdecl
-#else
-#  define AVSC_CC __stdcall
-#endif
-
-#define AVSC_INLINE static __inline
-
-#ifdef AVISYNTH_C_EXPORTS
-#  define AVSC_EXPORT EXTERN_C
-#  define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name
-#else
-#  define AVSC_EXPORT EXTERN_C __declspec(dllexport)
-#  ifndef AVSC_NO_DECLSPEC
-#    define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name
-#  else
-#    define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func)
-#  endif
-#endif
-
-typedef unsigned char BYTE;
-#ifdef __GNUC__
-typedef long long int INT64;
-#else
-typedef __int64 INT64;
-#endif
+#include "avs/config.h"
+#include "avs/capi.h"
+#include "avs/types.h"
 
 
 /////////////////////////////////////////////////////////////////////
@@ -79,8 +48,8 @@ typedef __int64 INT64;
 // Constants
 //
 
-#ifndef __AVISYNTH_H__
-enum { AVISYNTH_INTERFACE_VERSION = 4 };
+#ifndef __AVISYNTH_6_H__
+enum { AVISYNTH_INTERFACE_VERSION = 6 };
 #endif
 
 enum {AVS_SAMPLE_INT8  = 1<<0,
@@ -112,8 +81,8 @@ enum {AVS_CS_BGR = 1<<28,
       AVS_CS_PLANAR = 1<<31,
 
       AVS_CS_SHIFT_SUB_WIDTH   = 0,
-      AVS_CS_SHIFT_SUB_HEIGHT  = 1 << 3,
-      AVS_CS_SHIFT_SAMPLE_BITS = 1 << 4,
+      AVS_CS_SHIFT_SUB_HEIGHT  = 8,
+      AVS_CS_SHIFT_SAMPLE_BITS = 16,
 
       AVS_CS_SUB_WIDTH_MASK    = 7 << AVS_CS_SHIFT_SUB_WIDTH,
       AVS_CS_SUB_WIDTH_1       = 3 << AVS_CS_SHIFT_SUB_WIDTH, // YV24
@@ -180,15 +149,66 @@ enum {  //SUBTYPES
   AVS_FILTER_OUTPUT_TYPE_DIFFERENT=4};
 
 enum {
-  AVS_CACHE_NOTHING=0,
-  AVS_CACHE_RANGE=1,
-  AVS_CACHE_ALL=2,
-  AVS_CACHE_AUDIO=3,
-  AVS_CACHE_AUDIO_NONE=4,
-  AVS_CACHE_AUDIO_AUTO=5
+  // New 2.6 explicitly defined cache hints.
+  AVS_CACHE_NOTHING=10, // Do not cache video.
+  AVS_CACHE_WINDOW=11, // Hard protect upto X frames within a range of X from the current frame N.
+  AVS_CACHE_GENERIC=12, // LRU cache upto X frames.
+  AVS_CACHE_FORCE_GENERIC=13, // LRU cache upto X frames, override any previous CACHE_WINDOW.
+
+  AVS_CACHE_GET_POLICY=30, // Get the current policy.
+  AVS_CACHE_GET_WINDOW=31, // Get the current window h_span.
+  AVS_CACHE_GET_RANGE=32, // Get the current generic frame range.
+
+  AVS_CACHE_AUDIO=50, // Explicitly do cache audio, X byte cache.
+  AVS_CACHE_AUDIO_NOTHING=51, // Explicitly do not cache audio.
+  AVS_CACHE_AUDIO_NONE=52, // Audio cache off (auto mode), X byte intial cache.
+  AVS_CACHE_AUDIO_AUTO=53, // Audio cache on (auto mode), X byte intial cache.
+
+  AVS_CACHE_GET_AUDIO_POLICY=70, // Get the current audio policy.
+  AVS_CACHE_GET_AUDIO_SIZE=71, // Get the current audio cache size.
+
+  AVS_CACHE_PREFETCH_FRAME=100, // Queue request to prefetch frame N.
+  AVS_CACHE_PREFETCH_GO=101, // Action video prefetches.
+
+  AVS_CACHE_PREFETCH_AUDIO_BEGIN=120, // Begin queue request transaction to prefetch audio (take critical section).
+  AVS_CACHE_PREFETCH_AUDIO_STARTLO=121, // Set low 32 bits of start.
+  AVS_CACHE_PREFETCH_AUDIO_STARTHI=122, // Set high 32 bits of start.
+  AVS_CACHE_PREFETCH_AUDIO_COUNT=123, // Set low 32 bits of length.
+  AVS_CACHE_PREFETCH_AUDIO_COMMIT=124, // Enqueue request transaction to prefetch audio (release critical section).
+  AVS_CACHE_PREFETCH_AUDIO_GO=125, // Action audio prefetches.
+
+  AVS_CACHE_GETCHILD_CACHE_MODE=200, // Cache ask Child for desired video cache mode.
+  AVS_CACHE_GETCHILD_CACHE_SIZE=201, // Cache ask Child for desired video cache size.
+  AVS_CACHE_GETCHILD_AUDIO_MODE=202, // Cache ask Child for desired audio cache mode.
+  AVS_CACHE_GETCHILD_AUDIO_SIZE=203, // Cache ask Child for desired audio cache size.
+
+  AVS_CACHE_GETCHILD_COST=220, // Cache ask Child for estimated processing cost.
+    AVS_CACHE_COST_ZERO=221, // Child response of zero cost (ptr arithmetic only).
+    AVS_CACHE_COST_UNIT=222, // Child response of unit cost (less than or equal 1 full frame blit).
+    AVS_CACHE_COST_LOW=223, // Child response of light cost. (Fast)
+    AVS_CACHE_COST_MED=224, // Child response of medium cost. (Real time)
+    AVS_CACHE_COST_HI=225, // Child response of heavy cost. (Slow)
+
+  AVS_CACHE_GETCHILD_THREAD_MODE=240, // Cache ask Child for thread safetyness.
+    AVS_CACHE_THREAD_UNSAFE=241, // Only 1 thread allowed for all instances. 2.5 filters default!
+    AVS_CACHE_THREAD_CLASS=242, // Only 1 thread allowed for each instance. 2.6 filters default!
+    AVS_CACHE_THREAD_SAFE=243, //  Allow all threads in any instance.
+    AVS_CACHE_THREAD_OWN=244, // Safe but limit to 1 thread, internally threaded.
+
+  AVS_CACHE_GETCHILD_ACCESS_COST=260, // Cache ask Child for preferred access pattern.
+    AVS_CACHE_ACCESS_RAND=261, // Filter is access order agnostic.
+    AVS_CACHE_ACCESS_SEQ0=262, // Filter prefers sequential access (low cost)
+    AVS_CACHE_ACCESS_SEQ1=263, // Filter needs sequential access (high cost)
   };
 
-#define AVS_FRAME_ALIGN 16
+#ifdef BUILDING_AVSCORE
+struct AVS_ScriptEnvironment {
+	IScriptEnvironment * env;
+	const char * error;
+	AVS_ScriptEnvironment(IScriptEnvironment * e = 0)
+		: env(e), error(0) {}
+};
+#endif
 
 typedef struct AVS_Clip AVS_Clip;
 typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment;
@@ -238,29 +258,23 @@ AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p)
 AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo * p)
         { return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; }
 
-AVSC_INLINE int avs_is_yv24(const AVS_VideoInfo * p)
-        { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV24  & AVS_CS_PLANAR_FILTER); }
+AVSC_API(int, avs_is_yv24)(const AVS_VideoInfo * p);
 
-AVSC_INLINE int avs_is_yv16(const AVS_VideoInfo * p)
-        { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV16  & AVS_CS_PLANAR_FILTER); }
+AVSC_API(int, avs_is_yv16)(const AVS_VideoInfo * p);
 
-AVSC_INLINE int avs_is_yv12(const AVS_VideoInfo * p)
-        { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV12  & AVS_CS_PLANAR_FILTER); }
+AVSC_API(int, avs_is_yv12)(const AVS_VideoInfo * p) ;
 
-AVSC_INLINE int avs_is_yv411(const AVS_VideoInfo * p)
-        { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV411 & AVS_CS_PLANAR_FILTER); }
+AVSC_API(int, avs_is_yv411)(const AVS_VideoInfo * p);
 
-AVSC_INLINE int avs_is_y8(const AVS_VideoInfo * p)
-        { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_Y8    & AVS_CS_PLANAR_FILTER); }
+AVSC_API(int, avs_is_y8)(const AVS_VideoInfo * p);
 
 AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property)
-        { return ((p->pixel_type & property)==property ); }
+        { return ((p->image_type & property)==property ); }
 
 AVSC_INLINE int avs_is_planar(const AVS_VideoInfo * p)
         { return !!(p->pixel_type & AVS_CS_PLANAR); }
 
-AVSC_INLINE int avs_is_color_space(const AVS_VideoInfo * p, int c_space)
-        { return avs_is_planar(p) ? ((p->pixel_type & AVS_CS_PLANAR_MASK) == (c_space & AVS_CS_PLANAR_FILTER)) : ((p->pixel_type & c_space) == c_space); }
+AVSC_API(int, avs_is_color_space)(const AVS_VideoInfo * p, int c_space);
 
 AVSC_INLINE int avs_is_field_based(const AVS_VideoInfo * p)
         { return !!(p->image_type & AVS_IT_FIELDBASED); }
@@ -274,25 +288,18 @@ AVSC_INLINE int avs_is_bff(const AVS_VideoInfo * p)
 AVSC_INLINE int avs_is_tff(const AVS_VideoInfo * p)
         { return !!(p->image_type & AVS_IT_TFF); }
 
-AVSC_INLINE int avs_bits_per_pixel(const AVS_VideoInfo * p)
-{
-  switch (p->pixel_type) {
-      case AVS_CS_BGR24: return 24;
-      case AVS_CS_BGR32: return 32;
-      case AVS_CS_YUY2:  return 16;
-      case AVS_CS_YV12:
-      case AVS_CS_I420:  return 12;
-      default:           return 0;
-    }
-}
-AVSC_INLINE int avs_bytes_from_pixels(const AVS_VideoInfo * p, int pixels)
-        { return pixels * (avs_bits_per_pixel(p)>>3); }   // Will work on planar images, but will return only luma planes
+AVSC_API(int, avs_get_plane_width_subsampling)(const AVS_VideoInfo * p, int plane);
+
+AVSC_API(int, avs_get_plane_height_subsampling)(const AVS_VideoInfo * p, int plane);
 
-AVSC_INLINE int avs_row_size(const AVS_VideoInfo * p)
-        { return avs_bytes_from_pixels(p,p->width); }  // Also only returns first plane on planar images
 
-AVSC_INLINE int avs_bmp_size(const AVS_VideoInfo * vi)
-        { if (avs_is_planar(vi)) {int p = vi->height * ((avs_row_size(vi)+3) & ~3); p+=p>>1; return p;  } return vi->height * ((avs_row_size(vi)+3) & ~3); }
+AVSC_API(int, avs_bits_per_pixel)(const AVS_VideoInfo * p);
+
+AVSC_API(int, avs_bytes_from_pixels)(const AVS_VideoInfo * p, int pixels);
+
+AVSC_API(int, avs_row_size)(const AVS_VideoInfo * p, int plane);
+
+AVSC_API(int, avs_bmp_size)(const AVS_VideoInfo * vi);
 
 AVSC_INLINE int avs_samples_per_second(const AVS_VideoInfo * p)
         { return p->audio_samples_per_second; }
@@ -391,89 +398,32 @@ typedef struct AVS_VideoFrame {
 } AVS_VideoFrame;
 
 // Access functions for AVS_VideoFrame
+AVSC_API(int, avs_get_pitch_p)(const AVS_VideoFrame * p, int plane);
+
 AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame * p) {
-        return p->pitch;}
+        return avs_get_pitch_p(p, 0);}
 
-AVSC_INLINE int avs_get_pitch_p(const AVS_VideoFrame * p, int plane) {
-  switch (plane) {
-  case AVS_PLANAR_U: case AVS_PLANAR_V: return p->pitchUV;}
-  return p->pitch;}
+AVSC_API(int, avs_get_row_size_p)(const AVS_VideoFrame * p, int plane);
 
 AVSC_INLINE int avs_get_row_size(const AVS_VideoFrame * p) {
         return p->row_size; }
 
-AVSC_INLINE int avs_get_row_size_p(const AVS_VideoFrame * p, int plane) {
-        int r;
-    switch (plane) {
-    case AVS_PLANAR_U: case AVS_PLANAR_V:
-                if (p->pitchUV) return p->row_sizeUV;
-                else            return 0;
-    case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED:
-                if (p->pitchUV) {
-                        r = (p->row_sizeUV+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
-                        if (r < p->pitchUV)
-                                return r;
-                        return p->row_sizeUV;
-                } else return 0;
-    case AVS_PLANAR_Y_ALIGNED:
-                r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize
-                if (r <= p->pitch)
-                        return r;
-                return p->row_size;
-    }
-    return p->row_size;
-}
+AVSC_API(int, avs_get_height_p)(const AVS_VideoFrame * p, int plane);
 
 AVSC_INLINE int avs_get_height(const AVS_VideoFrame * p) {
         return p->height;}
 
-AVSC_INLINE int avs_get_height_p(const AVS_VideoFrame * p, int plane) {
-        switch (plane) {
-                case AVS_PLANAR_U: case AVS_PLANAR_V:
-                        if (p->pitchUV) return p->heightUV;
-                        return 0;
-        }
-        return p->height;}
+AVSC_API(const BYTE *, avs_get_read_ptr_p)(const AVS_VideoFrame * p, int plane);
 
 AVSC_INLINE const BYTE* avs_get_read_ptr(const AVS_VideoFrame * p) {
-        return p->vfb->data + p->offset;}
+        return avs_get_read_ptr_p(p, 0);}
 
-AVSC_INLINE const BYTE* avs_get_read_ptr_p(const AVS_VideoFrame * p, int plane)
-{
-        switch (plane) {
-                case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
-                case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
-                default:           return p->vfb->data + p->offset;}
-}
-
-AVSC_INLINE int avs_is_writable(const AVS_VideoFrame * p) {
-        return (p->refcount == 1 && p->vfb->refcount == 1);}
-
-AVSC_INLINE BYTE* avs_get_write_ptr(const AVS_VideoFrame * p)
-{
-        if (avs_is_writable(p)) {
-                ++p->vfb->sequence_number;
-                return p->vfb->data + p->offset;
-        } else
-                return 0;
-}
+AVSC_API(int, avs_is_writable)(const AVS_VideoFrame * p);
 
-AVSC_INLINE BYTE* avs_get_write_ptr_p(const AVS_VideoFrame * p, int plane)
-{
-        if (plane==AVS_PLANAR_Y && avs_is_writable(p)) {
-                ++p->vfb->sequence_number;
-                return p->vfb->data + p->offset;
-        } else if (plane==AVS_PLANAR_Y) {
-                return 0;
-        } else {
-                switch (plane) {
-                        case AVS_PLANAR_U: return p->vfb->data + p->offsetU;
-                        case AVS_PLANAR_V: return p->vfb->data + p->offsetV;
-                        default:       return p->vfb->data + p->offset;
-                }
-        }
-}
+AVSC_API(BYTE *, avs_get_write_ptr_p)(const AVS_VideoFrame * p, int plane);
 
+AVSC_INLINE BYTE* avs_get_write_ptr(const AVS_VideoFrame * p) {
+        return avs_get_write_ptr_p(p, 0);}
 
 AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *);
 // makes a shallow copy of a video frame
@@ -658,12 +608,16 @@ enum {
   AVS_CPUF_SSSE3      = 0x200,   //  Core 2
   AVS_CPUF_SSE4       = 0x400,   //  Penryn, Wolfdale, Yorkfield
   AVS_CPUF_SSE4_1     = 0x400,
-  AVS_CPUF_SSE4_2     = 0x800,   //  Nehalem
+//AVS_CPUF_AVX        = 0x800,   //  Sandy Bridge, Bulldozer
+  AVS_CPUF_SSE4_2    = 0x1000,   //  Nehalem
+//AVS_CPUF_AVX2      = 0x2000,   //  Haswell
+//AVS_CPUF_AVX512    = 0x4000,   //  Knights Landing
 };
 
+
 AVSC_API(const char *, avs_get_error)(AVS_ScriptEnvironment *); // return 0 if no error
 
-AVSC_API(long, avs_get_cpu_flags)(AVS_ScriptEnvironment *);
+AVSC_API(int, avs_get_cpu_flags)(AVS_ScriptEnvironment *);
 AVSC_API(int, avs_check_version)(AVS_ScriptEnvironment *, int version);
 
 AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length);
@@ -700,12 +654,12 @@ AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *,
 AVSC_INLINE
 AVS_VideoFrame * avs_new_video_frame(AVS_ScriptEnvironment * env,
                                      const AVS_VideoInfo * vi)
-  {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
+  {return avs_new_video_frame_a(env,vi,FRAME_ALIGN);}
 
 AVSC_INLINE
 AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env,
                                const AVS_VideoInfo * vi)
-  {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);}
+  {return avs_new_video_frame_a(env,vi,FRAME_ALIGN);}
 #endif
 
 
@@ -773,7 +727,6 @@ struct AVS_Library {
   AVSC_DECLARE_FUNC(avs_function_exists);
   AVSC_DECLARE_FUNC(avs_get_audio);
   AVSC_DECLARE_FUNC(avs_get_cpu_flags);
-  AVSC_DECLARE_FUNC(avs_get_error);
   AVSC_DECLARE_FUNC(avs_get_frame);
   AVSC_DECLARE_FUNC(avs_get_parity);
   AVSC_DECLARE_FUNC(avs_get_var);
@@ -798,6 +751,27 @@ struct AVS_Library {
   AVSC_DECLARE_FUNC(avs_subframe_planar);
   AVSC_DECLARE_FUNC(avs_take_clip);
   AVSC_DECLARE_FUNC(avs_vsprintf);
+
+  AVSC_DECLARE_FUNC(avs_get_error);
+  AVSC_DECLARE_FUNC(avs_is_yv24);
+  AVSC_DECLARE_FUNC(avs_is_yv16);
+  AVSC_DECLARE_FUNC(avs_is_yv12);
+  AVSC_DECLARE_FUNC(avs_is_yv411);
+  AVSC_DECLARE_FUNC(avs_is_y8);
+  AVSC_DECLARE_FUNC(avs_is_color_space);
+
+  AVSC_DECLARE_FUNC(avs_get_plane_width_subsampling);
+  AVSC_DECLARE_FUNC(avs_get_plane_height_subsampling);
+  AVSC_DECLARE_FUNC(avs_bits_per_pixel);
+  AVSC_DECLARE_FUNC(avs_bytes_from_pixels);
+  AVSC_DECLARE_FUNC(avs_row_size);
+  AVSC_DECLARE_FUNC(avs_bmp_size);
+  AVSC_DECLARE_FUNC(avs_get_pitch_p);
+  AVSC_DECLARE_FUNC(avs_get_row_size_p);
+  AVSC_DECLARE_FUNC(avs_get_height_p);
+  AVSC_DECLARE_FUNC(avs_get_read_ptr_p);
+  AVSC_DECLARE_FUNC(avs_is_writable);
+  AVSC_DECLARE_FUNC(avs_get_write_ptr_p);
 };
 
 #undef AVSC_DECLARE_FUNC
@@ -805,7 +779,7 @@ struct AVS_Library {
 
 AVSC_INLINE AVS_Library * avs_load_library() {
   AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library));
-  if (!library)
+  if (library == NULL)
     return NULL;
   library->handle = LoadLibrary("avisynth");
   if (library->handle == NULL)
@@ -832,7 +806,6 @@ AVSC_INLINE AVS_Library * avs_load_library() {
   AVSC_LOAD_FUNC(avs_function_exists);
   AVSC_LOAD_FUNC(avs_get_audio);
   AVSC_LOAD_FUNC(avs_get_cpu_flags);
-  AVSC_LOAD_FUNC(avs_get_error);
   AVSC_LOAD_FUNC(avs_get_frame);
   AVSC_LOAD_FUNC(avs_get_parity);
   AVSC_LOAD_FUNC(avs_get_var);
@@ -858,6 +831,27 @@ AVSC_INLINE AVS_Library * avs_load_library() {
   AVSC_LOAD_FUNC(avs_take_clip);
   AVSC_LOAD_FUNC(avs_vsprintf);
 
+  AVSC_LOAD_FUNC(avs_get_error);
+  AVSC_LOAD_FUNC(avs_is_yv24);
+  AVSC_LOAD_FUNC(avs_is_yv16);
+  AVSC_LOAD_FUNC(avs_is_yv12);
+  AVSC_LOAD_FUNC(avs_is_yv411);
+  AVSC_LOAD_FUNC(avs_is_y8);
+  AVSC_LOAD_FUNC(avs_is_color_space);
+
+  AVSC_LOAD_FUNC(avs_get_plane_width_subsampling);
+  AVSC_LOAD_FUNC(avs_get_plane_height_subsampling);
+  AVSC_LOAD_FUNC(avs_bits_per_pixel);
+  AVSC_LOAD_FUNC(avs_bytes_from_pixels);
+  AVSC_LOAD_FUNC(avs_row_size);
+  AVSC_LOAD_FUNC(avs_bmp_size);
+  AVSC_LOAD_FUNC(avs_get_pitch_p);
+  AVSC_LOAD_FUNC(avs_get_row_size_p);
+  AVSC_LOAD_FUNC(avs_get_height_p);
+  AVSC_LOAD_FUNC(avs_get_read_ptr_p);
+  AVSC_LOAD_FUNC(avs_is_writable);
+  AVSC_LOAD_FUNC(avs_get_write_ptr_p);
+
 #undef __AVSC_STRINGIFY
 #undef AVSC_STRINGIFY
 #undef AVSC_LOAD_FUNC
@@ -870,7 +864,7 @@ fail:
 }
 
 AVSC_INLINE void avs_free_library(AVS_Library *library) {
-  if (!library)
+  if (library == NULL)
     return;
   FreeLibrary(library->handle);
   free(library);
diff --git a/compat/avisynth/avs/capi.h b/compat/avisynth/avs/capi.h
new file mode 100644
index 0000000..083cc5c
--- /dev/null
+++ b/compat/avisynth/avs/capi.h
@@ -0,0 +1,62 @@
+// Avisynth C Interface Version 0.20
+// Copyright 2003 Kevin Atkinson
+
+// 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, or visit
+// http://www.gnu.org/copyleft/gpl.html .
+//
+// As a special exception, I give you permission to link to the
+// Avisynth C interface with independent modules that communicate with
+// the Avisynth C interface solely through the interfaces defined in
+// avisynth_c.h, regardless of the license terms of these independent
+// modules, and to copy and distribute the resulting combined work
+// under terms of your choice, provided that every copy of the
+// combined work is accompanied by a complete copy of the source code
+// of the Avisynth C interface and Avisynth itself (with the version
+// used to produce the combined work), being distributed under the
+// terms of the GNU General Public License plus this exception.  An
+// independent module is a module which is not derived from or based
+// on Avisynth C Interface, such as 3rd-party filters, import and
+// export plugins, or graphical user interfaces.
+
+#ifndef AVS_CAPI_H
+#define AVS_CAPI_H
+
+#ifdef __cplusplus
+#  define EXTERN_C extern "C"
+#else
+#  define EXTERN_C
+#endif
+
+#ifndef AVSC_USE_STDCALL
+#  define AVSC_CC __cdecl
+#else
+#  define AVSC_CC __stdcall
+#endif
+
+#define AVSC_INLINE static __inline
+
+#ifdef BUILDING_AVSCORE
+#  define AVSC_EXPORT EXTERN_C
+#  define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name
+#else
+#  define AVSC_EXPORT EXTERN_C __declspec(dllexport)
+#  ifndef AVSC_NO_DECLSPEC
+#    define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name
+#  else
+#    define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func)
+#  endif
+#endif
+
+#endif //AVS_CAPI_H
\ No newline at end of file
diff --git a/compat/avisynth/avs/config.h b/compat/avisynth/avs/config.h
new file mode 100644
index 0000000..cc3a1b2
--- /dev/null
+++ b/compat/avisynth/avs/config.h
@@ -0,0 +1,55 @@
+// Avisynth C Interface Version 0.20
+// Copyright 2003 Kevin Atkinson
+
+// 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, or visit
+// http://www.gnu.org/copyleft/gpl.html .
+//
+// As a special exception, I give you permission to link to the
+// Avisynth C interface with independent modules that communicate with
+// the Avisynth C interface solely through the interfaces defined in
+// avisynth_c.h, regardless of the license terms of these independent
+// modules, and to copy and distribute the resulting combined work
+// under terms of your choice, provided that every copy of the
+// combined work is accompanied by a complete copy of the source code
+// of the Avisynth C interface and Avisynth itself (with the version
+// used to produce the combined work), being distributed under the
+// terms of the GNU General Public License plus this exception.  An
+// independent module is a module which is not derived from or based
+// on Avisynth C Interface, such as 3rd-party filters, import and
+// export plugins, or graphical user interfaces.
+
+#ifndef AVS_CONFIG_H
+#define AVS_CONFIG_H
+
+// Undefine this to get cdecl calling convention
+#define AVSC_USE_STDCALL 1
+
+// NOTE TO PLUGIN AUTHORS:
+// Because FRAME_ALIGN can be substantially higher than the alignment
+// a plugin actually needs, plugins should not use FRAME_ALIGN to check for
+// alignment. They should always request the exact alignment value they need.
+// This is to make sure that plugins work over the widest range of AviSynth
+// builds possible.
+#define FRAME_ALIGN 32
+
+#if   defined(_M_AMD64) || defined(__x86_64)
+#   define X86_64
+#elif defined(_M_IX86) || defined(__i386__)
+#   define X86_32
+#else
+#   error Unsupported CPU architecture.
+#endif
+
+#endif //AVS_CONFIG_H
\ No newline at end of file
diff --git a/compat/avisynth/avs/types.h b/compat/avisynth/avs/types.h
new file mode 100644
index 0000000..4564740
--- /dev/null
+++ b/compat/avisynth/avs/types.h
@@ -0,0 +1,51 @@
+// Avisynth C Interface Version 0.20
+// Copyright 2003 Kevin Atkinson
+
+// 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, or visit
+// http://www.gnu.org/copyleft/gpl.html .
+//
+// As a special exception, I give you permission to link to the
+// Avisynth C interface with independent modules that communicate with
+// the Avisynth C interface solely through the interfaces defined in
+// avisynth_c.h, regardless of the license terms of these independent
+// modules, and to copy and distribute the resulting combined work
+// under terms of your choice, provided that every copy of the
+// combined work is accompanied by a complete copy of the source code
+// of the Avisynth C interface and Avisynth itself (with the version
+// used to produce the combined work), being distributed under the
+// terms of the GNU General Public License plus this exception.  An
+// independent module is a module which is not derived from or based
+// on Avisynth C Interface, such as 3rd-party filters, import and
+// export plugins, or graphical user interfaces.
+
+#ifndef AVS_TYPES_H
+#define AVS_TYPES_H
+
+// Define all types necessary for interfacing with avisynth.dll
+
+// Raster types used by VirtualDub & Avisynth
+typedef unsigned int    Pixel32;
+typedef unsigned char   BYTE;
+
+// Audio Sample information
+typedef float SFLOAT;
+
+#ifdef __GNUC__
+typedef long long int INT64;
+#else
+typedef __int64 INT64;
+#endif
+
+#endif //AVS_TYPES_H
\ No newline at end of file
-- 
2.1.0



More information about the ffmpeg-devel mailing list