Merge commit '73ed8558a61c4f1d0ce8d1f35183ac1a0a4e31e3'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 5 May 2014 12:39:13 +0000 (14:39 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 5 May 2014 12:39:13 +0000 (14:39 +0200)
* commit '73ed8558a61c4f1d0ce8d1f35183ac1a0a4e31e3':
  avconv: simplify exit_program() by using more local vars

Conflicts:
ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
ffmpeg.c

diff --cc ffmpeg.c
index b2e39e8d0eed3604c676cddbe57f65ae8aa8955b,2061c27abe0ad9c49cd50d6459a7cfec51019462..d0cdd4f37540478a493b1dac7271bf86b677ecab
+++ b/ffmpeg.c
@@@ -432,33 -144,29 +432,36 @@@ static void ffmpeg_cleanup(int ret
  {
      int i, j;
  
 +    if (do_benchmark) {
 +        int maxrss = getmaxrss() / 1024;
 +        printf("bench: maxrss=%ikB\n", maxrss);
 +    }
 +
      for (i = 0; i < nb_filtergraphs; i++) {
-         avfilter_graph_free(&filtergraphs[i]->graph);
-         for (j = 0; j < filtergraphs[i]->nb_inputs; j++) {
-             av_freep(&filtergraphs[i]->inputs[j]->name);
-             av_freep(&filtergraphs[i]->inputs[j]);
+         FilterGraph *fg = filtergraphs[i];
+         avfilter_graph_free(&fg->graph);
+         for (j = 0; j < fg->nb_inputs; j++) {
+             av_freep(&fg->inputs[j]->name);
+             av_freep(&fg->inputs[j]);
          }
-         av_freep(&filtergraphs[i]->inputs);
-         for (j = 0; j < filtergraphs[i]->nb_outputs; j++) {
-             av_freep(&filtergraphs[i]->outputs[j]->name);
-             av_freep(&filtergraphs[i]->outputs[j]);
+         av_freep(&fg->inputs);
+         for (j = 0; j < fg->nb_outputs; j++) {
+             av_freep(&fg->outputs[j]->name);
+             av_freep(&fg->outputs[j]);
          }
-         av_freep(&filtergraphs[i]->outputs);
-         av_freep(&filtergraphs[i]->graph_desc);
+         av_freep(&fg->outputs);
+         av_freep(&fg->graph_desc);
          av_freep(&filtergraphs[i]);
      }
      av_freep(&filtergraphs);
  
 +    av_freep(&subtitle_out);
 +
      /* close files */
      for (i = 0; i < nb_output_files; i++) {
-         AVFormatContext *s = output_files[i]->ctx;
+         OutputFile *of = output_files[i];
+         AVFormatContext *s = of->ctx;
          if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE) && s->pb)
              avio_close(s->pb);
          avformat_free_context(s);
              av_bitstream_filter_close(bsfc);
              bsfc = next;
          }
-         output_streams[i]->bitstream_filters = NULL;
-         av_frame_free(&output_streams[i]->filtered_frame);
+         ost->bitstream_filters = NULL;
+         av_frame_free(&ost->filtered_frame);
+         av_parser_close(ost->parser);
  
-         av_parser_close(output_streams[i]->parser);
+         av_freep(&ost->forced_keyframes);
++        av_expr_free(ost->forced_keyframes_pexpr);
+         av_freep(&ost->avfilter);
+         av_freep(&ost->logfile_prefix);
  
-         av_freep(&output_streams[i]->forced_keyframes);
-         av_expr_free(output_streams[i]->forced_keyframes_pexpr);
-         av_freep(&output_streams[i]->avfilter);
-         av_freep(&output_streams[i]->logfile_prefix);
          av_freep(&output_streams[i]);
      }
 +#if HAVE_PTHREADS
 +    free_input_threads();
 +#endif
      for (i = 0; i < nb_input_files; i++) {
          avformat_close_input(&input_files[i]->ctx);
          av_freep(&input_files[i]);
      }
      for (i = 0; i < nb_input_streams; i++) {
-         av_frame_free(&input_streams[i]->decoded_frame);
-         av_frame_free(&input_streams[i]->filter_frame);
-         av_dict_free(&input_streams[i]->opts);
-         avsubtitle_free(&input_streams[i]->prev_sub.subtitle);
-         av_frame_free(&input_streams[i]->sub2video.frame);
-         av_freep(&input_streams[i]->filters);
-         av_freep(&input_streams[i]->hwaccel_device);
+         InputStream *ist = input_streams[i];
+         av_frame_free(&ist->decoded_frame);
+         av_frame_free(&ist->filter_frame);
+         av_dict_free(&ist->opts);
++        avsubtitle_free(&ist->prev_sub.subtitle);
++        av_frame_free(&ist->sub2video.frame);
+         av_freep(&ist->filters);
+         av_freep(&ist->hwaccel_device);
          av_freep(&input_streams[i]);
      }