Commit 9265364b authored by Diego Biurrun's avatar Diego Biurrun

build: Separate avisynth and avxsynth support

This simplifies the code.
parent 3d6135ea
......@@ -188,6 +188,7 @@ External library support:
themselves, not all their features will necessarily be usable by Libav.
--enable-avisynth video frameserver
--enable-avxsynth Linux version of AviSynth
--enable-bzlib bzip2 compression [autodetect]
--enable-frei0r video filtering plugins
--enable-gnutls crypto
......@@ -1268,6 +1269,7 @@ EXTERNAL_LIBRARY_LIST="
$EXTERNAL_LIBRARY_NONFREE_LIST
$EXTERNAL_LIBRARY_VERSION3_LIST
avisynth
avxsynth
bzlib
frei0r
gnutls
......@@ -2243,6 +2245,10 @@ vc1_parser_select="vc1dsp"
mjpeg2jpeg_bsf_select="jpegtables"
# external libraries
avisynth_deps="LoadLibrary"
avxsynth_deps="dlopen"
avisynth_demuxer_deps_any="avisynth avxsynth"
avisynth_demuxer_select="riffdec"
libdcadec_decoder_deps="libdcadec"
libfaac_encoder_deps="libfaac"
libfaac_encoder_select="audio_frame_queue"
......@@ -2302,8 +2308,6 @@ asf_muxer_select="riffenc"
asf_stream_muxer_select="asf_muxer"
avi_demuxer_select="iso_media riffdec"
avi_muxer_select="riffenc"
avisynth_demuxer_deps="avisynth"
avisynth_demuxer_select="riffdec"
caf_demuxer_select="iso_media riffdec"
dash_muxer_select="mp4_muxer"
dirac_demuxer_select="dirac_parser"
......@@ -4610,9 +4614,8 @@ for func in $MATH_FUNCS; do
done
# these are off by default, so fail if requested and not available
enabled avisynth && { check_lib "avisynth/avisynth_c.h windows.h" LoadLibrary ||
check_lib "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl ||
die "ERROR: LoadLibrary/dlopen not found, or avisynth header not found"; }
enabled avisynth && { check_header avisynth/avisynth_c.h || die "ERROR: avisynth/avisynth_c.h header not found"; }
enabled avxsynth && require avxsynth "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl
enabled cuda && check_lib cuda.h cuInit -lcuda
enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
......
......@@ -85,7 +85,6 @@ OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o
OBJS-$(CONFIG_AU_MUXER) += au.o rawenc.o
OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o
OBJS-$(CONFIG_AVI_MUXER) += avienc.o
OBJS-$(CONFIG_AVISYNTH) += avisynth.o
OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o swf.o
OBJS-$(CONFIG_AVS_DEMUXER) += avs.o voc_packet.o voc.o
OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o
......@@ -379,6 +378,7 @@ OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpegdec.o
OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpegenc.o
# external libraries
OBJS-$(CONFIG_AVISYNTH_DEMUXER) += avisynth.o
OBJS-$(CONFIG_LIBRTMP) += librtmp.o
# protocols I/O
......
......@@ -32,12 +32,11 @@
#define AVSC_NO_DECLSPEC
/* Platform-specific directives for AviSynth vs AvxSynth. */
#ifdef _WIN32
#if CONFIG_AVISYNTH
#include <windows.h>
#undef EXTERN_C
#include <avisynth/avisynth_c.h>
#define AVISYNTH_LIB "avisynth"
#define USING_AVISYNTH
#else
#include <dlfcn.h>
#include <avxsynth/avxsynth_c.h>
......@@ -66,7 +65,7 @@ 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
#if CONFIG_AVISYNTH
AVSC_DECLARE_FUNC(avs_bits_per_pixel);
AVSC_DECLARE_FUNC(avs_get_height_p);
AVSC_DECLARE_FUNC(avs_get_pitch_p);
......@@ -146,7 +145,7 @@ 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
#if CONFIG_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);
......@@ -253,7 +252,7 @@ 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
#if CONFIG_AVISYNTH
/* 10~16-bit YUV pix_fmts (AviSynth+) */
case AVS_CS_YUV444P10:
st->codecpar->format = AV_PIX_FMT_YUV444P10;
......@@ -509,7 +508,7 @@ static int avisynth_open_file(AVFormatContext *s)
AviSynthContext *avs = s->priv_data;
AVS_Value arg, val;
int ret;
#ifdef USING_AVISYNTH
#if CONFIG_AVISYNTH
char filename_ansi[MAX_PATH * 4];
wchar_t filename_wc[MAX_PATH * 4];
#endif
......@@ -517,7 +516,7 @@ static int avisynth_open_file(AVFormatContext *s)
if (ret = avisynth_context_create(s))
return ret;
#ifdef USING_AVISYNTH
#if CONFIG_AVISYNTH
/* 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,
......@@ -541,7 +540,7 @@ 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
#if CONFIG_AVISYNTH
/* On Windows, libav 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
......@@ -605,7 +604,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
if (discard)
return 0;
#ifdef USING_AVISYNTH
#if CONFIG_AVISYNTH
/* 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)
......@@ -649,7 +648,7 @@ 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
#if CONFIG_AVISYNTH
src_p = avs_library.avs_get_read_ptr_p(frame, plane);
pitch = avs_library.avs_get_pitch_p(frame, plane);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment