diff mbox

[FFmpeg-devel,1/2] avisynth: simplify the pix_fmt check for the newer AviSynth API

Message ID 1470885275-4433-1-git-send-email-qyot27@gmail.com
State Accepted
Commit aaae59700f7fc10fd80cb93b38c5d109900872d9
Headers show

Commit Message

Stephen Hutchinson Aug. 11, 2016, 3:14 a.m. UTC
The values don't need to be hardcoded since the correct values are
returned by avs_bits_per_pixel.
---
 libavformat/avisynth.c | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)

Comments

Michael Niedermayer Aug. 11, 2016, 10:31 a.m. UTC | #1
On Wed, Aug 10, 2016 at 11:14:35PM -0400, Stephen Hutchinson wrote:
> The values don't need to be hardcoded since the correct values are
> returned by avs_bits_per_pixel.
> ---
>  libavformat/avisynth.c | 27 +++++----------------------
>  1 file changed, 5 insertions(+), 22 deletions(-)

does this work with all supported AviSynth versions ?

[...]
Stephen Hutchinson Aug. 11, 2016, 2:55 p.m. UTC | #2
On 8/11/2016 6:31 AM, Michael Niedermayer wrote:
> does this work with all supported AviSynth versions ?
>

Yes, it works with both 2.6 and Plus.
Michael Niedermayer Aug. 11, 2016, 5:45 p.m. UTC | #3
On Thu, Aug 11, 2016 at 10:55:22AM -0400, Stephen Hutchinson wrote:
> On 8/11/2016 6:31 AM, Michael Niedermayer wrote:
> >does this work with all supported AviSynth versions ?
> >
> 
> Yes, it works with both 2.6 and Plus.

ok ill apply it in a moment

thx

[...]
diff mbox

Patch

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index d6167fa..1a175cb 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -68,10 +68,6 @@  typedef struct AviSynthLibrary {
     AVSC_DECLARE_FUNC(avs_get_pitch_p);
     AVSC_DECLARE_FUNC(avs_get_read_ptr_p);
     AVSC_DECLARE_FUNC(avs_get_row_size_p);
-    AVSC_DECLARE_FUNC(avs_is_yv24);
-    AVSC_DECLARE_FUNC(avs_is_yv16);
-    AVSC_DECLARE_FUNC(avs_is_yv411);
-    AVSC_DECLARE_FUNC(avs_is_y8);
 #endif
 #undef AVSC_DECLARE_FUNC
 } AviSynthLibrary;
@@ -142,10 +138,6 @@  static av_cold int avisynth_load_library(void)
     LOAD_AVS_FUNC(avs_get_pitch_p, 1);
     LOAD_AVS_FUNC(avs_get_read_ptr_p, 1);
     LOAD_AVS_FUNC(avs_get_row_size_p, 1);
-    LOAD_AVS_FUNC(avs_is_yv24, 1);
-    LOAD_AVS_FUNC(avs_is_yv16, 1);
-    LOAD_AVS_FUNC(avs_is_yv411, 1);
-    LOAD_AVS_FUNC(avs_is_y8, 1);
 #endif
 #undef LOAD_AVS_FUNC
 
@@ -465,20 +457,11 @@  static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
         return 0;
 
 #ifdef USING_AVISYNTH
-    /* Define the bpp values for the new AviSynth 2.6 colorspaces.
-     * Since AvxSynth doesn't have these functions, special-case
-     * it in order to avoid implicit declaration errors. */
-
-    if (avs_library.avs_is_yv24(avs->vi))
-        bits = 24;
-    else if (avs_library.avs_is_yv16(avs->vi))
-        bits = 16;
-    else if (avs_library.avs_is_yv411(avs->vi))
-        bits = 12;
-    else if (avs_library.avs_is_y8(avs->vi))
-        bits = 8;
-    else
-        bits = avs_library.avs_bits_per_pixel(avs->vi);
+    /* 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);
 #endif