[FFmpeg-devel] [PATCH] Cosmetics: simplify ffmpeg.c mapping indexing logic

Stefano Sabatini stefano.sabatini-lala
Fri Aug 8 21:59:32 CEST 2008


On date Sunday 2008-08-03 20:18:55 +0200, Stefano Sabatini encoded:
> Hi,
> 
> I think this is slightly more redable, n is in this case the index
> used to access the ost_table array used to contain all the output
> streams, BTW what about a more meaningful name for it (ost_idx?).
> 
> Regards.
> -- 
> FFmpeg = Faboulous and Furious Martial Proud Easy Generator

> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 14521)
> +++ ffmpeg.c	(working copy)
> @@ -1626,22 +1626,22 @@
>      n = 0;
>      for(k=0;k<nb_output_files;k++) {
>          os = output_files[k];
> -        for(i=0;i<os->nb_streams;i++) {
> +        for(i=0;i<os->nb_streams;i++,n++) {
>              int found;
> -            ost = ost_table[n++];
> +            ost = ost_table[n];
>              ost->file_index = k;
>              ost->index = i;
>              ost->st = os->streams[i];
>              if (nb_stream_maps > 0) {
> -                ost->source_index = file_table[stream_maps[n-1].file_index].ist_index +
> -                    stream_maps[n-1].stream_index;
> +                ost->source_index = file_table[stream_maps[n].file_index].ist_index +
> +                    stream_maps[n].stream_index;
>  
>                  /* Sanity check that the stream types match */
>                  if (ist_table[ost->source_index]->st->codec->codec_type != ost->st->codec->codec_type) {
>                      int i= ost->file_index;
>                      dump_format(output_files[i], i, output_files[i]->filename, 1);
>                      fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
> -                        stream_maps[n-1].file_index, stream_maps[n-1].stream_index,
> +                        stream_maps[n].file_index, stream_maps[n].stream_index,
>                          ost->file_index, ost->index);
>                      av_exit(1);
>                  }
> @@ -1691,8 +1691,8 @@
>              ist = ist_table[ost->source_index];
>              ist->discard = 0;
>              ost->sync_ist = (nb_stream_maps > 0) ?
> -                ist_table[file_table[stream_maps[n-1].sync_file_index].ist_index +
> -                         stream_maps[n-1].sync_stream_index] : ist;
> +                ist_table[file_table[stream_maps[n].sync_file_index].ist_index +
> +                         stream_maps[n].sync_stream_index] : ist;
>          }
>      }

Ping?

Regards.
-- 
FFmpeg = Fiendish and Foolish Multipurpose Power Explosive Geisha




More information about the ffmpeg-devel mailing list