[FFmpeg-devel] [PATCH 1/2] avformat: add av_stream_get_codec_timebase()

James Almer jamrial at gmail.com
Mon Sep 26 20:39:12 EEST 2016


This will allow ffmpeg.c to stop using AVStream.codec in some cases

Signed-off-by: James Almer <jamrial at gmail.com>
---
TODO: Version bump, APIChanges entry.

 libavformat/avformat.h |  7 +++++++
 libavformat/utils.c    | 10 ++++++++++
 2 files changed, 17 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ae70cc8..057f8c5 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2922,6 +2922,13 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
                                                   enum AVTimebaseSource copy_tb);
 
 /**
+ * Get the internal codec timebase from a stream.
+ *
+ * @param st  input stream to extract the timebase from
+ */
+AVRational av_stream_get_codec_timebase(const AVStream *st);
+
+/**
  * @}
  */
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3e0f57d..abb5fb9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5383,3 +5383,13 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
 
     return 0;
 }
+
+AVRational av_stream_get_codec_timebase(const AVStream *st)
+{
+    // See avformat_transfer_internal_stream_timing_info() TODO.
+#if FF_API_LAVF_AVCTX
+FF_DISABLE_DEPRECATION_WARNINGS
+    return st->codec->time_base;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+}
-- 
2.9.1



More information about the ffmpeg-devel mailing list