Fix: Build with FFmpeg 6.0

Pull Request #105377
This commit is contained in:
2023-03-02 15:12:35 +01:00
committed by Gitea
parent a2d988b5da
commit e0732b640a
4 changed files with 15 additions and 4 deletions

View File

@@ -44,6 +44,17 @@
# define FFMPEG_USE_OLD_CHANNEL_VARS # define FFMPEG_USE_OLD_CHANNEL_VARS
#endif #endif
/* AV_CODEC_CAP_AUTO_THREADS was renamed to AV_CODEC_CAP_OTHER_THREADS with
* upstream commit
* github.com/FFmpeg/FFmpeg/commit/7d09579190def3ef7562399489e628f3b65714ce
* (lavc 58.132.100) and removed with commit
* github.com/FFmpeg/FFmpeg/commit/10c9a0874cb361336237557391d306d26d43f137
* for ffmpeg 6.0.
*/
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,132,100)
# define AV_CODEC_CAP_OTHER_THREADS AV_CODEC_CAP_AUTO_THREADS
#endif
#if (LIBAVFORMAT_VERSION_MAJOR < 58) || \ #if (LIBAVFORMAT_VERSION_MAJOR < 58) || \
((LIBAVFORMAT_VERSION_MAJOR == 58) && (LIBAVFORMAT_VERSION_MINOR < 76)) ((LIBAVFORMAT_VERSION_MAJOR == 58) && (LIBAVFORMAT_VERSION_MINOR < 76))
# define FFMPEG_USE_DURATION_WORKAROUND 1 # define FFMPEG_USE_DURATION_WORKAROUND 1

View File

@@ -863,7 +863,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context,
255); 255);
st->avg_frame_rate = av_inv_q(c->time_base); st->avg_frame_rate = av_inv_q(c->time_base);
if (codec->capabilities & AV_CODEC_CAP_AUTO_THREADS) { if (codec->capabilities & AV_CODEC_CAP_OTHER_THREADS) {
c->thread_count = 0; c->thread_count = 0;
} }
else { else {

View File

@@ -554,7 +554,7 @@ static int startffmpeg(struct anim *anim)
avcodec_parameters_to_context(pCodecCtx, video_stream->codecpar); avcodec_parameters_to_context(pCodecCtx, video_stream->codecpar);
pCodecCtx->workaround_bugs = FF_BUG_AUTODETECT; pCodecCtx->workaround_bugs = FF_BUG_AUTODETECT;
if (pCodec->capabilities & AV_CODEC_CAP_AUTO_THREADS) { if (pCodec->capabilities & AV_CODEC_CAP_OTHER_THREADS) {
pCodecCtx->thread_count = 0; pCodecCtx->thread_count = 0;
} }
else { else {

View File

@@ -559,7 +559,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
av_dict_set(&codec_opts, "preset", "veryfast", 0); av_dict_set(&codec_opts, "preset", "veryfast", 0);
av_dict_set(&codec_opts, "tune", "fastdecode", 0); av_dict_set(&codec_opts, "tune", "fastdecode", 0);
if (rv->codec->capabilities & AV_CODEC_CAP_AUTO_THREADS) { if (rv->codec->capabilities & AV_CODEC_CAP_OTHER_THREADS) {
rv->c->thread_count = 0; rv->c->thread_count = 0;
} }
else { else {
@@ -872,7 +872,7 @@ static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim,
avcodec_parameters_to_context(context->iCodecCtx, context->iStream->codecpar); avcodec_parameters_to_context(context->iCodecCtx, context->iStream->codecpar);
context->iCodecCtx->workaround_bugs = FF_BUG_AUTODETECT; context->iCodecCtx->workaround_bugs = FF_BUG_AUTODETECT;
if (context->iCodec->capabilities & AV_CODEC_CAP_AUTO_THREADS) { if (context->iCodec->capabilities & AV_CODEC_CAP_OTHER_THREADS) {
context->iCodecCtx->thread_count = 0; context->iCodecCtx->thread_count = 0;
} }
else { else {