[FFmpeg-cvslog] avisynth: Exit gracefully when trying to serve video from v2.5.8.

Stephen Hutchinson git at videolan.org
Wed Aug 7 10:43:57 CEST 2013


ffmpeg | branch: master | Stephen Hutchinson <qyot27 at gmail.com> | Tue Aug  6 20:57:17 2013 -0400| [9db353bc4727d2a184778c110cf4ea0b9d1616cb] | committer: Michael Niedermayer

avisynth: Exit gracefully when trying to serve video from v2.5.8.

'Fixes' ticket #2526 insofar as it stops 2.5.8 from crashing and
tells the user to upgrade to 2.6 if they want to make video input
work. A real solution to #2526 would be to get video input from
2.5.8 to work right.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9db353bc4727d2a184778c110cf4ea0b9d1616cb
---

 libavformat/avisynth.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 03f1688..8a480ed 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -69,6 +69,7 @@ typedef struct {
     AVSC_DECLARE_FUNC(avs_get_audio);
     AVSC_DECLARE_FUNC(avs_get_error);
     AVSC_DECLARE_FUNC(avs_get_frame);
+    AVSC_DECLARE_FUNC(avs_get_version);
     AVSC_DECLARE_FUNC(avs_get_video_info);
     AVSC_DECLARE_FUNC(avs_invoke);
     AVSC_DECLARE_FUNC(avs_release_clip);
@@ -134,6 +135,7 @@ static av_cold int avisynth_load_library(void) {
     LOAD_AVS_FUNC(avs_get_audio, 0);
     LOAD_AVS_FUNC(avs_get_error, 1); // New to AviSynth 2.6
     LOAD_AVS_FUNC(avs_get_frame, 0);
+    LOAD_AVS_FUNC(avs_get_version, 0);
     LOAD_AVS_FUNC(avs_get_video_info, 0);
     LOAD_AVS_FUNC(avs_invoke, 0);
     LOAD_AVS_FUNC(avs_release_clip, 0);
@@ -479,7 +481,26 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, int dis
             pitch = -pitch;
         }
 
+    // An issue with avs_bit_blt on 2.5.8 prevents video from working correctly.
+    // This problem doesn't exist for 2.6 and AvxSynth, so enable the workaround
+    // for 2.5.8 only. This only displays the warning and exits if the script has
+    // video. 2.5.8's internal interface version is 3, so avs_get_version allows
+    // it to work only in the circumstance that the interface is 5 or higher (4 is
+    // unused).  There's a strong chance that AvxSynth, having been based on 2.5.8,
+    // would also be identified as interface version 3, but since AvxSynth doesn't
+    // suffer from this problem, special-case it.
+#ifdef _WIN32
+    if (avs_library->avs_get_version(avs->clip) > 3) {
         avs_library->avs_bit_blt(avs->env, dst_p, rowsize, src_p, pitch, rowsize, planeheight);
+    } else {
+        av_log(s, AV_LOG_ERROR, "Video input from AviSynth 2.5.8 is not supported. Please upgrade to 2.6.\n");
+        avs->error = 1;
+        av_freep(&pkt->data);
+        return AVERROR_UNKNOWN;
+    }
+#else
+        avs_library->avs_bit_blt(avs->env, dst_p, rowsize, src_p, pitch, rowsize, planeheight);
+#endif
         dst_p += rowsize * planeheight;
     }
 



More information about the ffmpeg-cvslog mailing list