diff mbox series

[FFmpeg-devel,11/18] lavf: move AVStream.pts_buffer to AVStreamInternal

Message ID 20201009130430.602-11-anton@khirnov.net
State Accepted
Commit 91a98cc4ead6d871053011dafb72458a4e75fa8b
Headers show
Series [FFmpeg-devel,01/18] lavf: move AVStream.info to AVStreamInternal | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Anton Khirnov Oct. 9, 2020, 1:04 p.m. UTC
Those are private fields, no reason to have them exposed in a public
header.
---
 libavformat/avformat.h |  3 +--
 libavformat/internal.h |  4 ++++
 libavformat/mux.c      | 12 ++++++------
 libavformat/utils.c    | 14 +++++++-------
 4 files changed, 18 insertions(+), 15 deletions(-)

Comments

Michael Niedermayer Oct. 9, 2020, 10 p.m. UTC | #1
On Fri, Oct 09, 2020 at 03:04:23PM +0200, Anton Khirnov wrote:
> Those are private fields, no reason to have them exposed in a public
> header.
> ---
>  libavformat/avformat.h |  3 +--
>  libavformat/internal.h |  4 ++++
>  libavformat/mux.c      | 12 ++++++------
>  libavformat/utils.c    | 14 +++++++-------
>  4 files changed, 18 insertions(+), 15 deletions(-)

probably ok

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index dbef1b21dd..ef6d673699 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1062,11 +1062,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 1e53cae103..6cba0cce8f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1358,12 +1358,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)
@@ -1885,7 +1885,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;
@@ -2866,7 +2866,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;
     }
 }
 
@@ -4525,7 +4525,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 };