summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2016-11-14 17:22:51 +0100
committerDiego Biurrun <diego@biurrun.de>2016-12-06 17:49:05 +0100
commit9265364bec0af2e8b7c3a6de7bfc8291a0b70bca (patch)
treefe4d477d77309afff995b5c12e4f108b02960be0 /libavformat
parent3d6135eacf3b6a82c3024620c6a28169960464a7 (diff)
build: Separate avisynth and avxsynth support
This simplifies the code.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile2
-rw-r--r--libavformat/avisynth.c19
2 files changed, 10 insertions, 11 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index d06d5d6d82..6146cbe12a 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -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
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index d3b3ec478e..d0fe0fd7ea 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -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);