diff mbox series

[FFmpeg-devel,2/2] avformat/dump: Use intermediate pointer for access to programs array

Message ID 20200630130909.16449-2-andreas.rheinhardt@gmail.com
State Accepted
Commit e365076c10f6c625ac3dfb88d24d67a07eff2055
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
Improves readability.

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

Comments

Lance Wang June 30, 2020, 3:06 p.m. UTC | #1
On Tue, Jun 30, 2020 at 03:09:09PM +0200, Andreas Rheinhardt wrote:
> Improves readability.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/dump.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/libavformat/dump.c b/libavformat/dump.c
> index 3c76edfee4..1083d7db37 100644
> --- a/libavformat/dump.c
> +++ b/libavformat/dump.c
> @@ -679,17 +679,18 @@ 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++) {
> -            const AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
> +            const AVProgram *program = ic->programs[j];
> +            const AVDictionaryEntry *name = av_dict_get(program->metadata,
>                                                          "name", NULL, 0);
> -            av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", ic->programs[j]->id,
> +            av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", program->id,
>                     name ? name->value : "");
> -            dump_metadata(NULL, ic->programs[j]->metadata, "    ");
> -            for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
> -                dump_stream_format(ic, ic->programs[j]->stream_index[k],
> +            dump_metadata(NULL, program->metadata, "    ");
> +            for (k = 0; k < program->nb_stream_indexes; k++) {
> +                dump_stream_format(ic, program->stream_index[k],
>                                     index, is_output);
> -                printed[ic->programs[j]->stream_index[k]] = 1;
> +                printed[program->stream_index[k]] = 1;
>              }
> -            total += ic->programs[j]->nb_stream_indexes;
> +            total += program->nb_stream_indexes;
>          }
>          if (total < ic->nb_streams)
>              av_log(NULL, AV_LOG_INFO, "  No Program\n");
> -- 
> 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 3c76edfee4..1083d7db37 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -679,17 +679,18 @@  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++) {
-            const AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
+            const AVProgram *program = ic->programs[j];
+            const AVDictionaryEntry *name = av_dict_get(program->metadata,
                                                         "name", NULL, 0);
-            av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", ic->programs[j]->id,
+            av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", program->id,
                    name ? name->value : "");
-            dump_metadata(NULL, ic->programs[j]->metadata, "    ");
-            for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
-                dump_stream_format(ic, ic->programs[j]->stream_index[k],
+            dump_metadata(NULL, program->metadata, "    ");
+            for (k = 0; k < program->nb_stream_indexes; k++) {
+                dump_stream_format(ic, program->stream_index[k],
                                    index, is_output);
-                printed[ic->programs[j]->stream_index[k]] = 1;
+                printed[program->stream_index[k]] = 1;
             }
-            total += ic->programs[j]->nb_stream_indexes;
+            total += program->nb_stream_indexes;
         }
         if (total < ic->nb_streams)
             av_log(NULL, AV_LOG_INFO, "  No Program\n");