[FFmpeg-devel] [PATCH 18/18] lavf: document some AVStream fields as private

Anton Khirnov anton at khirnov.net
Fri Oct 9 16:04:30 EEST 2020


Specifically: pts_wrap_bits, first_dts, cur_dts.
They are supposed to be private and are located in the private section
of AVStream, but ffmpeg.c currently accesses them regardless. They
should be moved to AVStreamInternal once that bug is fixed.

Remove the marker for the private AVStream section, as there are no
other accessible fields left there. It has proven highly confusing and
people kept adding supposedly-public fields into the private section.
New private per-stream fields should be added to AVStreamInternal.
---
 libavformat/avformat.h | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index a01912d654..612791a2eb 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1013,22 +1013,16 @@ typedef struct AVStream {
      */
     AVCodecParameters *codecpar;
 
-    /*****************************************************************
-     * All fields below this line are not part of the public API. They
-     * may not be used outside of libavformat and can be changed and
-     * removed at will.
-     * Internal note: be aware that physically removing these fields
-     * will break ABI. Replace removed fields with dummy fields, and
-     * add new fields to AVStreamInternal.
-     *****************************************************************
-     */
-
 #if LIBAVFORMAT_VERSION_MAJOR < 59
     // kept for ABI compatibility only, do not access in any way
     void *unused;
 #endif
 
-    int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
+    /**
+     * number of bits in pts (used for wrapping control)
+     * private, do not access from outside libavformat.
+     */
+    int pts_wrap_bits;
 
     // Timestamp generation support:
     /**
@@ -1037,8 +1031,12 @@ typedef struct AVStream {
      * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
      * a DTS is received from the underlying container. Otherwise set to
      * AV_NOPTS_VALUE by default.
+     * private, do not access from outside libavformat.
      */
     int64_t first_dts;
+    /**
+     * private, do not access from outside libavformat.
+     */
     int64_t cur_dts;
 
 #if LIBAVFORMAT_VERSION_MAJOR < 59
-- 
2.28.0



More information about the ffmpeg-devel mailing list