]> git.sesse.net Git - ffmpeg/commitdiff
lavf: move AVStream.pts_reorder_error[_count] to AVStreamInternal
authorAnton Khirnov <anton@khirnov.net>
Fri, 9 Oct 2020 07:22:36 +0000 (09:22 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 28 Oct 2020 13:54:35 +0000 (14:54 +0100)
Those are private fields, no reason to have them exposed in a public
header.

libavformat/avformat.h
libavformat/internal.h
libavformat/utils.c

index 158c025e4a0f6e93680224a6c20eea21d9a9def8..da07e8981eec3e4577d56303ba740534153d67cd 100644 (file)
@@ -1184,12 +1184,6 @@ typedef struct AVStream {
      */
     int update_initial_durations_done;
 
-    /**
-     * 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];
-
     /**
      * An opaque field for libavformat internal usage.
      * Must not be accessed in any way by callers.
index c9eca1babb32dd6591413254115dc04a5283ee41..95cb5b5d60d7d195c7160e60d68deb25502cf19b 100644 (file)
@@ -225,6 +225,12 @@ struct AVStreamInternal {
 
     } *info;
 
+    /**
+     * 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];
+
     /**
      * Internal data to analyze DTS and detect faulty mpeg streams
      */
index 096ed2e648c414ad4c584846d43639f2240cd5ae..1025ca219e204d490bd757aceb16fae1ef498c25 100644 (file)
@@ -1027,8 +1027,8 @@ static int64_t select_from_pts_buffer(AVStream *st, int64_t *pts_buffer, int64_t
         if (dts == AV_NOPTS_VALUE) {
             int64_t best_score = INT64_MAX;
             for (i = 0; i<delay; i++) {
-                if (st->pts_reorder_error_count[i]) {
-                    int64_t score = st->pts_reorder_error[i] / st->pts_reorder_error_count[i];
+                if (st->internal->pts_reorder_error_count[i]) {
+                    int64_t score = st->internal->pts_reorder_error[i] / st->internal->pts_reorder_error_count[i];
                     if (score < best_score) {
                         best_score = score;
                         dts = pts_buffer[i];
@@ -1039,13 +1039,13 @@ static int64_t select_from_pts_buffer(AVStream *st, int64_t *pts_buffer, int64_t
             for (i = 0; i<delay; i++) {
                 if (pts_buffer[i] != AV_NOPTS_VALUE) {
                     int64_t diff =  FFABS(pts_buffer[i] - dts)
-                                    + (uint64_t)st->pts_reorder_error[i];
-                    diff = FFMAX(diff, st->pts_reorder_error[i]);
-                    st->pts_reorder_error[i] = diff;
-                    st->pts_reorder_error_count[i]++;
-                    if (st->pts_reorder_error_count[i] > 250) {
-                        st->pts_reorder_error[i] >>= 1;
-                        st->pts_reorder_error_count[i] >>= 1;
+                                    + (uint64_t)st->internal->pts_reorder_error[i];
+                    diff = FFMAX(diff, st->internal->pts_reorder_error[i]);
+                    st->internal->pts_reorder_error[i] = diff;
+                    st->internal->pts_reorder_error_count[i]++;
+                    if (st->internal->pts_reorder_error_count[i] > 250) {
+                        st->internal->pts_reorder_error[i] >>= 1;
+                        st->internal->pts_reorder_error_count[i] >>= 1;
                     }
                 }
             }