[FFmpeg-cvslog] lavf: move AVStream.{last_dts_for_order_check,dts_[mis]ordered} to AVStreamInternal

Anton Khirnov git at videolan.org
Wed Oct 28 16:14:16 EET 2020


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Oct  9 09:22:36 2020 +0200| [25bade3258af48ba309cee5a0c668a8c70334d04] | committer: Anton Khirnov

lavf: move AVStream.{last_dts_for_order_check,dts_[mis]ordered} to AVStreamInternal

Those are private fields, no reason to have them exposed in a public
header.

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

 libavformat/avformat.h |  7 -------
 libavformat/internal.h |  7 +++++++
 libavformat/utils.c    | 28 ++++++++++++++--------------
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 7cf4c2c915..158c025e4a 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1190,13 +1190,6 @@ typedef struct AVStream {
     int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
     uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
 
-    /**
-     * Internal data to analyze DTS and detect faulty mpeg streams
-     */
-    int64_t last_dts_for_order_check;
-    uint8_t dts_ordered;
-    uint8_t dts_misordered;
-
     /**
      * An opaque field for libavformat internal usage.
      * Must not be accessed in any way by callers.
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 09bab4796d..c9eca1babb 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -225,6 +225,13 @@ struct AVStreamInternal {
 
     } *info;
 
+    /**
+     * Internal data to analyze DTS and detect faulty mpeg streams
+     */
+    int64_t last_dts_for_order_check;
+    uint8_t dts_ordered;
+    uint8_t dts_misordered;
+
     /**
      * Internal data to inject global side data
      */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2f7a3fc59f..096ed2e648 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1209,24 +1209,24 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
         return;
 
     if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && pkt->dts != AV_NOPTS_VALUE) {
-        if (pkt->dts == pkt->pts && st->last_dts_for_order_check != AV_NOPTS_VALUE) {
-            if (st->last_dts_for_order_check <= pkt->dts) {
-                st->dts_ordered++;
+        if (pkt->dts == pkt->pts && st->internal->last_dts_for_order_check != AV_NOPTS_VALUE) {
+            if (st->internal->last_dts_for_order_check <= pkt->dts) {
+                st->internal->dts_ordered++;
             } else {
-                av_log(s, st->dts_misordered ? AV_LOG_DEBUG : AV_LOG_WARNING,
+                av_log(s, st->internal->dts_misordered ? AV_LOG_DEBUG : AV_LOG_WARNING,
                        "DTS %"PRIi64" < %"PRIi64" out of order\n",
                        pkt->dts,
-                       st->last_dts_for_order_check);
-                st->dts_misordered++;
+                       st->internal->last_dts_for_order_check);
+                st->internal->dts_misordered++;
             }
-            if (st->dts_ordered + st->dts_misordered > 250) {
-                st->dts_ordered    >>= 1;
-                st->dts_misordered >>= 1;
+            if (st->internal->dts_ordered + st->internal->dts_misordered > 250) {
+                st->internal->dts_ordered    >>= 1;
+                st->internal->dts_misordered >>= 1;
             }
         }
 
-        st->last_dts_for_order_check = pkt->dts;
-        if (st->dts_ordered < 8*st->dts_misordered && pkt->dts == pkt->pts)
+        st->internal->last_dts_for_order_check = pkt->dts;
+        if (st->internal->dts_ordered < 8*st->internal->dts_misordered && pkt->dts == pkt->pts)
             pkt->dts = AV_NOPTS_VALUE;
     }
 
@@ -1876,7 +1876,7 @@ void ff_read_frame_flush(AVFormatContext *s)
             st->parser = NULL;
         }
         st->last_IP_pts = AV_NOPTS_VALUE;
-        st->last_dts_for_order_check = AV_NOPTS_VALUE;
+        st->internal->last_dts_for_order_check = AV_NOPTS_VALUE;
         if (st->first_dts == AV_NOPTS_VALUE)
             st->cur_dts = RELATIVE_TS_BASE;
         else
@@ -2865,7 +2865,7 @@ skip_duration_calc:
         st              = ic->streams[i];
         st->cur_dts     = st->first_dts;
         st->last_IP_pts = AV_NOPTS_VALUE;
-        st->last_dts_for_order_check = AV_NOPTS_VALUE;
+        st->internal->last_dts_for_order_check = AV_NOPTS_VALUE;
         for (j = 0; j < MAX_REORDER_DELAY + 1; j++)
             st->pts_buffer[j] = AV_NOPTS_VALUE;
     }
@@ -4524,7 +4524,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     st->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
 
     st->last_IP_pts = AV_NOPTS_VALUE;
-    st->last_dts_for_order_check = AV_NOPTS_VALUE;
+    st->internal->last_dts_for_order_check = AV_NOPTS_VALUE;
     for (i = 0; i < MAX_REORDER_DELAY + 1; i++)
         st->pts_buffer[i] = AV_NOPTS_VALUE;
 



More information about the ffmpeg-cvslog mailing list