[FFmpeg-devel] [PATCH 29/87] avcodec/vaapi: Remove old and deprecated VAAPI context and header

James Almer jamrial at gmail.com
Mon Apr 19 17:09:26 EEST 2021


From: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

Deprecated in 851960f6f8cf1f946fe42fa36cf6598fac68072c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/Makefile       |  1 -
 libavcodec/avcodec.h      |  3 +-
 libavcodec/vaapi.h        | 86 ---------------------------------------
 libavcodec/vaapi_decode.c | 53 ------------------------
 libavcodec/vaapi_decode.h | 13 ------
 libavcodec/version.h      |  3 --
 6 files changed, 1 insertion(+), 158 deletions(-)
 delete mode 100644 libavcodec/vaapi.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 31b220025b..a640c548e5 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -19,7 +19,6 @@ HEADERS = ac3_parser.h                                                  \
           mediacodec.h                                                  \
           packet.h                                                      \
           qsv.h                                                         \
-          vaapi.h                                                       \
           vdpau.h                                                       \
           version.h                                                     \
           videotoolbox.h                                                \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 89e32f1c80..e817befa1c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1522,8 +1522,7 @@ typedef struct AVCodecContext {
      * For some hardware accelerators, a global context needs to be
      * provided by the user. In that case, this holds display-dependent
      * data FFmpeg cannot instantiate itself. Please refer to the
-     * FFmpeg HW accelerator documentation to know how to fill this
-     * is. e.g. for VA API, this is a struct vaapi_context.
+     * FFmpeg HW accelerator documentation to know how to fill this.
      * - encoding: unused
      * - decoding: Set by user
      */
diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h
deleted file mode 100644
index 2cf7da5889..0000000000
--- a/libavcodec/vaapi.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Video Acceleration API (shared data between FFmpeg and the video player)
- * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VAAPI_H
-#define AVCODEC_VAAPI_H
-
-/**
- * @file
- * @ingroup lavc_codec_hwaccel_vaapi
- * Public libavcodec VA API header.
- */
-
-#include <stdint.h>
-#include "libavutil/attributes.h"
-#include "version.h"
-
-#if FF_API_STRUCT_VAAPI_CONTEXT
-
-/**
- * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding
- * @ingroup lavc_codec_hwaccel
- * @{
- */
-
-/**
- * This structure is used to share data between the FFmpeg library and
- * the client video application.
- * This shall be zero-allocated and available as
- * AVCodecContext.hwaccel_context. All user members can be set once
- * during initialization or through each AVCodecContext.get_buffer()
- * function call. In any case, they must be valid prior to calling
- * decoding functions.
- *
- * Deprecated: use AVCodecContext.hw_frames_ctx instead.
- */
-struct attribute_deprecated vaapi_context {
-    /**
-     * Window system dependent data
-     *
-     * - encoding: unused
-     * - decoding: Set by user
-     */
-    void *display;
-
-    /**
-     * Configuration ID
-     *
-     * - encoding: unused
-     * - decoding: Set by user
-     */
-    uint32_t config_id;
-
-    /**
-     * Context ID (video decode pipeline)
-     *
-     * - encoding: unused
-     * - decoding: Set by user
-     */
-    uint32_t context_id;
-};
-
-/* @} */
-
-#endif /* FF_API_STRUCT_VAAPI_CONTEXT */
-
-#endif /* AVCODEC_VAAPI_H */
diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 57a0eb4e6e..958ddf49da 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -640,46 +640,6 @@ int ff_vaapi_decode_init(AVCodecContext *avctx)
     ctx->va_config  = VA_INVALID_ID;
     ctx->va_context = VA_INVALID_ID;
 
-#if FF_API_STRUCT_VAAPI_CONTEXT
-    if (avctx->hwaccel_context) {
-        av_log(avctx, AV_LOG_WARNING, "Using deprecated struct "
-               "vaapi_context in decode.\n");
-
-        ctx->have_old_context = 1;
-        ctx->old_context = avctx->hwaccel_context;
-
-        // Really we only want the VAAPI device context, but this
-        // allocates a whole generic device context because we don't
-        // have any other way to determine how big it should be.
-        ctx->device_ref =
-            av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
-        if (!ctx->device_ref) {
-            err = AVERROR(ENOMEM);
-            goto fail;
-        }
-        ctx->device = (AVHWDeviceContext*)ctx->device_ref->data;
-        ctx->hwctx  = ctx->device->hwctx;
-
-        ctx->hwctx->display = ctx->old_context->display;
-
-        // The old VAAPI decode setup assumed this quirk was always
-        // present, so set it here to avoid the behaviour changing.
-        ctx->hwctx->driver_quirks =
-            AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS;
-
-    }
-#endif
-
-#if FF_API_STRUCT_VAAPI_CONTEXT
-    if (ctx->have_old_context) {
-        ctx->va_config  = ctx->old_context->config_id;
-        ctx->va_context = ctx->old_context->context_id;
-
-        av_log(avctx, AV_LOG_DEBUG, "Using user-supplied decoder "
-               "context: %#x/%#x.\n", ctx->va_config, ctx->va_context);
-    } else {
-#endif
-
     err = ff_decode_get_hw_frames_ctx(avctx, AV_HWDEVICE_TYPE_VAAPI);
     if (err < 0)
         goto fail;
@@ -709,9 +669,6 @@ int ff_vaapi_decode_init(AVCodecContext *avctx)
 
     av_log(avctx, AV_LOG_DEBUG, "Decode context initialised: "
            "%#x/%#x.\n", ctx->va_config, ctx->va_context);
-#if FF_API_STRUCT_VAAPI_CONTEXT
-    }
-#endif
 
     return 0;
 
@@ -725,12 +682,6 @@ int ff_vaapi_decode_uninit(AVCodecContext *avctx)
     VAAPIDecodeContext *ctx = avctx->internal->hwaccel_priv_data;
     VAStatus vas;
 
-#if FF_API_STRUCT_VAAPI_CONTEXT
-    if (ctx->have_old_context) {
-        av_buffer_unref(&ctx->device_ref);
-    } else {
-#endif
-
     if (ctx->va_context != VA_INVALID_ID) {
         vas = vaDestroyContext(ctx->hwctx->display, ctx->va_context);
         if (vas != VA_STATUS_SUCCESS) {
@@ -748,9 +699,5 @@ int ff_vaapi_decode_uninit(AVCodecContext *avctx)
         }
     }
 
-#if FF_API_STRUCT_VAAPI_CONTEXT
-    }
-#endif
-
     return 0;
 }
diff --git a/libavcodec/vaapi_decode.h b/libavcodec/vaapi_decode.h
index 6b415dd1d3..6beda14e52 100644
--- a/libavcodec/vaapi_decode.h
+++ b/libavcodec/vaapi_decode.h
@@ -27,11 +27,6 @@
 
 #include "avcodec.h"
 
-#include "version.h"
-#if FF_API_STRUCT_VAAPI_CONTEXT
-#include "vaapi.h"
-#endif
-
 static inline VASurfaceID ff_vaapi_get_surface_id(AVFrame *pic)
 {
     return (uintptr_t)pic->data[3];
@@ -56,14 +51,6 @@ typedef struct VAAPIDecodeContext {
     VAConfigID            va_config;
     VAContextID           va_context;
 
-#if FF_API_STRUCT_VAAPI_CONTEXT
-FF_DISABLE_DEPRECATION_WARNINGS
-    int                   have_old_context;
-    struct vaapi_context *old_context;
-    AVBufferRef          *device_ref;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
     AVHWDeviceContext    *device;
     AVVAAPIDeviceContext *hwctx;
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 6e4a665b07..da36f1790d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -54,9 +54,6 @@
 #ifndef FF_API_CODED_FRAME
 #define FF_API_CODED_FRAME       (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
-#ifndef FF_API_STRUCT_VAAPI_CONTEXT
-#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
-#endif
 #ifndef FF_API_UNSANITIZED_BITRATES
 #define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
-- 
2.31.1



More information about the ffmpeg-devel mailing list