diff --git a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/CMakeLists.txt b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/CMakeLists.txt index 196f61edb07d..3a3a0a20c31b 100644 --- a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/CMakeLists.txt +++ b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/CMakeLists.txt @@ -79,6 +79,13 @@ if (${_OPT}use_ffmpeg) impl/avformat/60/AVFormatImpl.cpp impl/avutil/58/AVUtilImpl.cpp + impl/ffmpeg-7.0.0-single-header.h + impl/avutil/59/avconfig.h + impl/avcodec/61/AVCodecIDLookup.cpp + impl/avcodec/61/AVCodecImpl.cpp + impl/avformat/61/AVFormatImpl.cpp + impl/avutil/59/AVUtilImpl.cpp + # Loaders impl/avcodec/AVCodecFunctionsLoader.cpp impl/avcodec/AVCodecFunctionsLoader.h diff --git a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/AVCodecIDLookup.inl b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/AVCodecIDLookup.inl index 8a77ff849fe4..7bf5e817aaa1 100644 --- a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/AVCodecIDLookup.inl +++ b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/AVCodecIDLookup.inl @@ -203,7 +203,11 @@ AVCodecIDFwd AVCodecIDLookup[AUDACITY_AV_CODEC_ID_LAST] = { AV_CODEC_ID_012V, AV_CODEC_ID_G2M, AV_CODEC_ID_AVUI, +#if LIBAVUTIL_VERSION_MAJOR < 59 AV_CODEC_ID_AYUV, +#else + AV_CODEC_ID_NONE, +#endif AV_CODEC_ID_TARGA_Y216, AV_CODEC_ID_V308, AV_CODEC_ID_V408, diff --git a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avcodec/61/AVCodecIDLookup.cpp b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avcodec/61/AVCodecIDLookup.cpp new file mode 100644 index 000000000000..9c90841a8f57 --- /dev/null +++ b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avcodec/61/AVCodecIDLookup.cpp @@ -0,0 +1,37 @@ +extern "C" +{ +#include "../../avutil/59/avconfig.h" +#include "../../ffmpeg-7.0.0-single-header.h" +} + +#include + +#include "AVCodecID.h" + +#include "../../FFmpegAPIResolver.h" + +#define AV_CODEC_ID_ESCAPE130_DEPRECATED AV_CODEC_ID_ESCAPE130 +#define AV_CODEC_ID_G2M_DEPRECATED AV_CODEC_ID_G2M +#define AV_CODEC_ID_WEBP_DEPRECATED AV_CODEC_ID_WEBP +#define AV_CODEC_ID_HEVC_DEPRECATED AV_CODEC_ID_HEVC +#define AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED AV_CODEC_ID_PCM_S24LE_PLANAR +#define AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED AV_CODEC_ID_PCM_S32LE_PLANAR +#define AV_CODEC_ID_OPUS_DEPRECATED AV_CODEC_ID_OPUS +#define AV_CODEC_ID_TAK_DEPRECATED AV_CODEC_ID_TAK + +#define AV_CODEC_ID_VIMA AV_CODEC_ID_ADPCM_VIMA + +namespace avcodec_61 +{ +#include "../../AVCodecIDLookup.inl" + +const bool registered = ([]() { + FFmpegAPIResolver::Get().AddAVCodecIDResolver(61, { + &GetAVCodeID, + &GetAudacityCodecID + }); + + return true; +})(); + +} diff --git a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avcodec/61/AVCodecImpl.cpp b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avcodec/61/AVCodecImpl.cpp new file mode 100644 index 000000000000..6fbf9a12960a --- /dev/null +++ b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avcodec/61/AVCodecImpl.cpp @@ -0,0 +1,46 @@ +extern "C" +{ +#include "../../avutil/59/avconfig.h" +#include "../../ffmpeg-7.0.0-single-header.h" +} + +#include +#include + +#include "float_cast.h" + +#include "FFmpegFunctions.h" + +#include "wrappers/AVCodecContextWrapper.h" +#include "wrappers/AVCodecWrapper.h" +#include "wrappers/AVPacketWrapper.h" + +#include "../../FFmpegAPIResolver.h" + +namespace avcodec_61 +{ +#include "../AVCodecContextWrapperImpl.inl" +#include "../AVCodecWrapperImpl.inl" +#include "../AVPacketWrapperImpl.inl" + +const bool registered = ([]() { + FFmpegAPIResolver::Get().AddAVCodecFactories(61, { + &CreateAVCodecContextWrapper, + &CreateAVCodecContextWrapperFromCodec, + &CreateAVCodecWrapper, + &CreateAVPacketWrapper, + }); + + return true; +})(); +} + +#include "FFmpegTypes.h" +static_assert( + AV_CODEC_FLAG_GLOBAL_HEADER == AUDACITY_AV_CODEC_FLAG_GLOBAL_HEADER + && AV_CODEC_CAP_SMALL_LAST_FRAME == AUDACITY_AV_CODEC_CAP_SMALL_LAST_FRAME + && AV_CODEC_FLAG_QSCALE == AUDACITY_AV_CODEC_FLAG_QSCALE +, + "FFmpeg constants don't match" +); + diff --git a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avformat/61/AVFormatImpl.cpp b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avformat/61/AVFormatImpl.cpp new file mode 100644 index 000000000000..1189a9d6d451 --- /dev/null +++ b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avformat/61/AVFormatImpl.cpp @@ -0,0 +1,50 @@ +/********************************************************************** + + Audacity: A Digital Audio Editor + + AVFormatImpl.cpp + + Dmitry Vedenko + +**********************************************************************/ + +extern "C" +{ +#include "../../avutil/59/avconfig.h" +#include "../../ffmpeg-7.0.0-single-header.h" +} + +#include + +#include "FFmpegFunctions.h" + +#include "wrappers/AVFormatContextWrapper.h" +#include "wrappers/AVInputFormatWrapper.h" +#include "wrappers/AVIOContextWrapper.h" +#include "wrappers/AVOutputFormatWrapper.h" +#include "wrappers/AVStreamWrapper.h" + +#include "wrappers/AVCodecWrapper.h" + +#include "../../FFmpegAPIResolver.h" + +namespace avformat_61 +{ +#include "../AVFormatContextWrapperImpl.inl" +#include "../AVInputFormatWrapperImpl.inl" +#include "../AVIOContextWrapperImpl.inl" +#include "../AVOutputFormatWrapperImpl.inl" +#include "../AVStreamWrapperImpl.inl" + +const bool registered = ([]() { + FFmpegAPIResolver::Get().AddAVFormatFactories(61, { + &CreateAVFormatContextWrapper, + &CreateAVInputFormatWrapper, + &CreateAVIOContextWrapper, + &CreateAVOutputFormatWrapper, + &CreateAVStreamWrapper, + }); + + return true; +})(); +} diff --git a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/59/AVUtilImpl.cpp b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/59/AVUtilImpl.cpp new file mode 100644 index 000000000000..563409e3f490 --- /dev/null +++ b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/59/AVUtilImpl.cpp @@ -0,0 +1,44 @@ +/********************************************************************** + + Audacity: A Digital Audio Editor + + AVUtilImpl.cpp + + Dmitry Vedenko + +**********************************************************************/ + +extern "C" +{ +#include "../../avutil/59/avconfig.h" +#include "../../ffmpeg-7.0.0-single-header.h" +} + +#include + +#include "FFmpegFunctions.h" + +#include "wrappers/AVChannelLayoutWrapper.h" +#include "wrappers/AVFrameWrapper.h" + +#include "../../FFmpegAPIResolver.h" +#include "../../FFmpegLog.h" + +namespace avutil_59 +{ +#include "../AVChannelLayoutWrapperImpl.inl" +#include "../AVFrameWrapperImpl.inl" +#include "../FFmpegLogImpl.inl" + +const bool registered = ([]() { + FFmpegAPIResolver::Get().AddAVUtilFactories(59, { + &CreateAVFrameWrapper, + &CreateLogCallbackSetter, + &CreateDefaultChannelLayout, + &CreateLegacyChannelLayout, + &CreateAVChannelLayout + }); + + return true; +})(); +} diff --git a/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/59/avconfig.h b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/59/avconfig.h new file mode 100644 index 000000000000..f6685b72c190 --- /dev/null +++ b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/59/avconfig.h @@ -0,0 +1,8 @@ +/* Generated by ffconf */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0 +#define AV_HAVE_INCOMPATIBLE_FORK_ABI 0 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/modules/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/AVChannelLayoutWrapperImpl.inl b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/AVChannelLayoutWrapperImpl.inl similarity index 100% rename from modules/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/AVChannelLayoutWrapperImpl.inl rename to modules/import-export/mod-ffmpeg/lib-ffmpeg-support/impl/avutil/AVChannelLayoutWrapperImpl.inl diff --git a/modules/mod-ffmpeg/lib-ffmpeg-support/wrappers/AVChannelLayoutWrapper.h b/modules/import-export/mod-ffmpeg/lib-ffmpeg-support/wrappers/AVChannelLayoutWrapper.h similarity index 100% rename from modules/mod-ffmpeg/lib-ffmpeg-support/wrappers/AVChannelLayoutWrapper.h rename to modules/import-export/mod-ffmpeg/lib-ffmpeg-support/wrappers/AVChannelLayoutWrapper.h