Skip to content

Commit

Permalink
Adds support for FFmpeg 7
Browse files Browse the repository at this point in the history
  • Loading branch information
crsib committed Apr 23, 2024
1 parent 686f528 commit ae25684
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
extern "C"
{
#include "../../avutil/59/avconfig.h"
#include "../../ffmpeg-7.0.0-single-header.h"
}

#include <algorithm>

#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;
})();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
extern "C"
{
#include "../../avutil/59/avconfig.h"
#include "../../ffmpeg-7.0.0-single-header.h"
}

#include <cstring>
#include <numeric>

#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"
);

Original file line number Diff line number Diff line change
@@ -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 <cstring>

#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;
})();
}
Original file line number Diff line number Diff line change
@@ -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 <wx/log.h>

#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;
})();
}
Original file line number Diff line number Diff line change
@@ -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 */

0 comments on commit ae25684

Please sign in to comment.