diff mbox series

[FFmpeg-devel,2/5] avformat: move AVStream.probe_packets to AVStreamInternal

Message ID 20210503133200.1434-2-jamrial@gmail.com
State Accepted
Commit fab2ed47042d4cc2a4cd69bb97738024c01300c7
Headers show
Series [FFmpeg-devel,1/5] avformat: move AVStream.last-IP_{pts, duration} to AVStreamInternal | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer May 3, 2021, 1:31 p.m. UTC
It's a private fields, no reason to have it exposed in a public header.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/avformat.h       |  5 -----
 libavformat/internal.h       |  5 +++++
 libavformat/mpegts.c         |  2 +-
 libavformat/sbgdec.c         |  2 +-
 libavformat/tedcaptionsdec.c |  2 +-
 libavformat/utils.c          | 16 ++++++++--------
 libavformat/wavdec.c         |  2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index e62c6d1567..d796f02094 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1003,11 +1003,6 @@  typedef struct AVStream {
     int64_t first_dts;
     int64_t cur_dts;
 
-    /**
-     * Number of packets to buffer for codec probing
-     */
-    int probe_packets;
-
     /**
      * Number of frames that have been demuxed during avformat_find_stream_info()
      */
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 10d8f8dfeb..6af38720c8 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -368,6 +368,11 @@  struct AVStreamInternal {
 
     int64_t last_IP_pts;
     int last_IP_duration;
+
+    /**
+     * Number of packets to buffer for codec probing
+     */
+    int probe_packets;
 };
 
 #ifdef __GNUC__
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9092dbce72..0ed108ce89 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -954,7 +954,7 @@  static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
     }
     if ((st->codecpar->codec_id == AV_CODEC_ID_NONE ||
             (st->internal->request_probe > 0 && st->internal->request_probe < AVPROBE_SCORE_STREAM_RETRY / 5)) &&
-        st->probe_packets > 0 &&
+        st->internal->probe_packets > 0 &&
         stream_type == STREAM_TYPE_PRIVATE_DATA) {
         st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
         st->codecpar->codec_id   = AV_CODEC_ID_BIN_DATA;
diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index bc9945dfd4..7b9ada569e 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -1438,7 +1438,7 @@  static av_cold int sbg_read_header(AVFormatContext *avf)
     st->codecpar->sample_rate    = sbg->sample_rate;
     st->codecpar->frame_size     = sbg->frame_size;
     avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
-    st->probe_packets = 0;
+    st->internal->probe_packets = 0;
     st->start_time    = av_rescale(script.start_ts,
                                    sbg->sample_rate, AV_TIME_BASE);
     st->duration      = script.end_ts == AV_NOPTS_VALUE ? AV_NOPTS_VALUE :
diff --git a/libavformat/tedcaptionsdec.c b/libavformat/tedcaptionsdec.c
index 94e8432c53..6e87ef66e9 100644
--- a/libavformat/tedcaptionsdec.c
+++ b/libavformat/tedcaptionsdec.c
@@ -299,7 +299,7 @@  static av_cold int tedcaptions_read_header(AVFormatContext *avf)
     st->codecpar->codec_type     = AVMEDIA_TYPE_SUBTITLE;
     st->codecpar->codec_id       = AV_CODEC_ID_TEXT;
     avpriv_set_pts_info(st, 64, 1, 1000);
-    st->probe_packets = 0;
+    st->internal->probe_packets = 0;
     st->start_time    = 0;
     st->duration      = last->pts + last->duration;
     st->cur_dts       = 0;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index b5b0995f32..df6d9b5cf6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -334,7 +334,7 @@  static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
         int i;
         av_log(s, AV_LOG_DEBUG,
                "Probe with size=%d, packets=%d detected %s with score=%d\n",
-               pd->buf_size, s->max_probe_packets - st->probe_packets,
+               pd->buf_size, s->max_probe_packets - st->internal->probe_packets,
                fmt->name, score);
         for (i = 0; fmt_id_type[i].name; i++) {
             if (!strcmp(fmt->name, fmt_id_type[i].name)) {
@@ -648,8 +648,8 @@  static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
     if (st->internal->request_probe>0) {
         AVProbeData *pd = &st->internal->probe_data;
         int end;
-        av_log(s, AV_LOG_DEBUG, "probing stream %d pp:%d\n", st->index, st->probe_packets);
-        --st->probe_packets;
+        av_log(s, AV_LOG_DEBUG, "probing stream %d pp:%d\n", st->index, st->internal->probe_packets);
+        --st->internal->probe_packets;
 
         if (pkt) {
             uint8_t *new_buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
@@ -665,7 +665,7 @@  static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
             memset(pd->buf + pd->buf_size, 0, AVPROBE_PADDING_SIZE);
         } else {
 no_packet:
-            st->probe_packets = 0;
+            st->internal->probe_packets = 0;
             if (!pd->buf_size) {
                 av_log(s, AV_LOG_WARNING,
                        "nothing to probe for stream %d\n", st->index);
@@ -673,7 +673,7 @@  no_packet:
         }
 
         end=    s->internal->raw_packet_buffer_remaining_size <= 0
-                || st->probe_packets<= 0;
+                || st->internal->probe_packets<= 0;
 
         if (end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
             int score = set_codec_from_probe_data(s, st, pd);
@@ -804,7 +804,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
                 return err;
             for (i = 0; i < s->nb_streams; i++) {
                 st = s->streams[i];
-                if (st->probe_packets || st->internal->request_probe > 0)
+                if (st->internal->probe_packets || st->internal->request_probe > 0)
                     if ((err = probe_codec(s, st, NULL)) < 0)
                         return err;
                 av_assert0(st->internal->request_probe <= 0);
@@ -1831,7 +1831,7 @@  void ff_read_frame_flush(AVFormatContext *s)
             /* We set the current DTS to an unspecified origin. */
             st->cur_dts = AV_NOPTS_VALUE;
 
-        st->probe_packets = s->max_probe_packets;
+        st->internal->probe_packets = s->max_probe_packets;
 
         for (j = 0; j < MAX_REORDER_DELAY + 1; j++)
             st->internal->pts_buffer[j] = AV_NOPTS_VALUE;
@@ -4419,7 +4419,7 @@  AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
     st->start_time = AV_NOPTS_VALUE;
     st->duration   = AV_NOPTS_VALUE;
     st->first_dts     = AV_NOPTS_VALUE;
-    st->probe_packets = s->max_probe_packets;
+    st->internal->probe_packets = s->max_probe_packets;
     st->internal->pts_wrap_reference = AV_NOPTS_VALUE;
     st->internal->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
 
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 0c8b8bf85d..8e2a7a7475 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -167,7 +167,7 @@  static void handle_stream_probing(AVStream *st)
 {
     if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {
         st->internal->request_probe = AVPROBE_SCORE_EXTENSION;
-        st->probe_packets = FFMIN(st->probe_packets, 32);
+        st->internal->probe_packets = FFMIN(st->internal->probe_packets, 32);
     }
 }