[FFmpeg-cvslog] lavf: deprecate avformat_transfer_internal_stream_timing_info()

Anton Khirnov git at videolan.org
Tue Jul 9 12:19:56 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Jul  5 12:40:01 2024 +0200| [9fb8d13d56f20728141fd7070d8a325720727d57] | committer: Anton Khirnov

lavf: deprecate avformat_transfer_internal_stream_timing_info()

And av_stream_get_codec_timebase().

They were both added for ffmpeg CLI, which no longer calls either of
them. Furthermore the notion of "internal stream timing info" that needs
to be transferred with a special magic API function is fundamentally
flawed and should be removed.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fb8d13d56f20728141fd7070d8a325720727d57
---

 doc/APIchanges              |  4 ++++
 libavformat/avformat.c      |  2 ++
 libavformat/avformat.h      | 18 +++++++-----------
 libavformat/internal.h      |  2 ++
 libavformat/options.c       |  2 ++
 libavformat/version_major.h |  1 +
 6 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 98bc100662..5751216b24 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-07-xx - xxxxxxxxxx - lavf 61 - avformat.h
+  Deprecate avformat_transfer_internal_stream_timing_info()
+  and av_stream_get_codec_timebase() without replacement.
+
 2024-07-08 - xxxxxxxxxx - lavc 61.10.100 - packet.h
   Add AV_PKT_DATA_FRAME_CROPPING.
 
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 140fb5b6aa..b4f20502fb 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -770,6 +770,7 @@ 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)
@@ -849,6 +850,7 @@ 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 ef912731ac..4a3fb00529 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -3047,6 +3047,7 @@ 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,
@@ -3057,25 +3058,20 @@ enum AVTimebaseSource {
 };
 
 /**
- * Transfer internal timing information from one stream to another.
- *
- * This function is useful when doing stream copy.
- *
- * @param ofmt     target output format for ost
- * @param ost      output stream which needs timings copy and adjustments
- * @param ist      reference input stream to copy timings from
- * @param copy_tb  define from where the stream codec timebase needs to be imported
+ * @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);
 
 /**
- * Get the internal codec timebase from a stream.
- *
- * @param st  input stream to extract the timebase from
+ * @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 6bad4fd119..8e8971bfeb 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -411,7 +411,9 @@ typedef struct FFStream {
 
     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 ae879b9072..485265df52 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -318,7 +318,9 @@ 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
 
 #if FF_API_AVSTREAM_SIDE_DATA
     sti->inject_global_side_data = si->inject_global_side_data;
diff --git a/libavformat/version_major.h b/libavformat/version_major.h
index 44ad23c6b6..7a9b06703d 100644
--- a/libavformat/version_major.h
+++ b/libavformat/version_major.h
@@ -47,6 +47,7 @@
 #define FF_API_AVSTREAM_SIDE_DATA       (LIBAVFORMAT_VERSION_MAJOR < 62)
 
 #define FF_API_GET_DUR_ESTIMATE_METHOD  (LIBAVFORMAT_VERSION_MAJOR < 62)
+#define FF_API_INTERNAL_TIMING          (LIBAVFORMAT_VERSION_MAJOR < 62)
 
 #define FF_API_R_FRAME_RATE            1
 



More information about the ffmpeg-cvslog mailing list