diff mbox series

[FFmpeg-devel,1/2] avformat/dump: Use const where appropriate

Message ID 20200630130909.16449-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 0179ef7eacbb0e2add043f31836b0e91f48be838
Headers show
Series [FFmpeg-devel,1/2] avformat/dump: Use const where appropriate | expand

Checks

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

Commit Message

Andreas Rheinhardt June 30, 2020, 1:09 p.m. UTC
Also switch to using a pointer to access stream side data instead of
copying the stream's AVPacketSideData.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/dump.c | 91 ++++++++++++++++++++++++----------------------
 1 file changed, 48 insertions(+), 43 deletions(-)

Comments

Limin Wang June 30, 2020, 2:43 p.m. UTC | #1
On Tue, Jun 30, 2020 at 03:09:08PM +0200, Andreas Rheinhardt wrote:
> Also switch to using a pointer to access stream side data instead of
> copying the stream's AVPacketSideData.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/dump.c | 91 ++++++++++++++++++++++++----------------------
>  1 file changed, 48 insertions(+), 43 deletions(-)
> 
> diff --git a/libavformat/dump.c b/libavformat/dump.c
> index 117c68145c..3c76edfee4 100644
> --- a/libavformat/dump.c
> +++ b/libavformat/dump.c
> @@ -131,10 +131,10 @@ static void print_fps(double d, const char *postfix)
>          av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
>  }
>  
> -static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
> +static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
>  {
>      if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
> -        AVDictionaryEntry *tag = NULL;
> +        const AVDictionaryEntry *tag = NULL;
>  
>          av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
>          while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
> @@ -158,7 +158,7 @@ static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
>  }
>  
>  /* param change side data*/
> -static void dump_paramchange(void *ctx, AVPacketSideData *sd)
> +static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
>  {
>      int size = sd->size;
>      const uint8_t *data = sd->data;
> @@ -235,15 +235,15 @@ static void print_peak(void *ctx, const char *str, uint32_t peak)
>      av_log(ctx, AV_LOG_INFO, ", ");
>  }
>  
> -static void dump_replaygain(void *ctx, AVPacketSideData *sd)
> +static void dump_replaygain(void *ctx, const AVPacketSideData *sd)
>  {
> -    AVReplayGain *rg;
> +    const AVReplayGain *rg;
>  
>      if (sd->size < sizeof(*rg)) {
>          av_log(ctx, AV_LOG_ERROR, "invalid data");
>          return;
>      }
> -    rg = (AVReplayGain*)sd->data;
> +    rg = (const AVReplayGain *)sd->data;
>  
>      print_gain(ctx, "track gain", rg->track_gain);
>      print_peak(ctx, "track peak", rg->track_peak);
> @@ -251,16 +251,16 @@ static void dump_replaygain(void *ctx, AVPacketSideData *sd)
>      print_peak(ctx, "album peak", rg->album_peak);
>  }
>  
> -static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
> +static void dump_stereo3d(void *ctx, const AVPacketSideData *sd)
>  {
> -    AVStereo3D *stereo;
> +    const AVStereo3D *stereo;
>  
>      if (sd->size < sizeof(*stereo)) {
>          av_log(ctx, AV_LOG_ERROR, "invalid data");
>          return;
>      }
>  
> -    stereo = (AVStereo3D *)sd->data;
> +    stereo = (const AVStereo3D *)sd->data;
>  
>      av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
>  
> @@ -268,9 +268,9 @@ static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
>          av_log(ctx, AV_LOG_INFO, " (inverted)");
>  }
>  
> -static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
> +static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd)
>  {
> -    enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
> +    const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data;
>  
>      if (sd->size < sizeof(*ast)) {
>          av_log(ctx, AV_LOG_ERROR, "invalid data");
> @@ -311,9 +311,9 @@ static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
>      }
>  }
>  
> -static void dump_cpb(void *ctx, AVPacketSideData *sd)
> +static void dump_cpb(void *ctx, const AVPacketSideData *sd)
>  {
> -    AVCPBProperties *cpb = (AVCPBProperties *)sd->data;
> +    const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data;
>  
>      if (sd->size < sizeof(*cpb)) {
>          av_log(ctx, AV_LOG_ERROR, "invalid data");
> @@ -334,8 +334,10 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd)
>          av_log(ctx, AV_LOG_INFO, "vbv_delay: %"PRIu64"", cpb->vbv_delay);
>  }
>  
> -static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
> -    AVMasteringDisplayMetadata* metadata = (AVMasteringDisplayMetadata*)sd->data;
> +static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd)
> +{
> +    const AVMasteringDisplayMetadata *metadata =
> +        (const AVMasteringDisplayMetadata *)sd->data;
>      av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
>             "has_primaries:%d has_luminance:%d "
>             "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
> @@ -351,17 +353,19 @@ static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
>             av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
>  }
>  
> -static void dump_content_light_metadata(void *ctx, AVPacketSideData* sd)
> +static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd)
>  {
> -    AVContentLightMetadata* metadata = (AVContentLightMetadata*)sd->data;
> +    const AVContentLightMetadata *metadata =
> +        (const AVContentLightMetadata *)sd->data;
>      av_log(ctx, AV_LOG_INFO, "Content Light Level Metadata, "
>             "MaxCLL=%d, MaxFALL=%d",
>             metadata->MaxCLL, metadata->MaxFALL);
>  }
>  
> -static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *sd)
> +static void dump_spherical(void *ctx, const AVCodecParameters *par,
> +                           const AVPacketSideData *sd)
>  {
> -    AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
> +    const AVSphericalMapping *spherical = (const AVSphericalMapping *)sd->data;
>      double yaw, pitch, roll;
>  
>      if (sd->size < sizeof(*spherical)) {
> @@ -388,9 +392,10 @@ static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *
>      }
>  }
>  
> -static void dump_dovi_conf(void *ctx, AVPacketSideData* sd)
> +static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd)
>  {
> -    AVDOVIDecoderConfigurationRecord *dovi = (AVDOVIDecoderConfigurationRecord *)sd->data;
> +    const AVDOVIDecoderConfigurationRecord *dovi =
> +        (const AVDOVIDecoderConfigurationRecord *)sd->data;
>  
>      av_log(ctx, AV_LOG_INFO, "version: %d.%d, profile: %d, level: %d, "
>             "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d",
> @@ -402,7 +407,7 @@ static void dump_dovi_conf(void *ctx, AVPacketSideData* sd)
>             dovi->dv_bl_signal_compatibility_id);
>  }
>  
> -static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
> +static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
>  {
>      int i;
>  
> @@ -410,10 +415,10 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
>          av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
>  
>      for (i = 0; i < st->nb_side_data; i++) {
> -        AVPacketSideData sd = st->side_data[i];
> +        const AVPacketSideData *sd = &st->side_data[i];
>          av_log(ctx, AV_LOG_INFO, "%s  ", indent);
>  
> -        switch (sd.type) {
> +        switch (sd->type) {
>          case AV_PKT_DATA_PALETTE:
>              av_log(ctx, AV_LOG_INFO, "palette");
>              break;
> @@ -422,55 +427,55 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
>              break;
>          case AV_PKT_DATA_PARAM_CHANGE:
>              av_log(ctx, AV_LOG_INFO, "paramchange: ");
> -            dump_paramchange(ctx, &sd);
> +            dump_paramchange(ctx, sd);
>              break;
>          case AV_PKT_DATA_H263_MB_INFO:
>              av_log(ctx, AV_LOG_INFO, "H.263 macroblock info");
>              break;
>          case AV_PKT_DATA_REPLAYGAIN:
>              av_log(ctx, AV_LOG_INFO, "replaygain: ");
> -            dump_replaygain(ctx, &sd);
> +            dump_replaygain(ctx, sd);
>              break;
>          case AV_PKT_DATA_DISPLAYMATRIX:
>              av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
> -                   av_display_rotation_get((int32_t *)sd.data));
> +                   av_display_rotation_get((const int32_t *)sd->data));
>              break;
>          case AV_PKT_DATA_STEREO3D:
>              av_log(ctx, AV_LOG_INFO, "stereo3d: ");
> -            dump_stereo3d(ctx, &sd);
> +            dump_stereo3d(ctx, sd);
>              break;
>          case AV_PKT_DATA_AUDIO_SERVICE_TYPE:
>              av_log(ctx, AV_LOG_INFO, "audio service type: ");
> -            dump_audioservicetype(ctx, &sd);
> +            dump_audioservicetype(ctx, sd);
>              break;
>          case AV_PKT_DATA_QUALITY_STATS:
>              av_log(ctx, AV_LOG_INFO, "quality factor: %"PRId32", pict_type: %c",
> -                   AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
> +                   AV_RL32(sd->data), av_get_picture_type_char(sd->data[4]));
>              break;
>          case AV_PKT_DATA_CPB_PROPERTIES:
>              av_log(ctx, AV_LOG_INFO, "cpb: ");
> -            dump_cpb(ctx, &sd);
> +            dump_cpb(ctx, sd);
>              break;
>          case AV_PKT_DATA_MASTERING_DISPLAY_METADATA:
> -            dump_mastering_display_metadata(ctx, &sd);
> +            dump_mastering_display_metadata(ctx, sd);
>              break;
>          case AV_PKT_DATA_SPHERICAL:
>              av_log(ctx, AV_LOG_INFO, "spherical: ");
> -            dump_spherical(ctx, st->codecpar, &sd);
> +            dump_spherical(ctx, st->codecpar, sd);
>              break;
>          case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
> -            dump_content_light_metadata(ctx, &sd);
> +            dump_content_light_metadata(ctx, sd);
>              break;
>          case AV_PKT_DATA_ICC_PROFILE:
>              av_log(ctx, AV_LOG_INFO, "ICC Profile");
>              break;
>          case AV_PKT_DATA_DOVI_CONF:
>              av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
> -            dump_dovi_conf(ctx, &sd);
> +            dump_dovi_conf(ctx, sd);
>              break;
>          default:
>              av_log(ctx, AV_LOG_INFO,
> -                   "unknown side data type %d (%d bytes)", sd.type, sd.size);
> +                   "unknown side data type %d (%d bytes)", sd->type, sd->size);
>              break;
>          }
>  
> @@ -479,14 +484,14 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
>  }
>  
>  /* "user interface" functions */
> -static void dump_stream_format(AVFormatContext *ic, int i,
> +static void dump_stream_format(const AVFormatContext *ic, int i,
>                                 int index, int is_output)
>  {
>      char buf[256];
>      int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
> -    AVStream *st = ic->streams[i];
> -    AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
> -    char *separator = ic->dump_separator;
> +    const AVStream *st = ic->streams[i];
> +    const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
> +    const char *separator = ic->dump_separator;
>      AVCodecContext *avctx;
>      int ret;
>  
> @@ -661,7 +666,7 @@ void av_dump_format(AVFormatContext *ic, int index,
>      }
>  
>      for (i = 0; i < ic->nb_chapters; i++) {
> -        AVChapter *ch = ic->chapters[i];
> +        const AVChapter *ch = ic->chapters[i];
>          av_log(NULL, AV_LOG_INFO, "    Chapter #%d:%d: ", index, i);
>          av_log(NULL, AV_LOG_INFO,
>                 "start %f, ", ch->start * av_q2d(ch->time_base));
> @@ -674,8 +679,8 @@ void av_dump_format(AVFormatContext *ic, int index,
>      if (ic->nb_programs) {
>          int j, k, total = 0;
>          for (j = 0; j < ic->nb_programs; j++) {
> -            AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
> -                                                  "name", NULL, 0);
> +            const AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
> +                                                        "name", NULL, 0);
>              av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", ic->programs[j]->id,
>                     name ? name->value : "");
>              dump_metadata(NULL, ic->programs[j]->metadata, "    ");
> -- 
> 2.20.1

LGTM

> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 117c68145c..3c76edfee4 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -131,10 +131,10 @@  static void print_fps(double d, const char *postfix)
         av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
 }
 
-static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
+static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
 {
     if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
-        AVDictionaryEntry *tag = NULL;
+        const AVDictionaryEntry *tag = NULL;
 
         av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
         while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
@@ -158,7 +158,7 @@  static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
 }
 
 /* param change side data*/
-static void dump_paramchange(void *ctx, AVPacketSideData *sd)
+static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
 {
     int size = sd->size;
     const uint8_t *data = sd->data;
@@ -235,15 +235,15 @@  static void print_peak(void *ctx, const char *str, uint32_t peak)
     av_log(ctx, AV_LOG_INFO, ", ");
 }
 
-static void dump_replaygain(void *ctx, AVPacketSideData *sd)
+static void dump_replaygain(void *ctx, const AVPacketSideData *sd)
 {
-    AVReplayGain *rg;
+    const AVReplayGain *rg;
 
     if (sd->size < sizeof(*rg)) {
         av_log(ctx, AV_LOG_ERROR, "invalid data");
         return;
     }
-    rg = (AVReplayGain*)sd->data;
+    rg = (const AVReplayGain *)sd->data;
 
     print_gain(ctx, "track gain", rg->track_gain);
     print_peak(ctx, "track peak", rg->track_peak);
@@ -251,16 +251,16 @@  static void dump_replaygain(void *ctx, AVPacketSideData *sd)
     print_peak(ctx, "album peak", rg->album_peak);
 }
 
-static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
+static void dump_stereo3d(void *ctx, const AVPacketSideData *sd)
 {
-    AVStereo3D *stereo;
+    const AVStereo3D *stereo;
 
     if (sd->size < sizeof(*stereo)) {
         av_log(ctx, AV_LOG_ERROR, "invalid data");
         return;
     }
 
-    stereo = (AVStereo3D *)sd->data;
+    stereo = (const AVStereo3D *)sd->data;
 
     av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
 
@@ -268,9 +268,9 @@  static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
         av_log(ctx, AV_LOG_INFO, " (inverted)");
 }
 
-static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
+static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd)
 {
-    enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
+    const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data;
 
     if (sd->size < sizeof(*ast)) {
         av_log(ctx, AV_LOG_ERROR, "invalid data");
@@ -311,9 +311,9 @@  static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
     }
 }
 
-static void dump_cpb(void *ctx, AVPacketSideData *sd)
+static void dump_cpb(void *ctx, const AVPacketSideData *sd)
 {
-    AVCPBProperties *cpb = (AVCPBProperties *)sd->data;
+    const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data;
 
     if (sd->size < sizeof(*cpb)) {
         av_log(ctx, AV_LOG_ERROR, "invalid data");
@@ -334,8 +334,10 @@  static void dump_cpb(void *ctx, AVPacketSideData *sd)
         av_log(ctx, AV_LOG_INFO, "vbv_delay: %"PRIu64"", cpb->vbv_delay);
 }
 
-static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
-    AVMasteringDisplayMetadata* metadata = (AVMasteringDisplayMetadata*)sd->data;
+static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd)
+{
+    const AVMasteringDisplayMetadata *metadata =
+        (const AVMasteringDisplayMetadata *)sd->data;
     av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
            "has_primaries:%d has_luminance:%d "
            "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
@@ -351,17 +353,19 @@  static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
            av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
 }
 
-static void dump_content_light_metadata(void *ctx, AVPacketSideData* sd)
+static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd)
 {
-    AVContentLightMetadata* metadata = (AVContentLightMetadata*)sd->data;
+    const AVContentLightMetadata *metadata =
+        (const AVContentLightMetadata *)sd->data;
     av_log(ctx, AV_LOG_INFO, "Content Light Level Metadata, "
            "MaxCLL=%d, MaxFALL=%d",
            metadata->MaxCLL, metadata->MaxFALL);
 }
 
-static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *sd)
+static void dump_spherical(void *ctx, const AVCodecParameters *par,
+                           const AVPacketSideData *sd)
 {
-    AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
+    const AVSphericalMapping *spherical = (const AVSphericalMapping *)sd->data;
     double yaw, pitch, roll;
 
     if (sd->size < sizeof(*spherical)) {
@@ -388,9 +392,10 @@  static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *
     }
 }
 
-static void dump_dovi_conf(void *ctx, AVPacketSideData* sd)
+static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd)
 {
-    AVDOVIDecoderConfigurationRecord *dovi = (AVDOVIDecoderConfigurationRecord *)sd->data;
+    const AVDOVIDecoderConfigurationRecord *dovi =
+        (const AVDOVIDecoderConfigurationRecord *)sd->data;
 
     av_log(ctx, AV_LOG_INFO, "version: %d.%d, profile: %d, level: %d, "
            "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d",
@@ -402,7 +407,7 @@  static void dump_dovi_conf(void *ctx, AVPacketSideData* sd)
            dovi->dv_bl_signal_compatibility_id);
 }
 
-static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
+static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
 {
     int i;
 
@@ -410,10 +415,10 @@  static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
         av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
 
     for (i = 0; i < st->nb_side_data; i++) {
-        AVPacketSideData sd = st->side_data[i];
+        const AVPacketSideData *sd = &st->side_data[i];
         av_log(ctx, AV_LOG_INFO, "%s  ", indent);
 
-        switch (sd.type) {
+        switch (sd->type) {
         case AV_PKT_DATA_PALETTE:
             av_log(ctx, AV_LOG_INFO, "palette");
             break;
@@ -422,55 +427,55 @@  static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
             break;
         case AV_PKT_DATA_PARAM_CHANGE:
             av_log(ctx, AV_LOG_INFO, "paramchange: ");
-            dump_paramchange(ctx, &sd);
+            dump_paramchange(ctx, sd);
             break;
         case AV_PKT_DATA_H263_MB_INFO:
             av_log(ctx, AV_LOG_INFO, "H.263 macroblock info");
             break;
         case AV_PKT_DATA_REPLAYGAIN:
             av_log(ctx, AV_LOG_INFO, "replaygain: ");
-            dump_replaygain(ctx, &sd);
+            dump_replaygain(ctx, sd);
             break;
         case AV_PKT_DATA_DISPLAYMATRIX:
             av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
-                   av_display_rotation_get((int32_t *)sd.data));
+                   av_display_rotation_get((const int32_t *)sd->data));
             break;
         case AV_PKT_DATA_STEREO3D:
             av_log(ctx, AV_LOG_INFO, "stereo3d: ");
-            dump_stereo3d(ctx, &sd);
+            dump_stereo3d(ctx, sd);
             break;
         case AV_PKT_DATA_AUDIO_SERVICE_TYPE:
             av_log(ctx, AV_LOG_INFO, "audio service type: ");
-            dump_audioservicetype(ctx, &sd);
+            dump_audioservicetype(ctx, sd);
             break;
         case AV_PKT_DATA_QUALITY_STATS:
             av_log(ctx, AV_LOG_INFO, "quality factor: %"PRId32", pict_type: %c",
-                   AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
+                   AV_RL32(sd->data), av_get_picture_type_char(sd->data[4]));
             break;
         case AV_PKT_DATA_CPB_PROPERTIES:
             av_log(ctx, AV_LOG_INFO, "cpb: ");
-            dump_cpb(ctx, &sd);
+            dump_cpb(ctx, sd);
             break;
         case AV_PKT_DATA_MASTERING_DISPLAY_METADATA:
-            dump_mastering_display_metadata(ctx, &sd);
+            dump_mastering_display_metadata(ctx, sd);
             break;
         case AV_PKT_DATA_SPHERICAL:
             av_log(ctx, AV_LOG_INFO, "spherical: ");
-            dump_spherical(ctx, st->codecpar, &sd);
+            dump_spherical(ctx, st->codecpar, sd);
             break;
         case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
-            dump_content_light_metadata(ctx, &sd);
+            dump_content_light_metadata(ctx, sd);
             break;
         case AV_PKT_DATA_ICC_PROFILE:
             av_log(ctx, AV_LOG_INFO, "ICC Profile");
             break;
         case AV_PKT_DATA_DOVI_CONF:
             av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
-            dump_dovi_conf(ctx, &sd);
+            dump_dovi_conf(ctx, sd);
             break;
         default:
             av_log(ctx, AV_LOG_INFO,
-                   "unknown side data type %d (%d bytes)", sd.type, sd.size);
+                   "unknown side data type %d (%d bytes)", sd->type, sd->size);
             break;
         }
 
@@ -479,14 +484,14 @@  static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
 }
 
 /* "user interface" functions */
-static void dump_stream_format(AVFormatContext *ic, int i,
+static void dump_stream_format(const AVFormatContext *ic, int i,
                                int index, int is_output)
 {
     char buf[256];
     int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
-    AVStream *st = ic->streams[i];
-    AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
-    char *separator = ic->dump_separator;
+    const AVStream *st = ic->streams[i];
+    const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
+    const char *separator = ic->dump_separator;
     AVCodecContext *avctx;
     int ret;
 
@@ -661,7 +666,7 @@  void av_dump_format(AVFormatContext *ic, int index,
     }
 
     for (i = 0; i < ic->nb_chapters; i++) {
-        AVChapter *ch = ic->chapters[i];
+        const AVChapter *ch = ic->chapters[i];
         av_log(NULL, AV_LOG_INFO, "    Chapter #%d:%d: ", index, i);
         av_log(NULL, AV_LOG_INFO,
                "start %f, ", ch->start * av_q2d(ch->time_base));
@@ -674,8 +679,8 @@  void av_dump_format(AVFormatContext *ic, int index,
     if (ic->nb_programs) {
         int j, k, total = 0;
         for (j = 0; j < ic->nb_programs; j++) {
-            AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
-                                                  "name", NULL, 0);
+            const AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
+                                                        "name", NULL, 0);
             av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", ic->programs[j]->id,
                    name ? name->value : "");
             dump_metadata(NULL, ic->programs[j]->metadata, "    ");