[FFmpeg-cvslog] lavf: move AVStream.pts_buffer to AVStreamInternal

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


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

lavf: move AVStream.pts_buffer 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=91a98cc4ead6d871053011dafb72458a4e75fa8b
---

 libavformat/avformat.h |  3 +--
 libavformat/internal.h |  4 ++++
 libavformat/mux.c      | 12 ++++++------
 libavformat/utils.c    | 14 +++++++-------
 4 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 5811e8e24e..2f0573d561 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1084,11 +1084,10 @@ typedef struct AVStream {
      */
     struct AVPacketList *last_in_packet_buffer;
     AVProbeData probe_data;
-#define MAX_REORDER_DELAY 16
-    int64_t pts_buffer[MAX_REORDER_DELAY+1];
 
 #if LIBAVFORMAT_VERSION_MAJOR < 59
     // kept for ABI compatibility only, do not access in any way
+    int64_t      unused5[16+1];
     void         *unused2;
     int          unused3;
     unsigned int unused4;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index ce79da8000..23c2ce0dc3 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -308,12 +308,16 @@ struct AVStreamInternal {
      */
     int update_initial_durations_done;
 
+#define MAX_REORDER_DELAY 16
+
     /**
      * Internal data to generate dts from pts
      */
     int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
     uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
 
+    int64_t pts_buffer[MAX_REORDER_DELAY+1];
+
     /**
      * Internal data to analyze DTS and detect faulty mpeg streams
      */
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 1cf885fbea..1a34ee7e96 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -595,13 +595,13 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
 
     //calculate dts from pts
     if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
-        st->pts_buffer[0] = pkt->pts;
-        for (i = 1; i < delay + 1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
-            st->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
-        for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
-            FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
+        st->internal->pts_buffer[0] = pkt->pts;
+        for (i = 1; i < delay + 1 && st->internal->pts_buffer[i] == AV_NOPTS_VALUE; i++)
+            st->internal->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
+        for (i = 0; i<delay && st->internal->pts_buffer[i] > st->internal->pts_buffer[i + 1]; i++)
+            FFSWAP(int64_t, st->internal->pts_buffer[i], st->internal->pts_buffer[i + 1]);
 
-        pkt->dts = st->pts_buffer[0];
+        pkt->dts = st->internal->pts_buffer[0];
     }
 
     if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6ffc19517f..f1d8df636e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1357,12 +1357,12 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
     }
 
     if (pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
-        st->pts_buffer[0] = pkt->pts;
-        for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
-            FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
+        st->internal->pts_buffer[0] = pkt->pts;
+        for (i = 0; i<delay && st->internal->pts_buffer[i] > st->internal->pts_buffer[i + 1]; i++)
+            FFSWAP(int64_t, st->internal->pts_buffer[i], st->internal->pts_buffer[i + 1]);
 
         if(has_decode_delay_been_guessed(st))
-            pkt->dts = select_from_pts_buffer(st, st->pts_buffer, pkt->dts);
+            pkt->dts = select_from_pts_buffer(st, st->internal->pts_buffer, pkt->dts);
     }
     // We skipped it above so we try here.
     if (!onein_oneout)
@@ -1886,7 +1886,7 @@ void ff_read_frame_flush(AVFormatContext *s)
         st->probe_packets = s->max_probe_packets;
 
         for (j = 0; j < MAX_REORDER_DELAY + 1; j++)
-            st->pts_buffer[j] = AV_NOPTS_VALUE;
+            st->internal->pts_buffer[j] = AV_NOPTS_VALUE;
 
         if (s->internal->inject_global_side_data)
             st->internal->inject_global_side_data = 1;
@@ -2867,7 +2867,7 @@ skip_duration_calc:
         st->last_IP_pts = 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;
+            st->internal->pts_buffer[j] = AV_NOPTS_VALUE;
     }
 }
 
@@ -4526,7 +4526,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     st->last_IP_pts = 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;
+        st->internal->pts_buffer[i] = AV_NOPTS_VALUE;
 
     st->sample_aspect_ratio = (AVRational) { 0, 1 };
 



More information about the ffmpeg-cvslog mailing list