From 455e4c17f43892e758137ab70551563d6a965c3c Mon Sep 17 00:00:00 2001 From: Norbert Schlia Date: Mon, 10 Jun 2024 09:14:35 +0200 Subject: [PATCH] Fixed deprecation: 2023-05-15 - 7d1d61cc5f5 - lavc 60 - avcodec.h Depreate AVCodecContext.ticks_per_frame in favor of AVCodecContext.framerate (encoding) and AV_CODEC_PROP_FIELDS (decoding). --- NEWS | 4 ++++ README.md | 4 ++++ src/ffmpeg_compat.h | 4 ++-- src/ffmpeg_transcoder.cc | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 5ff81329..863fca28 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ Important changes in 2.16 (2024-06-XX): * Bugfix: Closes#1072412: Fix build with FFmpeg 7.0. write_packet() now with const buffer as of Libavformat 61+. +* Fixed deprecation: 2023-05-15 - 7d1d61cc5f5 - lavc 60 - avcodec.h + Depreate AVCodecContext.ticks_per_frame in favor of + AVCodecContext.framerate (encoding) and + AV_CODEC_PROP_FIELDS (decoding). Important changes in 2.15 (2024-02-03): diff --git a/README.md b/README.md index eaaffec5..77e5f4ff 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,10 @@ To see what's been done so far, checkout the [windows](https://github.com/nschli **New in 2.16 (2024-06-XX):** - Bugfix: Closes [#160](https://github.com/nschlia/ffmpegfs/issues/160): Fix build with FFmpeg 7.0. [Debian Bug #1072412](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1072412). write_packet() now with const buffer as of Libavformat 61+. +- Fixed deprecation: 2023-05-15 - 7d1d61cc5f5 - lavc 60 - avcodec.h + Depreate AVCodecContext.ticks_per_frame in favor of + AVCodecContext.framerate (encoding) and + AV_CODEC_PROP_FIELDS (decoding). **New in 2.15 (2024-02-03):** diff --git a/src/ffmpeg_compat.h b/src/ffmpeg_compat.h index 579dc8dd..931b5d82 100644 --- a/src/ffmpeg_compat.h +++ b/src/ffmpeg_compat.h @@ -157,11 +157,11 @@ #define LAVF_WRITEPACKET_CONST (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(61, 0, 0)) /** - * 2023-05-xx - xxxxxxxxxx - lavc 60 - avcodec.h + * 2023-05-15 - 7d1d61cc5f5 - lavc 60 - avcodec.h * Depreate AVCodecContext.ticks_per_frame in favor of * AVCodecContext.framerate (encoding) and * AV_CODEC_PROP_FIELDS (decoding). */ -//#define LAVC_DEP_TICKSPERFRAME (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 0, 0)) +#define LAVC_DEP_TICKSPERFRAME (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 0, 0)) #endif // FFMPEG_COMPAT_H diff --git a/src/ffmpeg_transcoder.cc b/src/ffmpeg_transcoder.cc index f4bcbf7f..6fd3aa2f 100644 --- a/src/ffmpeg_transcoder.cc +++ b/src/ffmpeg_transcoder.cc @@ -4226,6 +4226,9 @@ void FFmpeg_Transcoder::produce_audio_dts(AVPacket *pkt) { pkt_duration = pkt->duration; +#if !LAVC_DEP_TICKSPERFRAME + // This has probably long since been fixed in FFmpeg, so we remove this completly + // instead of replacing it with updated code. if (m_out.m_audio.m_codec_ctx->codec_id == AV_CODEC_ID_OPUS || m_current_format->filetype() == FILETYPE_TS || m_current_format->filetype() == FILETYPE_HLS) { /** @todo Is this a FFmpeg bug or am I too stupid? @n @@ -4239,6 +4242,7 @@ void FFmpeg_Transcoder::produce_audio_dts(AVPacket *pkt) pkt->duration = pkt_duration = static_cast(av_rescale(pkt_duration, static_cast(m_out.m_audio.m_stream->time_base.den) * m_out.m_audio.m_codec_ctx->ticks_per_frame, m_out.m_audio.m_stream->codecpar->sample_rate * static_cast(m_out.m_audio.m_stream->time_base.num))); } } +#endif } else {