[FFmpeg-cvslog] lavf: move AVStream.{inject_global_side_data,display_aspect_ratio} to AVStreamInternal

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


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

lavf: move AVStream.{inject_global_side_data,display_aspect_ratio} 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=c1b916580ae92abca583d9afa2f9f64165292dd8
---

 libavformat/avformat.h | 12 ------------
 libavformat/internal.h | 12 ++++++++++++
 libavformat/mov.c      |  4 ++--
 libavformat/mxfdec.c   |  2 +-
 libavformat/utils.c    | 14 +++++++-------
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 96b1767903..7cf4c2c915 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1197,18 +1197,6 @@ typedef struct AVStream {
     uint8_t dts_ordered;
     uint8_t dts_misordered;
 
-    /**
-     * Internal data to inject global side data
-     */
-    int inject_global_side_data;
-
-    /**
-     * display aspect ratio (0 if unknown)
-     * - encoding: unused
-     * - decoding: Set by libavformat to calculate sample_aspect_ratio internally
-     */
-    AVRational display_aspect_ratio;
-
     /**
      * 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 30b4df9181..09bab4796d 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -224,6 +224,18 @@ struct AVStreamInternal {
         int     fps_last_dts_idx;
 
     } *info;
+
+    /**
+     * Internal data to inject global side data
+     */
+    int inject_global_side_data;
+
+    /**
+     * display aspect ratio (0 if unknown)
+     * - encoding: unused
+     * - decoding: Set by libavformat to calculate sample_aspect_ratio internally
+     */
+    AVRational display_aspect_ratio;
 };
 
 #ifdef __GNUC__
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 7fd43a8fc5..3107865b04 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1767,8 +1767,8 @@ static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                     return 0;
                 den *= 2;
             case 1:
-                c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.num = num;
-                c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.den = den;
+                c->fc->streams[c->fc->nb_streams-1]->internal->display_aspect_ratio.num = num;
+                c->fc->streams[c->fc->nb_streams-1]->internal->display_aspect_ratio.den = den;
             default:
                 return 0;
             }
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d16a7af0df..1f79f3d3cd 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2586,7 +2586,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
                 av_dict_set_int(&st->metadata, "source_track_origin", source_track->sequence->origin, 0);
             }
             if (descriptor->aspect_ratio.num && descriptor->aspect_ratio.den)
-                st->display_aspect_ratio = descriptor->aspect_ratio;
+                st->internal->display_aspect_ratio = descriptor->aspect_ratio;
             st->codecpar->color_range     = mxf_get_color_range(mxf, descriptor);
             st->codecpar->color_primaries = mxf_get_codec_ul(ff_mxf_color_primaries_uls, &descriptor->color_primaries_ul)->id;
             st->codecpar->color_trc       = mxf_get_codec_ul(ff_mxf_color_trc_uls, &descriptor->color_trc_ul)->id;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8fed11bd53..2f7a3fc59f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -153,7 +153,7 @@ void av_format_inject_global_side_data(AVFormatContext *s)
     s->internal->inject_global_side_data = 1;
     for (i = 0; i < s->nb_streams; i++) {
         AVStream *st = s->streams[i];
-        st->inject_global_side_data = 1;
+        st->internal->inject_global_side_data = 1;
     }
 }
 
@@ -1660,7 +1660,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             st->skip_samples = 0;
         }
 
-        if (st->inject_global_side_data) {
+        if (st->internal->inject_global_side_data) {
             for (i = 0; i < st->nb_side_data; i++) {
                 AVPacketSideData *src_sd = &st->side_data[i];
                 uint8_t *dst_data;
@@ -1676,7 +1676,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
                 memcpy(dst_data, src_sd->data, src_sd->size);
             }
-            st->inject_global_side_data = 0;
+            st->internal->inject_global_side_data = 0;
         }
     }
 
@@ -1889,7 +1889,7 @@ void ff_read_frame_flush(AVFormatContext *s)
             st->pts_buffer[j] = AV_NOPTS_VALUE;
 
         if (s->internal->inject_global_side_data)
-            st->inject_global_side_data = 1;
+            st->internal->inject_global_side_data = 1;
 
         st->skip_samples = 0;
     }
@@ -4008,9 +4008,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
                     st->r_frame_rate.den = st->time_base.num;
                 }
             }
-            if (st->display_aspect_ratio.num && st->display_aspect_ratio.den) {
+            if (st->internal->display_aspect_ratio.num && st->internal->display_aspect_ratio.den) {
                 AVRational hw_ratio = { avctx->height, avctx->width };
-                st->sample_aspect_ratio = av_mul_q(st->display_aspect_ratio,
+                st->sample_aspect_ratio = av_mul_q(st->internal->display_aspect_ratio,
                                                    hw_ratio);
             }
         } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
@@ -4536,7 +4536,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
     st->internal->info->fps_first_dts = AV_NOPTS_VALUE;
     st->internal->info->fps_last_dts  = AV_NOPTS_VALUE;
 
-    st->inject_global_side_data = s->internal->inject_global_side_data;
+    st->internal->inject_global_side_data = s->internal->inject_global_side_data;
 
     st->internal->need_context_update = 1;
 



More information about the ffmpeg-cvslog mailing list