changeset 33235:6e6eac0ea1b4

Replace usage of AVCodecContext member hurry_up by skip_idct and skip_frame. AVCodecContext member hurry_up is deprecated in favor of skip_idct and skip_frame and won't be applicable with libavcodec starting from major version number 53 by default. The configure hack FF_API_HURRY_UP=1 to allow further usage of hurry_up is no longer needed. As a result, usage of a recent standard ffmpeg as shared library is possible again.
author ib
date Sun, 24 Apr 2011 16:13:25 +0000
parents 2f5d6ec5c131
children 889bde9a7c11
files configure libmpcodecs/vd_ffmpeg.c
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sun Apr 24 10:44:12 2011 +0000
+++ b/configure	Sun Apr 24 16:13:25 2011 +0000
@@ -6870,7 +6870,7 @@
   die "MPlayer will not compile without libavutil in the source tree."
 ffmpeg=no
 if test "$ffmpeg_a" = auto ; then
-  test -d ffmpeg/libavutil && ffmpeg_a=yes && ffmpeg=yes && extra_cflags="$extra_cflags -DFF_API_HURRY_UP=1 -DFF_API_MAX_STREAMS=0"
+  test -d ffmpeg/libavutil && ffmpeg_a=yes && ffmpeg=yes && extra_cflags="$extra_cflags -DFF_API_MAX_STREAMS=0"
 elif test "$ffmpeg_so" = auto ; then
   ffmpeg_so=no
   if $_pkg_config --exists libavutil ; then
--- a/libmpcodecs/vd_ffmpeg.c	Sun Apr 24 10:44:12 2011 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Sun Apr 24 16:13:25 2011 +0000
@@ -103,6 +103,8 @@
 static int lavc_param_threads=1;
 static int lavc_param_bitexact=0;
 static char *lavc_avopt = NULL;
+static enum AVDiscard skip_idct;
+static enum AVDiscard skip_frame;
 
 static const mp_image_t mpi_no_picture =
 {
@@ -351,6 +353,9 @@
         }
     }
 
+    skip_idct = avctx->skip_idct;
+    skip_frame = avctx->skip_frame;
+
     mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "libavcodec.size: %d x %d\n", avctx->width, avctx->height);
     switch (sh->format) {
     case mmioFOURCC('S','V','Q','3'):
@@ -609,13 +614,13 @@
             type = MP_IMGTYPE_STATIC;
             flags |= MP_IMGFLAG_PRESERVE;
         }
-        flags|=(!avctx->hurry_up && ctx->do_slices) ?
+        flags|=(avctx->skip_idct<=AVDISCARD_DEFAULT && avctx->skip_frame<=AVDISCARD_DEFAULT && ctx->do_slices) ?
                  MP_IMGFLAG_DRAW_CALLBACK:0;
         mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type == MP_IMGTYPE_STATIC ? "using STATIC\n" : "using TEMP\n");
     } else {
         if(!pic->reference){
             ctx->b_count++;
-            flags|=(!avctx->hurry_up && ctx->do_slices) ?
+            flags|=(avctx->skip_idct<=AVDISCARD_DEFAULT && avctx->skip_frame<=AVDISCARD_DEFAULT && ctx->do_slices) ?
                      MP_IMGFLAG_DRAW_CALLBACK:0;
         }else{
             ctx->ip_count++;
@@ -827,7 +832,14 @@
         }
     }
 
-    avctx->hurry_up=(flags&3)?((flags&2)?2:1):0;
+    avctx->skip_idct = skip_idct;
+    avctx->skip_frame = skip_frame;
+
+    if (flags&3) {
+        avctx->skip_frame = AVDISCARD_NONREF;
+        if (flags&2)
+            avctx->skip_idct = AVDISCARD_ALL;
+    }
 
     mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "vd_ffmpeg data: %04x, %04x, %04x, %04x\n",
            ((int *)data)[0], ((int *)data)[1], ((int *)data)[2], ((int *)data)[3]);