From patchwork Wed Mar 11 10:50:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hutchinson X-Patchwork-Id: 18120 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B0FC1449CB2 for ; Wed, 11 Mar 2020 12:56:25 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 908D668AE26; Wed, 11 Mar 2020 12:56:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f53.google.com (mail-yw1-f53.google.com [209.85.161.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 706E5687F66 for ; Wed, 11 Mar 2020 12:56:18 +0200 (EET) Received: by mail-yw1-f53.google.com with SMTP id d206so1508378ywa.12 for ; Wed, 11 Mar 2020 03:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=lHqoQfhlo0fWfWmHF70EZH2ekDoBeZrW644O97Qi5tY=; b=gEO5PepY90xvyo8Ukcd8w05aMERdD0TG7p0GTx6L12VUXOuaEmkLTiUizkO5QRTQXa RrpbqwoLV+AtWfmxvwexTMd8QXlBjJr5L7tTgbcj4nRBwwQ5RuqotExzvOQ6TbwrLPUH SVhzktZwaJN6uZNodXn3fBdqvMKfZB7LHzOs/pM1mDUvqKekIKc9jmQ3AAaXMPEsg+3J 3v7qn/A5Ut7CQUn8TiktELtdErw0rZg7lkjZZTV9TW9HVQ/OTYAznivnkFCwG1gVmzCq y8UH8rqFfUH/CSthoDb1z8WQmNuY2H6LHRUqpi4QNWvHQOHAUwCVRnOocdf8j5xE0dXC GU8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lHqoQfhlo0fWfWmHF70EZH2ekDoBeZrW644O97Qi5tY=; b=ANhmKqf5QaPiXvY8yhk0Nx9txM9JtfdYoY17h6mBTVPmVv1+uMTOTfGNrfvXutz357 UBe/tYZc8ACsrb6WPZAlyOULYOSVMuUxDMjITqTYXwYRpwMc3vWtTW/jcStjyEI4oZ7y eXQFYCVAT+Egqv2bg40aZhMapmSMozKUKg21qt/FE6vpA1PCAo+U0qEV8Y3thrcZLDuH VT7/KEHo1MjkMkyGREIUkpBCzaYVX9Z0USZzF2KIZXjfOlwMWME8AXO4Ioo9VAAdZm4a gvgTBGKkJi4JUqxW0GjMQQ5s2M4BtBwAUDHRyLWpE0EzDmiOJygFjqNcX7unjbz5+sGL QcRA== X-Gm-Message-State: ANhLgQ0T1Z9n75VEsA+ge+xv9fNBv8nR4thCPTZjd7spbY9ODIPdFhdw o85NUHo3wZ1mHUtARj2HY2A0TwTo X-Google-Smtp-Source: ADFU+vtjpO8oTGgdkVKqLF9lL4cgjLQwIbMSKEAvbF1kl2MpG3f0fXMt43ca+AifV7ufIpXLDQz8QA== X-Received: by 2002:a0d:dcc7:: with SMTP id f190mr2468969ywe.193.1583923826089; Wed, 11 Mar 2020 03:50:26 -0700 (PDT) Received: from localhost.localdomain ([75.115.109.114]) by smtp.gmail.com with ESMTPSA id t186sm4344839ywb.37.2020.03.11.03.50.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:50:25 -0700 (PDT) From: Stephen Hutchinson To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Mar 2020 06:50:15 -0400 Message-Id: <20200311105019.8553-2-qyot27@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105019.8553-1-qyot27@gmail.com> References: <20200311105019.8553-1-qyot27@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/5] compat/avisynth: update headers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" AviSynth+ can now be used on Linux, which required some changes to the headers. --- compat/avisynth/avisynth_c.h | 24 ++++---- compat/avisynth/avs/capi.h | 16 +++++ compat/avisynth/avs/config.h | 46 +++++++++++++-- compat/avisynth/avs/posix.h | 111 +++++++++++++++++++++++++++++++++++ compat/avisynth/avs/types.h | 13 ++-- 5 files changed, 185 insertions(+), 25 deletions(-) create mode 100644 compat/avisynth/avs/posix.h diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h index 9ff9321552..03c3530ca9 100644 --- a/compat/avisynth/avisynth_c.h +++ b/compat/avisynth/avisynth_c.h @@ -341,7 +341,7 @@ typedef struct AVS_VideoInfo { int audio_samples_per_second; // 0 means no audio int sample_type; - INT64 num_audio_samples; + int64_t num_audio_samples; int nchannels; // Image type properties @@ -444,16 +444,16 @@ AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p) AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p) { return p->nchannels*avs_bytes_per_channel_sample(p);} -AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames) - { return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } +AVSC_INLINE int64_t avs_audio_samples_from_frames(const AVS_VideoInfo * p, int64_t frames) + { return ((int64_t)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } -AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) - { return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); } +AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) + { return (int)(samples * (int64_t)p->fps_numerator / (int64_t)p->fps_denominator / (int64_t)p->audio_samples_per_second); } -AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes) +AVSC_INLINE int64_t avs_audio_samples_from_bytes(const AVS_VideoInfo * p, int64_t bytes) { return bytes / avs_bytes_per_audio_sample(p); } -AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) +AVSC_INLINE int64_t avs_bytes_from_audio_samples(const AVS_VideoInfo * p, int64_t samples) { return samples * avs_bytes_per_audio_sample(p); } AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p) @@ -764,7 +764,7 @@ AVSC_API(int, avs_get_parity)(AVS_Clip *, int n); // return field parity if field_based, else parity of first field in frame AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf, - INT64 start, INT64 count); + int64_t start, int64_t count); // start and count are in samples AVSC_API(int, avs_set_cache_hints)(AVS_Clip *, @@ -784,7 +784,7 @@ struct AVS_FilterInfo AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n); int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n); int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf, - INT64 start, INT64 count); + int64_t start, int64_t count); int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints, int frame_range); void (AVSC_CC * free_filter)(AVS_FilterInfo *); @@ -933,6 +933,8 @@ AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *); AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV); // The returned video frame must be be released +#if defined(AVS_WINDOWS) +// The following stuff is only relevant for Windows DLL handling; Linux does it completely differently. #ifdef AVSC_NO_DECLSPEC // This part uses LoadLibrary and related functions to dynamically load Avisynth instead of declspec(dllimport) // When AVSC_NO_DECLSPEC is defined, you can use avs_load_library to populate API functions into a struct @@ -944,7 +946,7 @@ AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_Vid void* malloc(size_t) void free(void*); - HMODULE LoadLibrary(const char*); + HMODULE LoadLibraryA(const char*); void* GetProcAddress(HMODULE, const char*); FreeLibrary(HMODULE); */ @@ -1261,4 +1263,6 @@ AVSC_INLINE void avs_free_library(AVS_Library *library) { } #endif +#endif // AVS_WINDOWS + #endif diff --git a/compat/avisynth/avs/capi.h b/compat/avisynth/avs/capi.h index 8799bf1fbb..4e31a5de48 100644 --- a/compat/avisynth/avs/capi.h +++ b/compat/avisynth/avs/capi.h @@ -33,12 +33,20 @@ #ifndef AVS_CAPI_H #define AVS_CAPI_H +#include "config.h" + +#ifdef AVS_POSIX +// this is also defined in avs/posix.h +#define __declspec(x) +#endif + #ifdef __cplusplus # define EXTERN_C extern "C" #else # define EXTERN_C #endif +#ifdef AVS_WINDOWS #ifdef BUILDING_AVSCORE # if defined(GCC) && defined(X86_32) # define AVSC_CC @@ -60,6 +68,9 @@ # define AVSC_CC # endif #endif +# else +# define AVSC_CC +#endif // On 64-bit Windows, there's only one calling convention, // so there is no difference between MSVC and GCC. On 32-bit, @@ -80,9 +91,14 @@ #define AVSC_INLINE static __inline #ifdef BUILDING_AVSCORE +#ifdef AVS_WINDOWS # define AVSC_EXPORT __declspec(dllexport) # 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 AVSC_NO_DECLSPEC # define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name diff --git a/compat/avisynth/avs/config.h b/compat/avisynth/avs/config.h index a7d3e692ea..896dae20ff 100644 --- a/compat/avisynth/avs/config.h +++ b/compat/avisynth/avs/config.h @@ -52,19 +52,53 @@ # error Unsupported CPU architecture. #endif -#if defined(_MSC_VER) +// VC++ LLVM-Clang-cl MinGW-Gnu +// MSVC x x +// MSVC_PURE x +// CLANG x +// GCC x + +#if defined(__clang__) +// Check clang first. clang-cl also defines __MSC_VER +// We set MSVC because they are mostly compatible +# define CLANG +#if defined(_MSC_VER) # define MSVC +# define AVS_FORCEINLINE __attribute__((always_inline)) +#else +# define AVS_FORCEINLINE __attribute__((always_inline)) inline +#endif +#elif defined(_MSC_VER) +# define MSVC +# define MSVC_PURE +# define AVS_FORCEINLINE __forceinline #elif defined(__GNUC__) # define GCC -#elif defined(__clang__) -# define CLANG +# define AVS_FORCEINLINE __attribute__((always_inline)) inline #else # error Unsupported compiler. -#endif - -#if defined(GCC) +# define AVS_FORCEINLINE inline # undef __forceinline # define __forceinline inline #endif +#if defined(_WIN32) +# define AVS_WINDOWS +#elif defined(__linux__) +# define AVS_LINUX +# define AVS_POSIX +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +# define AVS_BSD +# define AVS_POSIX +#elif defined(__APPLE__) +# define AVS_MACOS +# define AVS_POSIX +#else +# error Operating system unsupported. +#endif + +#if defined(AVS_POSIX) +#define NEW_AVSVALUE +#endif + #endif //AVS_CONFIG_H diff --git a/compat/avisynth/avs/posix.h b/compat/avisynth/avs/posix.h new file mode 100644 index 0000000000..9c938b26ea --- /dev/null +++ b/compat/avisynth/avs/posix.h @@ -0,0 +1,111 @@ +// 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 . +// +// Linking Avisynth statically or dynamically with other modules is making a +// combined work based on Avisynth. Thus, the terms and conditions of the GNU +// General Public License cover the whole combination. +// +// As a special exception, the copyright holders of Avisynth give you +// permission to link Avisynth with independent modules that communicate with +// Avisynth solely through the interfaces defined in avisynth.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 Avisynth (the version of Avisynth 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, such as 3rd-party filters, +// import and export plugins, or graphical user interfaces. + +#ifdef AVS_POSIX +#ifndef AVSCORE_POSIX_H +#define AVSCORE_POSIX_H + +#ifdef __cplusplus +#include +#endif +#include +#include + +// Define these MSVC-extension used in Avisynth +#define __single_inheritance + +// These things don't exist in Linux +#define __declspec(x) +#define lstrlen strlen +#define lstrcmp strcmp +#define lstrcmpi strcasecmp +#define _stricmp strcasecmp +#define _strnicmp strncasecmp +#define _strdup strdup +#define SetCurrentDirectory(x) chdir(x) +#define SetCurrentDirectoryW(x) chdir(x) +#define GetCurrentDirectoryW(x) getcwd(x) +#define _putenv putenv +#define _alloca alloca + +// Borrowing some compatibility macros from AvxSynth, slightly modified +#define UInt32x32To64(a, b) ((uint64_t)(((uint64_t)((uint32_t)(a))) * ((uint32_t)(b)))) +#define Int64ShrlMod32(a, b) ((uint64_t)((uint64_t)(a) >> (b))) +#define Int32x32To64(a, b) ((int64_t)(((int64_t)((long)(a))) * ((long)(b)))) + +#define InterlockedIncrement(x) __sync_add_and_fetch((x), 1) +#define InterlockedDecrement(x) __sync_sub_and_fetch((x), 1) +#define MulDiv(nNumber, nNumerator, nDenominator) (int32_t) (((int64_t) (nNumber) * (int64_t) (nNumerator) + (int64_t) ((nDenominator)/2)) / (int64_t) (nDenominator)) + +#ifndef TRUE +#define TRUE true +#endif + +#ifndef FALSE +#define FALSE false +#endif + +#define S_FALSE (0x00000001) +#define E_FAIL (0x80004005) +#define FAILED(hr) ((hr) & 0x80000000) +#define SUCCEEDED(hr) (!FAILED(hr)) + +// Statuses copied from comments in exception.cpp +#define STATUS_GUARD_PAGE_VIOLATION 0x80000001 +#define STATUS_DATATYPE_MISALIGNMENT 0x80000002 +#define STATUS_BREAKPOINT 0x80000003 +#define STATUS_SINGLE_STEP 0x80000004 +#define STATUS_ACCESS_VIOLATION 0xc0000005 +#define STATUS_IN_PAGE_ERROR 0xc0000006 +#define STATUS_INVALID_HANDLE 0xc0000008 +#define STATUS_NO_MEMORY 0xc0000017 +#define STATUS_ILLEGAL_INSTRUCTION 0xc000001d +#define STATUS_NONCONTINUABLE_EXCEPTION 0xc0000025 +#define STATUS_INVALID_DISPOSITION 0xc0000026 +#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xc000008c +#define STATUS_FLOAT_DENORMAL_OPERAND 0xc000008d +#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xc000008e +#define STATUS_FLOAT_INEXACT_RESULT 0xc000008f +#define STATUS_FLOAT_INVALID_OPERATION 0xc0000090 +#define STATUS_FLOAT_OVERFLOW 0xc0000091 +#define STATUS_FLOAT_STACK_CHECK 0xc0000092 +#define STATUS_FLOAT_UNDERFLOW 0xc0000093 +#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xc0000094 +#define STATUS_INTEGER_OVERFLOW 0xc0000095 +#define STATUS_PRIVILEGED_INSTRUCTION 0xc0000096 +#define STATUS_STACK_OVERFLOW 0xc00000fd + +// Calling convension +#define __stdcall +#define __cdecl + +#endif // AVSCORE_POSIX_H +#endif // AVS_POSIX diff --git a/compat/avisynth/avs/types.h b/compat/avisynth/avs/types.h index df15f1d8e5..ba451c6fae 100644 --- a/compat/avisynth/avs/types.h +++ b/compat/avisynth/avs/types.h @@ -34,7 +34,8 @@ #define AVS_TYPES_H // Define all types necessary for interfacing with avisynth.dll - +#include +#include #ifdef __cplusplus #include #else @@ -42,16 +43,10 @@ #endif // Raster types used by VirtualDub & Avisynth -typedef unsigned int Pixel32; -typedef unsigned char BYTE; +typedef uint32_t Pixel32; +typedef uint8_t BYTE; // Audio Sample information typedef float SFLOAT; -#ifdef __GNUC__ -typedef long long int INT64; -#else -typedef __int64 INT64; -#endif - #endif //AVS_TYPES_H From patchwork Wed Mar 11 10:50:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hutchinson X-Patchwork-Id: 18123 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D55FA44A573 for ; Wed, 11 Mar 2020 12:58:44 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BE0A168AD7A; Wed, 11 Mar 2020 12:58:44 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26776688106 for ; Wed, 11 Mar 2020 12:58:38 +0200 (EET) Received: by mail-ot1-f67.google.com with SMTP id a9so1459263otl.6 for ; Wed, 11 Mar 2020 03:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BJW5HSn35GiH6KxWIW0VvhN3ExqdWB1Dm87INV6tIKc=; b=X16CAnACjxCebtENsSJMn4Ue5FyS2f86jMPpt1q0o78/VYmTQALAIC0zz8kX09QCgU rAVYJf1uMkgoVtVUa8xbAOyrsXaM2Ovf0rV7nujqPGyIKYKtE201tTRc4uevqHLxJxWd KxWYS5aAQO9WVXOhxkBdxozeq+OwIcvZL7FO0CqCqFSqN/vVv0sif8wG37RDnCpmdjtP qliBfI2iE2e7rrPenYKl3uqRnNMhyKo0lFUSGZllGjfnBkNwWOfPintGyyPESfvcAg2g QvnBFoLDNWTLU73O5WUdhR5Ko3dvxADF0ylLyfuKa+w76zQvzAmzKu1nGmeiX/QiDKdZ oRQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BJW5HSn35GiH6KxWIW0VvhN3ExqdWB1Dm87INV6tIKc=; b=RTXpseD4pzIaDrwcf1eVAnvRHiXOGfyxcLYpiKTjHKg8v2b8EBozjszrCs+n2jdfGY C3MbvOG+o71CQMO3USnBYMxDBUfqKAKzAKlawKwvl2gfJ309PB8CbUD8M08CJJoOjXSp cYB9WVp2kLJNK5GwOJwV/Wp3HPRVS1bvujIjYYS2iLwEiqryllQPfeMnweA9BB0bAa2w MqgcKVOLlqA/21FJ6clE1yaRSPxAadoWr+UI2rEhNXMmgdwB8QeGjJw/KkIZJVy/llqH ocb8MJmzgrUpQ0lhzKk2ILM5iVxtI0bPpjapyJd9X66miWvFo6f1U7OrkqbGGBaTbEQy yB+w== X-Gm-Message-State: ANhLgQ1BkLCPwBW1+CgjmTjHbZRosQKUI3MDicfp8ISMxr1uqaa3f+gO aPFGeubWhQEy56tQzyHihG3eiBl5 X-Google-Smtp-Source: ADFU+vsADWAfDN2KW8Y0tu9O8EHawnty8Ks/gAWiQiZqEBdq54ITdK5POfBgBwZYX4dNnEXNT2rkcQ== X-Received: by 2002:a5b:48e:: with SMTP id n14mr2179972ybp.462.1583923826658; Wed, 11 Mar 2020 03:50:26 -0700 (PDT) Received: from localhost.localdomain ([75.115.109.114]) by smtp.gmail.com with ESMTPSA id t186sm4344839ywb.37.2020.03.11.03.50.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:50:26 -0700 (PDT) From: Stephen Hutchinson To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Mar 2020 06:50:16 -0400 Message-Id: <20200311105019.8553-3-qyot27@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105019.8553-1-qyot27@gmail.com> References: <20200311105019.8553-1-qyot27@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avisynth: switch to AviSynth+ on Linux X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" AviSynth+ now supports non-Windows OSes, making AvxSynth obsolete. Since we no longer support AviSynth 2.5 (which is essentially what AvxSynth is), remove AvxSynth support and replace it with AviSynth+. As a result, the USING_AVISYNTH defines can be switched back to generic _WIN32. --- libavformat/avisynth.c | 56 +++++++++++------------------------------- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 55a2efd884..1970553e49 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,5 +1,5 @@ /* - * AviSynth/AvxSynth support + * AviSynth(+) support * Copyright (c) 2012 AvxSynth Team * * This file is part of FFmpeg @@ -31,20 +31,19 @@ /* Enable function pointer definitions for runtime loading. */ #define AVSC_NO_DECLSPEC -/* Platform-specific directives for AviSynth vs AvxSynth. */ +/* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" #undef EXTERN_C - #include "compat/avisynth/avisynth_c.h" #define AVISYNTH_LIB "avisynth" - #define USING_AVISYNTH #else #include - #include "compat/avisynth/avxsynth_c.h" - #define AVISYNTH_NAME "libavxsynth" + #define AVISYNTH_NAME "libavisynth" #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +#include "compat/avisynth/avisynth_c.h" + typedef struct AviSynthLibrary { void *library; #define AVSC_DECLARE_FUNC(name) name ## _func name @@ -62,7 +61,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); AVSC_DECLARE_FUNC(avs_take_clip); -#ifdef USING_AVISYNTH AVSC_DECLARE_FUNC(avs_bits_per_pixel); AVSC_DECLARE_FUNC(avs_get_height_p); AVSC_DECLARE_FUNC(avs_get_pitch_p); @@ -70,7 +68,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); -#endif #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -97,14 +94,12 @@ static const int avs_planes_packed[1] = { 0 }; static const int avs_planes_grey[1] = { AVS_PLANAR_Y }; static const int avs_planes_yuv[3] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V }; -#ifdef USING_AVISYNTH static const int avs_planes_rgb[3] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R }; static const int avs_planes_yuva[4] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V, AVS_PLANAR_A }; static const int avs_planes_rgba[4] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R, AVS_PLANAR_A }; -#endif /* A conflict between C++ global objects, atexit, and dynamic loading requires * us to register our own atexit handler to prevent double freeing. */ @@ -142,7 +137,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); -#ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); @@ -150,7 +144,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); -#endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -249,7 +242,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); switch (avs->vi->pixel_type) { -#ifdef USING_AVISYNTH /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: st->codecpar->format = AV_PIX_FMT_YUV444P10; @@ -434,8 +426,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) case AVS_CS_BGR64: st->codecpar->format = AV_PIX_FMT_BGRA64; break; -#endif - /* AviSynth 2.5 and AvxSynth pix_fmts */ + /* AviSynth 2.5 pix_fmts */ case AVS_CS_BGR24: st->codecpar->format = AV_PIX_FMT_BGR24; break; @@ -461,7 +452,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } switch (planar) { -#ifdef USING_AVISYNTH case 5: // Planar RGB + Alpha avs->n_planes = 4; avs->planes = avs_planes_rgba; @@ -474,7 +464,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 3; avs->planes = avs_planes_rgb; break; -#endif case 2: // Y8 avs->n_planes = 1; avs->planes = avs_planes_grey; @@ -556,7 +545,7 @@ static int avisynth_open_file(AVFormatContext *s) AviSynthContext *avs = s->priv_data; AVS_Value arg, val; int ret; -#ifdef USING_AVISYNTH +#ifdef _WIN32 char filename_ansi[MAX_PATH * 4]; wchar_t filename_wc[MAX_PATH * 4]; #endif @@ -564,7 +553,7 @@ static int avisynth_open_file(AVFormatContext *s) if (ret = avisynth_context_create(s)) return ret; -#ifdef USING_AVISYNTH +#ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, @@ -588,11 +577,9 @@ static int avisynth_open_file(AVFormatContext *s) avs->clip = avs_library.avs_take_clip(val, avs->env); avs->vi = avs_library.avs_get_video_info(avs->clip); -#ifdef USING_AVISYNTH /* On Windows, FFmpeg supports AviSynth interface version 6 or higher. * This includes AviSynth 2.6 RC1 or higher, and AviSynth+ r1718 or higher, - * and excludes 2.5 and the 2.6 alphas. Since AvxSynth identifies itself - * as interface version 3 like 2.5.8, this needs to be special-cased. */ + * and excludes 2.5 and the 2.6 alphas. */ if (avs_library.avs_get_version(avs->clip) < 6) { av_log(s, AV_LOG_ERROR, @@ -600,7 +587,6 @@ static int avisynth_open_file(AVFormatContext *s) ret = AVERROR_UNKNOWN; goto fail; } -#endif /* Release the AVS_Value as it will go out of scope. */ avs_library.avs_release_value(val); @@ -652,23 +638,21 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, if (discard) return 0; -#ifdef USING_AVISYNTH +#ifdef _WIN32 /* Detect whether we're using AviSynth 2.6 or AviSynth+ by * looking for whether avs_is_planar_rgb exists. */ if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL) avsplus = 0; else avsplus = 1; - - /* avs_bits_per_pixel changed to AVSC_API with AviSynth 2.6, which - * requires going through avs_library, while AvxSynth has it under - * the older AVSC_INLINE type, so special-case this. */ - - bits = avs_library.avs_bits_per_pixel(avs->vi); #else - bits = avs_bits_per_pixel(avs->vi); + /* AviSynth+ is now the only variant of AviSynth we support + * on Linux and macOS. */ + avsplus = 1; #endif + bits = avs_library.avs_bits_per_pixel(avs->vi); + /* Without the cast to int64_t, calculation overflows at about 9k x 9k * resolution. */ pkt->size = (((int64_t)avs->vi->width * @@ -696,19 +680,11 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, dst_p = pkt->data; for (i = 0; i < avs->n_planes; i++) { plane = avs->planes[i]; -#ifdef USING_AVISYNTH src_p = avs_library.avs_get_read_ptr_p(frame, plane); pitch = avs_library.avs_get_pitch_p(frame, plane); rowsize = avs_library.avs_get_row_size_p(frame, plane); planeheight = avs_library.avs_get_height_p(frame, plane); -#else - src_p = avs_get_read_ptr_p(frame, plane); - pitch = avs_get_pitch_p(frame, plane); - - rowsize = avs_get_row_size_p(frame, plane); - planeheight = avs_get_height_p(frame, plane); -#endif /* Flip RGB video. */ if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { @@ -716,14 +692,12 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, pitch = -pitch; } -#ifdef USING_AVISYNTH /* Flip Planar RGB video */ if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) || avs_library.avs_is_planar_rgba(avs->vi))) { src_p = src_p + (planeheight - 1) * pitch; pitch = -pitch; } -#endif avs_library.avs_bit_blt(avs->env, dst_p, rowsize, src_p, pitch, rowsize, planeheight); From patchwork Wed Mar 11 10:50:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hutchinson X-Patchwork-Id: 18124 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6D4BA44BA7D for ; Wed, 11 Mar 2020 13:12:29 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5121568ADE9; Wed, 11 Mar 2020 13:12:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f41.google.com (mail-yw1-f41.google.com [209.85.161.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 19D5168AD3D for ; Wed, 11 Mar 2020 13:12:22 +0200 (EET) Received: by mail-yw1-f41.google.com with SMTP id t141so1551983ywc.11 for ; Wed, 11 Mar 2020 04:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EQ9STTu/SmYaJTXe355SWtAEr+prURJIekpfStJn3Lk=; b=f41Xc3zCGbM5eIq9qSKO4A7wXrSPJzGas0rj7shCD5r5v2VEDzUmYv5cr9OZiMoK6G v8YSqmhDgXG2mBNwYR4z0hgQ9aPMYGpSDIXDU2r9ZZ4SHmaT6G2+Eqx/JoqzekVPGILz SMDIvYy3L9Fq690MG61VPXs+2aqbe+RJ4lzWoTHjsJYEwVmBt6h4JjbifNGyB+Djd5d5 rdrRalKxV/9h0ODzPU9Jg9iMtpvZ0VZkwBmv4QfArjDCgpLP8DdJEZEcaPhHUymTFY1c TSN2PtAenjpWkBIkF+BL/lMQJQ1WrLAS6JZ34AoHWN2mRcTjd4t9MHptaWbBCR0UwWVZ AS4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EQ9STTu/SmYaJTXe355SWtAEr+prURJIekpfStJn3Lk=; b=qtqRTP+X4uxz1h6+mQgv1V1YkQCLGQYt1UimuKpUvcBLggDcuywrVTnibaPOrUovSD 8Cv8TIACUqOlmoQG7HjaL2CrzCqMwWr1bCMbVN45JsPrDPFzLVA6RWcq4JklXJRLKh5j A/5vyFeY9iv5pWFJbbN9nH04dWzomxc0pcv0wRSa/7FzjVmryyIthCYXx7YnfYpO3ZTq Cx1YWlTh57oDV1tQO7vobtW+DPLNL47aMpAobIN/mRnRsn5Yd+jiToQnwPRmAYV3ZUbX PKdxOj+RuNP3jwvvmJyCHPHUDp8ggYrfSI3oeYbjt0ot126o5vf5Q8k3qzbWzco5yFHj I7MQ== X-Gm-Message-State: ANhLgQ2KnPYmSUHDDl2tNS4SJNOMCeN8DpGPnBaBEACDMucLykNhOo75 XjF2JHSpqEPfcSRX/OuJAvVmA+1x X-Google-Smtp-Source: ADFU+vsfyF/wLy4bhUsj3YTm5lYzL74GiLW/GucllsX9cYcoGqaUB9Imx0nU23awyp7tHJ0vuORRKw== X-Received: by 2002:a25:add1:: with SMTP id d17mr2392674ybe.191.1583923827214; Wed, 11 Mar 2020 03:50:27 -0700 (PDT) Received: from localhost.localdomain ([75.115.109.114]) by smtp.gmail.com with ESMTPSA id t186sm4344839ywb.37.2020.03.11.03.50.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:50:26 -0700 (PDT) From: Stephen Hutchinson To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Mar 2020 06:50:17 -0400 Message-Id: <20200311105019.8553-4-qyot27@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105019.8553-1-qyot27@gmail.com> References: <20200311105019.8553-1-qyot27@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/5] compat/avisynth: remove AvxSynth headers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- compat/avisynth/avxsynth_c.h | 728 ------------------ .../windowsPorts/basicDataTypeConversions.h | 85 -- compat/avisynth/windowsPorts/windows2linux.h | 77 -- 3 files changed, 890 deletions(-) delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h diff --git a/compat/avisynth/avxsynth_c.h b/compat/avisynth/avxsynth_c.h deleted file mode 100644 index 991f4be1ab..0000000000 --- a/compat/avisynth/avxsynth_c.h +++ /dev/null @@ -1,728 +0,0 @@ -// 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., 51 Franklin Street, Fifth Floor, Boston, -// MA 02110-1301 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 __AVXSYNTH_C__ -#define __AVXSYNTH_C__ - -#include "windowsPorts/windows2linux.h" -#include - -#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 - -#ifdef __GNUC__ -typedef long long int INT64; -#else -typedef __int64 INT64; -#endif - - -///////////////////////////////////////////////////////////////////// -// -// Constants -// - -#ifndef __AVXSYNTH_H__ -enum { AVISYNTH_INTERFACE_VERSION = 3 }; -#endif - -enum {AVS_SAMPLE_INT8 = 1<<0, - AVS_SAMPLE_INT16 = 1<<1, - AVS_SAMPLE_INT24 = 1<<2, - AVS_SAMPLE_INT32 = 1<<3, - AVS_SAMPLE_FLOAT = 1<<4}; - -enum {AVS_PLANAR_Y=1<<0, - AVS_PLANAR_U=1<<1, - AVS_PLANAR_V=1<<2, - AVS_PLANAR_ALIGNED=1<<3, - AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED, - AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED, - AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED}; - - // Colorspace properties. -enum {AVS_CS_BGR = 1<<28, - AVS_CS_YUV = 1<<29, - AVS_CS_INTERLEAVED = 1<<30, - AVS_CS_PLANAR = 1<<31}; - - // Specific colorformats -enum { - AVS_CS_UNKNOWN = 0, - AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED, - AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar - AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar - AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above -}; - -enum { - AVS_IT_BFF = 1<<0, - AVS_IT_TFF = 1<<1, - AVS_IT_FIELDBASED = 1<<2}; - -enum { - AVS_FILTER_TYPE=1, - AVS_FILTER_INPUT_COLORSPACE=2, - AVS_FILTER_OUTPUT_TYPE=9, - AVS_FILTER_NAME=4, - AVS_FILTER_AUTHOR=5, - AVS_FILTER_VERSION=6, - AVS_FILTER_ARGS=7, - AVS_FILTER_ARGS_INFO=8, - AVS_FILTER_ARGS_DESCRIPTION=10, - AVS_FILTER_DESCRIPTION=11}; - -enum { //SUBTYPES - AVS_FILTER_TYPE_AUDIO=1, - AVS_FILTER_TYPE_VIDEO=2, - AVS_FILTER_OUTPUT_TYPE_SAME=3, - 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 -}; - -#define AVS_FRAME_ALIGN 16 - -typedef struct AVS_Clip AVS_Clip; -typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment; - -///////////////////////////////////////////////////////////////////// -// -// AVS_VideoInfo -// - -// AVS_VideoInfo is layed out identicly to VideoInfo -typedef struct AVS_VideoInfo { - int width, height; // width=0 means no video - unsigned fps_numerator, fps_denominator; - int num_frames; - - int pixel_type; - - int audio_samples_per_second; // 0 means no audio - int sample_type; - INT64 num_audio_samples; - int nchannels; - - // Imagetype properties - - int image_type; -} AVS_VideoInfo; - -// useful functions of the above -AVSC_INLINE int avs_has_video(const AVS_VideoInfo * p) - { return (p->width!=0); } - -AVSC_INLINE int avs_has_audio(const AVS_VideoInfo * p) - { return (p->audio_samples_per_second!=0); } - -AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo * p) - { return !!(p->pixel_type&AVS_CS_BGR); } - -AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo * p) - { return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties - -AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; } - -AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p) - { return !!(p->pixel_type&AVS_CS_YUV ); } - -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_yv12(const AVS_VideoInfo * p) - { return ((p->pixel_type & AVS_CS_YV12) == AVS_CS_YV12)||((p->pixel_type & AVS_CS_I420) == AVS_CS_I420); } - -AVSC_INLINE int avs_is_color_space(const AVS_VideoInfo * p, int c_space) - { return ((p->pixel_type & c_space) == c_space); } - -AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property) - { return ((p->pixel_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_field_based(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_FIELDBASED); } - -AVSC_INLINE int avs_is_parity_known(const AVS_VideoInfo * p) - { return ((p->image_type & AVS_IT_FIELDBASED)&&(p->image_type & (AVS_IT_BFF | AVS_IT_TFF))); } - -AVSC_INLINE int avs_is_bff(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_BFF); } - -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_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_INLINE int avs_samples_per_second(const AVS_VideoInfo * p) - { return p->audio_samples_per_second; } - - -AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p) -{ - switch (p->sample_type) { - case AVS_SAMPLE_INT8: return sizeof(signed char); - case AVS_SAMPLE_INT16: return sizeof(signed short); - case AVS_SAMPLE_INT24: return 3; - case AVS_SAMPLE_INT32: return sizeof(signed int); - case AVS_SAMPLE_FLOAT: return sizeof(float); - default: return 0; - } -} -AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p) - { return p->nchannels*avs_bytes_per_channel_sample(p);} - -AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames) - { return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } - -AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) - { return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); } - -AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes) - { return bytes / avs_bytes_per_audio_sample(p); } - -AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) - { return samples * avs_bytes_per_audio_sample(p); } - -AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p) - { return p->nchannels; } - -AVSC_INLINE int avs_sample_type(const AVS_VideoInfo * p) - { return p->sample_type;} - -// useful mutator -AVSC_INLINE void avs_set_property(AVS_VideoInfo * p, int property) - { p->image_type|=property; } - -AVSC_INLINE void avs_clear_property(AVS_VideoInfo * p, int property) - { p->image_type&=~property; } - -AVSC_INLINE void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased) - { if (isfieldbased) p->image_type|=AVS_IT_FIELDBASED; else p->image_type&=~AVS_IT_FIELDBASED; } - -AVSC_INLINE void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator) -{ - unsigned x=numerator, y=denominator; - while (y) { // find gcd - unsigned t = x%y; x = y; y = t; - } - p->fps_numerator = numerator/x; - p->fps_denominator = denominator/x; -} - -AVSC_INLINE int avs_is_same_colorspace(AVS_VideoInfo * x, AVS_VideoInfo * y) -{ - return (x->pixel_type == y->pixel_type) - || (avs_is_yv12(x) && avs_is_yv12(y)); -} - -///////////////////////////////////////////////////////////////////// -// -// AVS_VideoFrame -// - -// VideoFrameBuffer holds information about a memory block which is used -// for video data. For efficiency, instances of this class are not deleted -// when the refcount reaches zero; instead they're stored in a linked list -// to be reused. The instances are deleted when the corresponding AVS -// file is closed. - -// AVS_VideoFrameBuffer is layed out identicly to VideoFrameBuffer -// DO NOT USE THIS STRUCTURE DIRECTLY -typedef struct AVS_VideoFrameBuffer { - unsigned char * data; - int data_size; - // sequence_number is incremented every time the buffer is changed, so - // that stale views can tell they're no longer valid. - long sequence_number; - - long refcount; -} AVS_VideoFrameBuffer; - -// VideoFrame holds a "window" into a VideoFrameBuffer. - -// AVS_VideoFrame is layed out identicly to IVideoFrame -// DO NOT USE THIS STRUCTURE DIRECTLY -typedef struct AVS_VideoFrame { - int refcount; - AVS_VideoFrameBuffer * vfb; - int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture. -} AVS_VideoFrame; - -// Access functions for AVS_VideoFrame -AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame * p) { - return p->pitch;} - -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_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_size>>1; - else return 0; - case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED: - if (p->pitchUV) { - r = ((p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)) )>>1; // Aligned rowsize - if (r < p->pitchUV) - return r; - return p->row_size>>1; - } 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_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->height>>1; - return 0; - } - return p->height;} - -AVSC_INLINE const unsigned char* avs_get_read_ptr(const AVS_VideoFrame * p) { - return p->vfb->data + p->offset;} - -AVSC_INLINE const unsigned char* 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 unsigned char* 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_INLINE unsigned char* 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; - } - } -} - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *); -// makes a shallow copy of a video frame -AVSC_API(AVS_VideoFrame *, avs_copy_video_frame)(AVS_VideoFrame *); -#if defined __cplusplus -} -#endif // __cplusplus - -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE void avs_release_frame(AVS_VideoFrame * f) - {avs_release_video_frame(f);} -AVSC_INLINE AVS_VideoFrame * avs_copy_frame(AVS_VideoFrame * f) - {return avs_copy_video_frame(f);} -#endif - -///////////////////////////////////////////////////////////////////// -// -// AVS_Value -// - -// Treat AVS_Value as a fat pointer. That is use avs_copy_value -// and avs_release_value appropiaty as you would if AVS_Value was -// a pointer. - -// To maintain source code compatibility with future versions of the -// avisynth_c API don't use the AVS_Value directly. Use the helper -// functions below. - -// AVS_Value is layed out identicly to AVSValue -typedef struct AVS_Value AVS_Value; -struct AVS_Value { - short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong - // for some function e'rror - short array_size; - union { - void * clip; // do not use directly, use avs_take_clip - char boolean; - int integer; - INT64 integer64; // match addition of __int64 to avxplugin.h - float floating_pt; - const char * string; - const AVS_Value * array; - } d; -}; - -// AVS_Value should be initilized with avs_void. -// Should also set to avs_void after the value is released -// with avs_copy_value. Consider it the equalvent of setting -// a pointer to NULL -static const AVS_Value avs_void = {'v'}; - -AVSC_API(void, avs_copy_value)(AVS_Value * dest, AVS_Value src); -AVSC_API(void, avs_release_value)(AVS_Value); - -AVSC_INLINE int avs_defined(AVS_Value v) { return v.type != 'v'; } -AVSC_INLINE int avs_is_clip(AVS_Value v) { return v.type == 'c'; } -AVSC_INLINE int avs_is_bool(AVS_Value v) { return v.type == 'b'; } -AVSC_INLINE int avs_is_int(AVS_Value v) { return v.type == 'i'; } -AVSC_INLINE int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; } -AVSC_INLINE int avs_is_string(AVS_Value v) { return v.type == 's'; } -AVSC_INLINE int avs_is_array(AVS_Value v) { return v.type == 'a'; } -AVSC_INLINE int avs_is_error(AVS_Value v) { return v.type == 'e'; } - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(AVS_Clip *, avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *); -AVSC_API(void, avs_set_to_clip)(AVS_Value *, AVS_Clip *); -#if defined __cplusplus -} -#endif // __cplusplus - -AVSC_INLINE int avs_as_bool(AVS_Value v) - { return v.d.boolean; } -AVSC_INLINE int avs_as_int(AVS_Value v) - { return v.d.integer; } -AVSC_INLINE const char * avs_as_string(AVS_Value v) - { return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; } -AVSC_INLINE double avs_as_float(AVS_Value v) - { return avs_is_int(v) ? v.d.integer : v.d.floating_pt; } -AVSC_INLINE const char * avs_as_error(AVS_Value v) - { return avs_is_error(v) ? v.d.string : 0; } -AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v) - { return v.d.array; } -AVSC_INLINE int avs_array_size(AVS_Value v) - { return avs_is_array(v) ? v.array_size : 1; } -AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index) - { return avs_is_array(v) ? v.d.array[index] : v; } - -// only use these functions on am AVS_Value that does not already have -// an active value. Remember, treat AVS_Value as a fat pointer. -AVSC_INLINE AVS_Value avs_new_value_bool(int v0) - { AVS_Value v = {0}; v.type = 'b'; v.d.boolean = v0 == 0 ? 0 : 1; return v; } -AVSC_INLINE AVS_Value avs_new_value_int(int v0) - { AVS_Value v = {0}; v.type = 'i'; v.d.integer = v0; return v; } -AVSC_INLINE AVS_Value avs_new_value_string(const char * v0) - { AVS_Value v = {0}; v.type = 's'; v.d.string = v0; return v; } -AVSC_INLINE AVS_Value avs_new_value_float(float v0) - { AVS_Value v = {0}; v.type = 'f'; v.d.floating_pt = v0; return v;} -AVSC_INLINE AVS_Value avs_new_value_error(const char * v0) - { AVS_Value v = {0}; v.type = 'e'; v.d.string = v0; return v; } -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip * v0) - { AVS_Value v = {0}; avs_set_to_clip(&v, v0); return v; } -#endif -AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size) - { AVS_Value v = {0}; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; } - -///////////////////////////////////////////////////////////////////// -// -// AVS_Clip -// -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(void, avs_release_clip)(AVS_Clip *); -AVSC_API(AVS_Clip *, avs_copy_clip)(AVS_Clip *); - -AVSC_API(const char *, avs_clip_get_error)(AVS_Clip *); // return 0 if no error - -AVSC_API(const AVS_VideoInfo *, avs_get_video_info)(AVS_Clip *); - -AVSC_API(int, avs_get_version)(AVS_Clip *); - -AVSC_API(AVS_VideoFrame *, avs_get_frame)(AVS_Clip *, int n); -// The returned video frame must be released with avs_release_video_frame - -AVSC_API(int, avs_get_parity)(AVS_Clip *, int n); -// return field parity if field_based, else parity of first field in frame - -AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf, - INT64 start, INT64 count); -// start and count are in samples - -AVSC_API(int, avs_set_cache_hints)(AVS_Clip *, - int cachehints, size_t frame_range); -#if defined __cplusplus -} -#endif // __cplusplus - -// This is the callback type used by avs_add_function -typedef AVS_Value (AVSC_CC * AVS_ApplyFunc) - (AVS_ScriptEnvironment *, AVS_Value args, void * user_data); - -typedef struct AVS_FilterInfo AVS_FilterInfo; -struct AVS_FilterInfo -{ - // these members should not be modified outside of the AVS_ApplyFunc callback - AVS_Clip * child; - AVS_VideoInfo vi; - AVS_ScriptEnvironment * env; - AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n); - int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n); - int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf, - INT64 start, INT64 count); - int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints, - int frame_range); - void (AVSC_CC * free_filter)(AVS_FilterInfo *); - - // Should be set when ever there is an error to report. - // It is cleared before any of the above methods are called - const char * error; - // this is to store whatever and may be modified at will - void * user_data; -}; - -// Create a new filter -// fi is set to point to the AVS_FilterInfo so that you can -// modify it once it is initilized. -// store_child should generally be set to true. If it is not -// set than ALL methods (the function pointers) must be defined -// If it is set than you do not need to worry about freeing the child -// clip. -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(AVS_Clip *, avs_new_c_filter)(AVS_ScriptEnvironment * e, - AVS_FilterInfo * * fi, - AVS_Value child, int store_child); -#if defined __cplusplus -} -#endif // __cplusplus - - -///////////////////////////////////////////////////////////////////// -// -// AVS_ScriptEnvironment -// - -// For GetCPUFlags. These are backwards-compatible with those in VirtualDub. -enum { - /* slowest CPU to support extension */ - AVS_CPU_FORCE = 0x01, // N/A - AVS_CPU_FPU = 0x02, // 386/486DX - AVS_CPU_MMX = 0x04, // P55C, K6, PII - AVS_CPU_INTEGER_SSE = 0x08, // PIII, Athlon - AVS_CPU_SSE = 0x10, // PIII, Athlon XP/MP - AVS_CPU_SSE2 = 0x20, // PIV, Hammer - AVS_CPU_3DNOW = 0x40, // K6-2 - AVS_CPU_3DNOW_EXT = 0x80, // Athlon - AVS_CPU_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2, - // which only Hammer will have anyway) -}; - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -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_check_version)(AVS_ScriptEnvironment *, int version); - -AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length); -AVSC_API(char *, avs_sprintf)(AVS_ScriptEnvironment *, const char * fmt, ...); - -AVSC_API(char *, avs_vsprintf)(AVS_ScriptEnvironment *, const char * fmt, va_list val); - // note: val is really a va_list; I hope everyone typedefs va_list to a pointer - -AVSC_API(int, avs_add_function)(AVS_ScriptEnvironment *, - const char * name, const char * params, - AVS_ApplyFunc apply, void * user_data); - -AVSC_API(int, avs_function_exists)(AVS_ScriptEnvironment *, const char * name); - -AVSC_API(AVS_Value, avs_invoke)(AVS_ScriptEnvironment *, const char * name, - AVS_Value args, const char** arg_names); -// The returned value must be be released with avs_release_value - -AVSC_API(AVS_Value, avs_get_var)(AVS_ScriptEnvironment *, const char* name); -// The returned value must be be released with avs_release_value - -AVSC_API(int, avs_set_var)(AVS_ScriptEnvironment *, const char* name, AVS_Value val); - -AVSC_API(int, avs_set_global_var)(AVS_ScriptEnvironment *, const char* name, const AVS_Value val); - -//void avs_push_context(AVS_ScriptEnvironment *, int level=0); -//void avs_pop_context(AVS_ScriptEnvironment *); - -AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *, - const AVS_VideoInfo * vi, int align); -// align should be at least 16 -#if defined __cplusplus -} -#endif // __cplusplus - -#ifndef AVSC_NO_DECLSPEC -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);} - -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);} -#endif - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf); - -AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, unsigned char* dstp, int dst_pitch, const unsigned char* srcp, int src_pitch, int row_size, int height); - -typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env); -AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data); - -AVSC_API(AVS_VideoFrame *, avs_subframe)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height); -// The returned video frame must be be released - -AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem); - -AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir); - -// avisynth.dll exports this; it's a way to use it as a library, without -// writing an AVS script or without going through AVIFile. -AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version); -#if defined __cplusplus -} -#endif // __cplusplus - -// this symbol is the entry point for the plugin and must -// be defined -AVSC_EXPORT -const char * AVSC_CC avisynth_c_plugin_init(AVS_ScriptEnvironment* env); - - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *); - - -AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV); -// The returned video frame must be be released -#if defined __cplusplus -} -#endif // __cplusplus - -#endif //__AVXSYNTH_C__ diff --git a/compat/avisynth/windowsPorts/basicDataTypeConversions.h b/compat/avisynth/windowsPorts/basicDataTypeConversions.h deleted file mode 100644 index ff367d5a2a..0000000000 --- a/compat/avisynth/windowsPorts/basicDataTypeConversions.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __DATA_TYPE_CONVERSIONS_H__ -#define __DATA_TYPE_CONVERSIONS_H__ - -#include -#include - -#ifdef __cplusplus -namespace avxsynth { -#endif // __cplusplus - -typedef int64_t __int64; -typedef int32_t __int32; -#ifdef __cplusplus -typedef bool BOOL; -#else -typedef uint32_t BOOL; -#endif // __cplusplus -typedef void* HMODULE; -typedef void* LPVOID; -typedef void* PVOID; -typedef PVOID HANDLE; -typedef HANDLE HWND; -typedef HANDLE HINSTANCE; -typedef void* HDC; -typedef void* HBITMAP; -typedef void* HICON; -typedef void* HFONT; -typedef void* HGDIOBJ; -typedef void* HBRUSH; -typedef void* HMMIO; -typedef void* HACMSTREAM; -typedef void* HACMDRIVER; -typedef void* HIC; -typedef void* HACMOBJ; -typedef HACMSTREAM* LPHACMSTREAM; -typedef void* HACMDRIVERID; -typedef void* LPHACMDRIVER; -typedef unsigned char BYTE; -typedef BYTE* LPBYTE; -typedef char TCHAR; -typedef TCHAR* LPTSTR; -typedef const TCHAR* LPCTSTR; -typedef char* LPSTR; -typedef LPSTR LPOLESTR; -typedef const char* LPCSTR; -typedef LPCSTR LPCOLESTR; -typedef wchar_t WCHAR; -typedef unsigned short WORD; -typedef unsigned int UINT; -typedef UINT MMRESULT; -typedef uint32_t DWORD; -typedef DWORD COLORREF; -typedef DWORD FOURCC; -typedef DWORD HRESULT; -typedef DWORD* LPDWORD; -typedef DWORD* DWORD_PTR; -typedef int32_t LONG; -typedef int32_t* LONG_PTR; -typedef LONG_PTR LRESULT; -typedef uint32_t ULONG; -typedef uint32_t* ULONG_PTR; -//typedef __int64_t intptr_t; -typedef uint64_t _fsize_t; - - -// -// Structures -// - -typedef struct _GUID { - DWORD Data1; - WORD Data2; - WORD Data3; - BYTE Data4[8]; -} GUID; - -typedef GUID REFIID; -typedef GUID CLSID; -typedef CLSID* LPCLSID; -typedef GUID IID; - -#ifdef __cplusplus -}; // namespace avxsynth -#endif // __cplusplus -#endif // __DATA_TYPE_CONVERSIONS_H__ diff --git a/compat/avisynth/windowsPorts/windows2linux.h b/compat/avisynth/windowsPorts/windows2linux.h deleted file mode 100644 index 7cf4600266..0000000000 --- a/compat/avisynth/windowsPorts/windows2linux.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef __WINDOWS2LINUX_H__ -#define __WINDOWS2LINUX_H__ - -/* - * LINUX SPECIFIC DEFINITIONS -*/ -// -// Data types conversions -// -#include -#include -#include "basicDataTypeConversions.h" - -#ifdef __cplusplus -namespace avxsynth { -#endif // __cplusplus -// -// purposefully define the following MSFT definitions -// to mean nothing (as they do not mean anything on Linux) -// -#define __stdcall -#define __cdecl -#define noreturn -#define __declspec(x) -#define STDAPI extern "C" HRESULT -#define STDMETHODIMP HRESULT __stdcall -#define STDMETHODIMP_(x) x __stdcall - -#define STDMETHOD(x) virtual HRESULT x -#define STDMETHOD_(a, x) virtual a x - -#ifndef TRUE -#define TRUE true -#endif - -#ifndef FALSE -#define FALSE false -#endif - -#define S_OK (0x00000000) -#define S_FALSE (0x00000001) -#define E_NOINTERFACE (0X80004002) -#define E_POINTER (0x80004003) -#define E_FAIL (0x80004005) -#define E_OUTOFMEMORY (0x8007000E) - -#define INVALID_HANDLE_VALUE ((HANDLE)((LONG_PTR)-1)) -#define FAILED(hr) ((hr) & 0x80000000) -#define SUCCEEDED(hr) (!FAILED(hr)) - - -// -// Functions -// -#define MAKEDWORD(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) -#define MAKEWORD(a,b) (((a) << 8) | (b)) - -#define lstrlen strlen -#define lstrcpy strcpy -#define lstrcmpi strcasecmp -#define _stricmp strcasecmp -#define InterlockedIncrement(x) __sync_fetch_and_add((x), 1) -#define InterlockedDecrement(x) __sync_fetch_and_sub((x), 1) -// Windows uses (new, old) ordering but GCC has (old, new) -#define InterlockedCompareExchange(x,y,z) __sync_val_compare_and_swap(x,z,y) - -#define UInt32x32To64(a, b) ( (uint64_t) ( ((uint64_t)((uint32_t)(a))) * ((uint32_t)(b)) ) ) -#define Int64ShrlMod32(a, b) ( (uint64_t) ( (uint64_t)(a) >> (b) ) ) -#define Int32x32To64(a, b) ((__int64)(((__int64)((long)(a))) * ((long)(b)))) - -#define MulDiv(nNumber, nNumerator, nDenominator) (int32_t) (((int64_t) (nNumber) * (int64_t) (nNumerator) + (int64_t) ((nDenominator)/2)) / (int64_t) (nDenominator)) - -#ifdef __cplusplus -}; // namespace avxsynth -#endif // __cplusplus - -#endif // __WINDOWS2LINUX_H__ From patchwork Wed Mar 11 10:50:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hutchinson X-Patchwork-Id: 18119 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 05F9744AA25 for ; Wed, 11 Mar 2020 12:50:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C980868ACB7; Wed, 11 Mar 2020 12:50:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f45.google.com (mail-yw1-f45.google.com [209.85.161.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C40168816E for ; Wed, 11 Mar 2020 12:50:29 +0200 (EET) Received: by mail-yw1-f45.google.com with SMTP id x5so1493526ywb.13 for ; Wed, 11 Mar 2020 03:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OwigjMMaFqjTWXVh/Z4E42hzB5O0JQi3dIjoabFs2Vg=; b=qajdToN6/pnBlgW0n0IvXl2p7OHlDBbuhvp7gTOtn5lI5q0x2TqienjlQMrhAd6ZN5 QaVxDqN4YseYyAtOuqrYFAh+RilBic45fvacfM5aptvzkLuWIU/8DI1jUKxiSLNDQOrD XsvpEDaHbnoDP77fWIcfRXW5Hv8sufAmEoFpUtQxECezxocWuX0KKAbysqKKIF/agsch hNj80SHab076ZigvwVmTu2B/m2hLF2coK/ZVS/+/qs/vFZiF65HN7ZTUR11++7NFbHrw XVFoR0TECJ8gGlIX6bFrek2V5pBQsOo6iOl7rP2XlOyecFZI53abPJbwsg9iSwCUKPME gTnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OwigjMMaFqjTWXVh/Z4E42hzB5O0JQi3dIjoabFs2Vg=; b=b/XI+N7xqc6/jyBGOxdFqqV0FK59Jyh7qcafpQYy3wJm1zIvN6UNPiOS6wFFG/hBHe D6lFC7t0nky79+B0KmeJoQJ7G9SSk+vUQj648Q0ywvLDKksU9Pc/oP6g5eXJBhzgLT9T qanmUOmeW7xz1dzBn6dxSlRb37R7h5TESlcC+ZUf8cE38B30Z6mOs5YAFOD37WI/cCiJ dQNEdj+6gmR8vf0twDAKLrK3J8Sv9c98mc00pO9iJ4fhlw5Pi/w2SHZG0oyroRRVh7aZ 99VymVoEye/cqIFKo/UkhiUsaPuzr3lOzYF9hVh0TMD6oCMd/kLPbsRbx2qOP2VJdc6I W04g== X-Gm-Message-State: ANhLgQ1W5iFeUYx833+uC8l+5AcyZ1LLebwmrf/0Pyl3ubv4WTxIhT3w ikXylq8jTmX/wgzONb1dPDeF42NQ X-Google-Smtp-Source: ADFU+vv7+9roQdHNvWmG+exS25KDZID7HRE5q7JrG6zQQuI7Zx7B60sORWCAIuPmSnNZ+VKksQkkrg== X-Received: by 2002:a81:1a08:: with SMTP id a8mr2454801ywa.255.1583923827765; Wed, 11 Mar 2020 03:50:27 -0700 (PDT) Received: from localhost.localdomain ([75.115.109.114]) by smtp.gmail.com with ESMTPSA id t186sm4344839ywb.37.2020.03.11.03.50.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:50:27 -0700 (PDT) From: Stephen Hutchinson To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Mar 2020 06:50:18 -0400 Message-Id: <20200311105019.8553-5-qyot27@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105019.8553-1-qyot27@gmail.com> References: <20200311105019.8553-1-qyot27@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/5] doc/general.texi: AviSynth+ works on Linux now, AvxSynth is gone. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- doc/general.texi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 87eaad7791..e92de9d954 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -58,8 +58,8 @@ For Windows, supported AviSynth variants are @url{http://avisynth.nl, AviSynth 2.6 RC1 or higher} for 32-bit builds and @url{http://avisynth.nl/index.php/AviSynth+, AviSynth+ r1718 or higher} for 32-bit and 64-bit builds. -For Linux and OS X, the supported AviSynth variant is -@url{https://github.com/avxsynth/avxsynth, AvxSynth}. +For Linux and OS X, the only supported AviSynth variant is +@url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}, starting with version 3.5. @float NOTE In 2016, AviSynth+ added support for building with GCC. However, due to @@ -77,9 +77,9 @@ GCC builds of AviSynth+ without any special flags. @end float @float NOTE -AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg +AviSynth(+) is loaded dynamically. Distributors can build FFmpeg with @code{--enable-avisynth}, and the binaries will work regardless of the -end user having AviSynth or AvxSynth installed - they'll only need to be +end user having AviSynth installed - they'll only need to be installed to use AviSynth scripts (obviously). @end float From patchwork Wed Mar 11 10:50:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hutchinson X-Patchwork-Id: 18122 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EB27344B197 for ; Wed, 11 Mar 2020 12:57:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C844B68972A; Wed, 11 Mar 2020 12:57:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-yw1-f48.google.com (mail-yw1-f48.google.com [209.85.161.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B6AAE6880D7 for ; Wed, 11 Mar 2020 12:57:46 +0200 (EET) Received: by mail-yw1-f48.google.com with SMTP id c15so1541419ywn.7 for ; Wed, 11 Mar 2020 03:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ly/X5zHXtdePLM0hjg+DubzEaqVvc6eARRmesOQcRv4=; b=FOI+vLimgaXFwdU+sV5Iw88kF7wR3rDN2RDo8tz8ipVVP8zMAQXhzqGrqIxtgOl4o5 2k5RrfC6o+s+1Qef6l5FMz+HgxOX81X9el7vSUvE7x54WtUl5Wv4AAgAa5GJ/u7tb4vu Gm6/nhEoqbHAaA3ZP3sWNYqqmKVxcuN3zWIenNl1CU3L8wPhkhTo5bYz/0Tj1EodpVIi DHMixcLK/8W5amWIIerIjSOMSqE5rTGzszrMnEovT1hqdZxAg7wfqqHb8i9q+ZmkGbd6 xQMRdVQEW6X66XdYuEPCEqmf9LOTX5KyOhDqyeLbbtcS6xnJqukkUOqzRaAzz6QwOtbe H8gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ly/X5zHXtdePLM0hjg+DubzEaqVvc6eARRmesOQcRv4=; b=GVSb9EF5kS7Yiz6Fh6WMOuQevrUErSf+77zRQFPZID1fe4kjhV1Qo7e5LqnqjjGjJe DHVJYPIRXxr3CdqyOH0/vZNxeKUKVVw9BOCg18nX60Cy/7CDfz6X9o51TVPNlecN9hih rQqynosHwDFArdHHS+qDTSYspozB13CYYCVBzdHPvmB2q3x2/iTLnXJ2oFz8L4db9FJ5 Il4gIyBlPlLcR8q5w50ZsIy19QlzgAQy6n07OfOsjNY9Sm5TuajcUbovlrxmJQbqbfdH ys7ehQGAWsdaj+OgUnplMAXF/rWJMoWu+yQXKbiElGkVaBHXXWuRzLhoZiCxQq3g0IxG HhUw== X-Gm-Message-State: ANhLgQ20umEHb7GfiO3ft0bX1I5jTSxgemgyabSDpFZu3eyClkVDC/eV K7AcvDftdcaSFmipfTa1/0getPmW X-Google-Smtp-Source: ADFU+vuSgFetPtKcmlySA3yIIiMoHQLlYuW5LSM/45DVPdPTaJW5MT954VfWJb53r/LbIz8UfFlUPw== X-Received: by 2002:a0d:f603:: with SMTP id g3mr2550855ywf.232.1583923828227; Wed, 11 Mar 2020 03:50:28 -0700 (PDT) Received: from localhost.localdomain ([75.115.109.114]) by smtp.gmail.com with ESMTPSA id t186sm4344839ywb.37.2020.03.11.03.50.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 03:50:27 -0700 (PDT) From: Stephen Hutchinson To: ffmpeg-devel@ffmpeg.org Date: Wed, 11 Mar 2020 06:50:19 -0400 Message-Id: <20200311105019.8553-6-qyot27@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200311105019.8553-1-qyot27@gmail.com> References: <20200311105019.8553-1-qyot27@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] avisynth: fix deprecation warning X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/avisynth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 1970553e49..f3e8df933f 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -555,7 +555,7 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ - MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4); + MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL); arg = avs_new_value_string(filename_ansi);