From 5aba289032376751b0f35d513007ff0f1ad3bc70 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 8 Mar 2026 20:09:14 +0100 Subject: [PATCH] avformat: Remove FF_API_INTERNAL_TIMING Deprecated since 2024-07-09. Signed-off-by: Andreas Rheinhardt --- libavformat/avformat.c | 72 ------------------------------------- libavformat/avformat.h | 26 -------------- libavformat/internal.h | 4 --- libavformat/options.c | 3 -- libavformat/version_major.h | 2 -- 5 files changed, 107 deletions(-) diff --git a/libavformat/avformat.c b/libavformat/avformat.c index dbd4792cd2..15806aa6f6 100644 --- a/libavformat/avformat.c +++ b/libavformat/avformat.c @@ -25,7 +25,6 @@ #include "libavutil/channel_layout.h" #include "libavutil/frame.h" #include "libavutil/iamf.h" -#include "libavutil/intreadwrite.h" #include "libavutil/mem.h" #include "libavutil/opt.h" #include "libavutil/pixfmt.h" @@ -828,77 +827,6 @@ AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *f return fr; } -#if FF_API_INTERNAL_TIMING -int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, - AVStream *ost, const AVStream *ist, - enum AVTimebaseSource copy_tb) -{ - const AVCodecDescriptor *desc = cffstream(ist)->codec_desc; - const AVCodecContext *const dec_ctx = cffstream(ist)->avctx; - - AVRational mul = (AVRational){ desc && (desc->props & AV_CODEC_PROP_FIELDS) ? 2 : 1, 1 }; - AVRational dec_ctx_framerate = dec_ctx ? dec_ctx->framerate : (AVRational){ 0, 0 }; - AVRational dec_ctx_tb = dec_ctx_framerate.num ? av_inv_q(av_mul_q(dec_ctx_framerate, mul)) - : (ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ? (AVRational){0, 1} - : ist->time_base); - AVRational enc_tb = ist->time_base; - - /* - * Avi is a special case here because it supports variable fps but - * having the fps and timebase differe significantly adds quite some - * overhead - */ - if (!strcmp(ofmt->name, "avi")) { -#if FF_API_R_FRAME_RATE - if (copy_tb == AVFMT_TBCF_AUTO && ist->r_frame_rate.num - && av_q2d(ist->r_frame_rate) >= av_q2d(ist->avg_frame_rate) - && 0.5/av_q2d(ist->r_frame_rate) > av_q2d(ist->time_base) - && 0.5/av_q2d(ist->r_frame_rate) > av_q2d(dec_ctx_tb) - && av_q2d(ist->time_base) < 1.0/500 && av_q2d(dec_ctx_tb) < 1.0/500 - || copy_tb == AVFMT_TBCF_R_FRAMERATE) { - enc_tb.num = ist->r_frame_rate.den; - enc_tb.den = 2*ist->r_frame_rate.num; - } else -#endif - if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx_framerate.num && - av_q2d(av_inv_q(dec_ctx_framerate)) > 2*av_q2d(ist->time_base) - && av_q2d(ist->time_base) < 1.0/500 - || (copy_tb == AVFMT_TBCF_DECODER && - (dec_ctx_framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) { - enc_tb = dec_ctx_tb; - enc_tb.den *= 2; - } - } else if (!(ofmt->flags & AVFMT_VARIABLE_FPS) - && !av_match_name(ofmt->name, "mov,mp4,3gp,3g2,psp,ipod,ismv,f4v")) { - if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx_framerate.num - && av_q2d(av_inv_q(dec_ctx_framerate)) > av_q2d(ist->time_base) - && av_q2d(ist->time_base) < 1.0/500 - || (copy_tb == AVFMT_TBCF_DECODER && - (dec_ctx_framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) { - enc_tb = dec_ctx_tb; - } - } - - if (ost->codecpar->codec_tag == AV_RL32("tmcd") - && dec_ctx_tb.num < dec_ctx_tb.den - && dec_ctx_tb.num > 0 - && 121LL*dec_ctx_tb.num > dec_ctx_tb.den) { - enc_tb = dec_ctx_tb; - } - - av_reduce(&ffstream(ost)->transferred_mux_tb.num, - &ffstream(ost)->transferred_mux_tb.den, - enc_tb.num, enc_tb.den, INT_MAX); - - return 0; -} - -AVRational av_stream_get_codec_timebase(const AVStream *st) -{ - return cffstream(st)->avctx ? cffstream(st)->avctx->time_base : cffstream(st)->transferred_mux_tb; -} -#endif - void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den) { diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 1efe383b25..ef2b08c4f3 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -3185,32 +3185,6 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); -#if FF_API_INTERNAL_TIMING -enum AVTimebaseSource { - AVFMT_TBCF_AUTO = -1, - AVFMT_TBCF_DECODER, - AVFMT_TBCF_DEMUXER, -#if FF_API_R_FRAME_RATE - AVFMT_TBCF_R_FRAMERATE, -#endif -}; - -/** - * @deprecated do not call this function - */ -attribute_deprecated -int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, - AVStream *ost, const AVStream *ist, - enum AVTimebaseSource copy_tb); - -/** - * @deprecated do not call this function - */ -attribute_deprecated -AVRational av_stream_get_codec_timebase(const AVStream *st); -#endif - - /** * @} */ diff --git a/libavformat/internal.h b/libavformat/internal.h index 8bf9444edb..4f46c19808 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -353,10 +353,6 @@ typedef struct FFStream { int64_t cur_dts; const struct AVCodecDescriptor *codec_desc; - -#if FF_API_INTERNAL_TIMING - AVRational transferred_mux_tb; -#endif } FFStream; static av_always_inline FFStream *ffstream(AVStream *st) diff --git a/libavformat/options.c b/libavformat/options.c index 6da1b690c6..4b743bb529 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -316,9 +316,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) sti->pts_buffer[i] = AV_NOPTS_VALUE; st->sample_aspect_ratio = (AVRational) { 0, 1 }; -#if FF_API_INTERNAL_TIMING - sti->transferred_mux_tb = (AVRational) { 0, 1 };; -#endif sti->need_context_update = 1; diff --git a/libavformat/version_major.h b/libavformat/version_major.h index 2cae480a4b..ace2f00791 100644 --- a/libavformat/version_major.h +++ b/libavformat/version_major.h @@ -43,8 +43,6 @@ */ #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 63) -#define FF_API_INTERNAL_TIMING (LIBAVFORMAT_VERSION_MAJOR < 63) - #define FF_API_NO_DEFAULT_TLS_VERIFY (LIBAVFORMAT_VERSION_MAJOR < 63) #define FF_API_FDEBUG_TS (LIBAVFORMAT_VERSION_MAJOR < 63)