| 1 | // Copyright (C) 2024 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QFFMPEGDEFS_P_H |
| 5 | #define QFFMPEGDEFS_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qtconfigmacros.h" |
| 19 | |
| 20 | #include <limits> |
| 21 | #include <unordered_set> |
| 22 | |
| 23 | extern "C" { |
| 24 | #include <libavformat/avformat.h> |
| 25 | #include <libavcodec/avcodec.h> |
| 26 | #include <libswresample/swresample.h> |
| 27 | #include <libavutil/avutil.h> |
| 28 | #include <libswscale/swscale.h> |
| 29 | } |
| 30 | |
| 31 | #define QT_FFMPEG_HAS_AV_CHANNEL_LAYOUT \ |
| 32 | (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 24, 100)) // since FFmpeg n5.1 |
| 33 | #define QT_FFMPEG_HAS_VULKAN \ |
| 34 | (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 91, 100)) // since FFmpeg n4.3 |
| 35 | #define QT_FFMPEG_HAS_FRAME_TIME_BASE \ |
| 36 | (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 18, 100)) // since FFmpeg n5.0 |
| 37 | #define QT_FFMPEG_HAS_FRAME_DURATION \ |
| 38 | (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 3, 100)) // since FFmpeg n6.0 |
| 39 | #define QT_FFMPEG_STREAM_SIDE_DATA_DEPRECATED \ |
| 40 | (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 15, 100)) // since FFmpeg n6.1 |
| 41 | #define QT_FFMPEG_HAS_D3D12VA \ |
| 42 | (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(59, 8, 100)) // since FFmpeg n7.0 |
| 43 | #define QT_FFMPEG_SWR_CONST_CH_LAYOUT \ |
| 44 | (LIBSWRESAMPLE_VERSION_INT >= AV_VERSION_INT(4, 9, 100)) |
| 45 | #define QT_FFMPEG_AVIO_WRITE_CONST \ |
| 46 | (LIBAVFORMAT_VERSION_MAJOR >= 61) |
| 47 | #define QT_CODEC_PARAMETERS_HAVE_FRAMERATE \ |
| 48 | (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 11, 100)) // since FFmpeg n6.1 |
| 49 | #define QT_FFMPEG_HAS_AVCODEC_GET_SUPPORTED_CONFIG \ |
| 50 | (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(59, 39, 100)) // since FFmpeg n7.1 |
| 51 | |
| 52 | QT_BEGIN_NAMESPACE |
| 53 | |
| 54 | namespace QFFmpeg { |
| 55 | |
| 56 | #if QT_FFMPEG_HAS_AV_CHANNEL_LAYOUT |
| 57 | using ChannelLayoutT = AVChannelLayout; |
| 58 | #else |
| 59 | using ChannelLayoutT = uint64_t; |
| 60 | #endif |
| 61 | |
| 62 | } // namespace QFFmpeg |
| 63 | |
| 64 | using PixelOrSampleFormat = int; |
| 65 | using AVScore = int; |
| 66 | constexpr AVScore BestAVScore = std::numeric_limits<AVScore>::max(); |
| 67 | constexpr AVScore DefaultAVScore = 0; |
| 68 | constexpr AVScore NotSuitableAVScore = std::numeric_limits<AVScore>::min(); |
| 69 | constexpr AVScore MinAVScore = NotSuitableAVScore + 1; |
| 70 | |
| 71 | using AVPixelFormatSet = std::unordered_set<AVPixelFormat>; |
| 72 | |
| 73 | QT_END_NAMESPACE |
| 74 | |
| 75 | #endif // QFFMPEGDEFS_P_H |
| 76 | |