[FFmpeg-devel] [PATCH 3/5] avcodec/hwconfig: Move HWACCEL_CAP_* to a new header

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Aug 2 09:43:30 EEST 2023


libavcodec/hwconfig.h currently contains HWACCEL_CAP_* flags
as well as the definition of AVCodecHWConfigInternal and some
macros to create them.

The users of these two are nearly disjoint: The flags are used
by files providing AVHWAccels whereas AVCodecHWConfigInternal
is used by files providing codecs (for FFCodec.hw_configs).

This patch therefore moves these flags to a new file hwaccel_internal.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/hwaccel_internal.h | 29 +++++++++++++++++++++++++++++
 libavcodec/hwconfig.h         |  5 -----
 libavcodec/pthread_frame.c    |  1 +
 libavcodec/vaapi_av1.c        |  3 +--
 libavcodec/vaapi_h264.c       |  2 +-
 libavcodec/vaapi_hevc.c       |  2 +-
 libavcodec/vaapi_mjpeg.c      |  2 +-
 libavcodec/vaapi_mpeg2.c      |  2 +-
 libavcodec/vaapi_mpeg4.c      |  2 +-
 libavcodec/vaapi_vc1.c        |  3 +--
 libavcodec/vaapi_vp8.c        |  2 +-
 libavcodec/vaapi_vp9.c        |  2 +-
 libavcodec/vdpau_av1.c        |  2 +-
 libavcodec/vdpau_h264.c       |  2 +-
 libavcodec/vdpau_hevc.c       |  2 +-
 libavcodec/vdpau_mpeg12.c     |  2 +-
 libavcodec/vdpau_mpeg4.c      |  2 +-
 libavcodec/vdpau_vc1.c        |  2 +-
 libavcodec/vdpau_vp9.c        |  3 +--
 libavcodec/vulkan_decode.h    |  2 +-
 20 files changed, 47 insertions(+), 25 deletions(-)
 create mode 100644 libavcodec/hwaccel_internal.h

diff --git a/libavcodec/hwaccel_internal.h b/libavcodec/hwaccel_internal.h
new file mode 100644
index 0000000000..6e6f5c7cf9
--- /dev/null
+++ b/libavcodec/hwaccel_internal.h
@@ -0,0 +1,29 @@
+/*
+ * 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
+ */
+
+/**
+ * Header providing the internals of AVHWAccel.
+ */
+
+#ifndef AVCODEC_HWACCEL_INTERNAL_H
+#define AVCODEC_HWACCEL_INTERNAL_H
+
+#define HWACCEL_CAP_ASYNC_SAFE      (1 << 0)
+#define HWACCEL_CAP_THREAD_SAFE     (1 << 1)
+
+#endif /* AVCODEC_HWACCEL_INTERNAL */
diff --git a/libavcodec/hwconfig.h b/libavcodec/hwconfig.h
index e8c6186151..3b19d5edad 100644
--- a/libavcodec/hwconfig.h
+++ b/libavcodec/hwconfig.h
@@ -22,11 +22,6 @@
 #include "avcodec.h"
 #include "hwaccels.h"
 
-
-#define HWACCEL_CAP_ASYNC_SAFE      (1 << 0)
-#define HWACCEL_CAP_THREAD_SAFE     (1 << 1)
-
-
 typedef struct AVCodecHWConfigInternal {
     /**
      * This is the structure which will be returned to the user by
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index bc305f561f..c14010d803 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -31,6 +31,7 @@
 #include "avcodec_internal.h"
 #include "codec_internal.h"
 #include "decode.h"
+#include "hwaccel_internal.h"
 #include "hwconfig.h"
 #include "internal.h"
 #include "pthread_internal.h"
diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c
index d0339b2705..67ea6af697 100644
--- a/libavcodec/vaapi_av1.c
+++ b/libavcodec/vaapi_av1.c
@@ -19,8 +19,7 @@
  */
 
 #include "libavutil/frame.h"
-#include "libavutil/pixdesc.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vaapi_decode.h"
 #include "internal.h"
 #include "av1dec.h"
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index 9332aa6f31..e7f8e920b2 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -22,7 +22,7 @@
 
 #include "h264dec.h"
 #include "h264_ps.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vaapi_decode.h"
 
 /**
diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c
index 8b12484fff..87584d1edb 100644
--- a/libavcodec/vaapi_hevc.c
+++ b/libavcodec/vaapi_hevc.c
@@ -25,7 +25,7 @@
 
 #include "avcodec.h"
 #include "hevcdec.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vaapi_decode.h"
 #include "vaapi_hevc.h"
 #include "h265_profile_level.h"
diff --git a/libavcodec/vaapi_mjpeg.c b/libavcodec/vaapi_mjpeg.c
index 81582114b6..1947540ea1 100644
--- a/libavcodec/vaapi_mjpeg.c
+++ b/libavcodec/vaapi_mjpeg.c
@@ -19,7 +19,7 @@
 #include <va/va.h>
 #include <va/va_dec_jpeg.h>
 
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vaapi_decode.h"
 #include "mjpegdec.h"
 
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 5e2b889137..09636e0d26 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -20,7 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "mpegvideodec.h"
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
index 4e74e0382b..ff31ca4d92 100644
--- a/libavcodec/vaapi_mpeg4.c
+++ b/libavcodec/vaapi_mpeg4.c
@@ -23,7 +23,7 @@
 #include "config_components.h"
 
 #include "h263.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "mpeg4videodec.h"
 #include "mpegvideo.h"
 #include "mpegvideodec.h"
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
index fb2132e814..a179e4df11 100644
--- a/libavcodec/vaapi_vc1.c
+++ b/libavcodec/vaapi_vc1.c
@@ -22,11 +22,10 @@
 
 #include "config_components.h"
 
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "mpegvideodec.h"
 #include "vaapi_decode.h"
 #include "vc1.h"
-#include "vc1data.h"
 
 /** Translate FFmpeg MV modes to VA API */
 static int get_VAMvModeVC1(enum MVModes mv_mode)
diff --git a/libavcodec/vaapi_vp8.c b/libavcodec/vaapi_vp8.c
index 5b18bf8f34..f833133f9f 100644
--- a/libavcodec/vaapi_vp8.c
+++ b/libavcodec/vaapi_vp8.c
@@ -19,7 +19,7 @@
 #include <va/va.h>
 #include <va/va_dec_vp8.h>
 
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vaapi_decode.h"
 #include "vp8.h"
 
diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
index 776382f683..cf735bb7b2 100644
--- a/libavcodec/vaapi_vp9.c
+++ b/libavcodec/vaapi_vp9.c
@@ -22,7 +22,7 @@
 
 #include "libavutil/pixdesc.h"
 
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vaapi_decode.h"
 #include "vp9shared.h"
 
diff --git a/libavcodec/vdpau_av1.c b/libavcodec/vdpau_av1.c
index 3c3c8e61d1..557cbcebd7 100644
--- a/libavcodec/vdpau_av1.c
+++ b/libavcodec/vdpau_av1.c
@@ -25,7 +25,7 @@
 #include "avcodec.h"
 #include "internal.h"
 #include "av1dec.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
 
diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c
index 525e208495..1c5622662b 100644
--- a/libavcodec/vdpau_h264.c
+++ b/libavcodec/vdpau_h264.c
@@ -26,7 +26,7 @@
 #include "avcodec.h"
 #include "h264dec.h"
 #include "h264_ps.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "mpegutils.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
index 2669040f78..fb1b71abdc 100644
--- a/libavcodec/vdpau_hevc.c
+++ b/libavcodec/vdpau_hevc.c
@@ -25,7 +25,7 @@
 #include "avcodec.h"
 #include "hevc_data.h"
 #include "hevcdec.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
 #include "h265_profile_level.h"
diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c
index 79007aa1a8..d7223cdb4a 100644
--- a/libavcodec/vdpau_mpeg12.c
+++ b/libavcodec/vdpau_mpeg12.c
@@ -26,7 +26,7 @@
 #include <vdpau/vdpau.h>
 
 #include "avcodec.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "mpegvideo.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
diff --git a/libavcodec/vdpau_mpeg4.c b/libavcodec/vdpau_mpeg4.c
index 1211b1df2c..ce6d421196 100644
--- a/libavcodec/vdpau_mpeg4.c
+++ b/libavcodec/vdpau_mpeg4.c
@@ -24,7 +24,7 @@
 #include <vdpau/vdpau.h>
 
 #include "avcodec.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "mpeg4videodec.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c
index 00b33f420b..851a89d7cf 100644
--- a/libavcodec/vdpau_vc1.c
+++ b/libavcodec/vdpau_vc1.c
@@ -26,7 +26,7 @@
 #include <vdpau/vdpau.h>
 
 #include "avcodec.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "vc1.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
diff --git a/libavcodec/vdpau_vp9.c b/libavcodec/vdpau_vp9.c
index 49fe18189b..1e6a1fc007 100644
--- a/libavcodec/vdpau_vp9.c
+++ b/libavcodec/vdpau_vp9.c
@@ -23,9 +23,8 @@
 #include <vdpau/vdpau.h>
 #include "libavutil/pixdesc.h"
 #include "avcodec.h"
-#include "vp9data.h"
+#include "hwaccel_internal.h"
 #include "vp9dec.h"
-#include "hwconfig.h"
 #include "vdpau.h"
 #include "vdpau_internal.h"
 
diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h
index 1b4e1cc712..0aaa2e2de0 100644
--- a/libavcodec/vulkan_decode.h
+++ b/libavcodec/vulkan_decode.h
@@ -20,7 +20,7 @@
 #define AVCODEC_VULKAN_DECODE_H
 
 #include "decode.h"
-#include "hwconfig.h"
+#include "hwaccel_internal.h"
 #include "internal.h"
 
 #include "vulkan_video.h"
-- 
2.34.1



More information about the ffmpeg-devel mailing list