ffmpeg: move a local variable definition later.
authorNicolas George <nicolas.george@normalesup.org>
Mon, 6 May 2013 21:51:27 +0000 (23:51 +0200)
committerNicolas George <nicolas.george@normalesup.org>
Tue, 7 May 2013 16:39:45 +0000 (18:39 +0200)
Fix a segfault when using the -map option without input files.

ffmpeg_opt.c

index ff80c8a..c87bf01 100644 (file)
@@ -1719,7 +1719,6 @@ static int open_output_file(OptionsContext *o, const char *filename)
     } else {
         for (i = 0; i < o->nb_stream_maps; i++) {
             StreamMap *map = &o->stream_maps[i];
-            int src_idx = input_files[map->file_index]->ist_index + map->stream_index;
 
             if (map->disabled)
                 continue;
@@ -1747,6 +1746,8 @@ loop_end:
                 }
                 init_output_filter(ofilter, o, oc);
             } else {
+                int src_idx = input_files[map->file_index]->ist_index + map->stream_index;
+
                 ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index];
                 if(o->subtitle_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
                     continue;