aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorBrian Foley <bfoley@compsoc.nuigalway.ie>2003-05-05 20:39:24 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-05-05 20:39:24 +0000
commitbd0739804640939fea4fb6f1f625b82432d46947 (patch)
treef64d5ad13b147f85a973e0b48f097b713f15cb03 /ffmpeg.c
parenteb9ef61a81c0af06f5ee15ea7dfee009864b5e82 (diff)
downloadffmpeg-bd0739804640939fea4fb6f1f625b82432d46947.tar.gz
-map and sanity checking patch by (Brian Foley <bfoley at compsoc dot nuigalway dot ie>)
Originally committed as revision 1835 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index d758e39fd9..e7f9c1cc77 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -827,6 +827,18 @@ static int av_encode(AVFormatContext **output_files,
exit(1);
}
+ /* Sanity check the mapping args -- do the input files & streams exist? */
+ for(i=0;i<nb_stream_maps;i++) {
+ int fi = stream_maps[i].file_index;
+ int si = stream_maps[i].stream_index;
+
+ if (fi < 0 || fi > nb_input_files - 1 ||
+ si < 0 || si > file_table[fi].nb_streams - 1) {
+ fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si);
+ exit(1);
+ }
+ }
+
ost_table = av_mallocz(sizeof(AVOutputStream *) * nb_ostreams);
if (!ost_table)
goto fail;
@@ -849,6 +861,15 @@ static int av_encode(AVFormatContext **output_files,
if (nb_stream_maps > 0) {
ost->source_index = file_table[stream_maps[n-1].file_index].ist_index +
stream_maps[n-1].stream_index;
+
+ /* Sanity check that the stream types match */
+ if (ist_table[ost->source_index]->st->codec.codec_type != ost->st->codec.codec_type) {
+ fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
+ stream_maps[n-1].file_index, stream_maps[n-1].stream_index,
+ ost->file_index, ost->index);
+ exit(1);
+ }
+
} else {
/* get corresponding input stream index : we select the first one with the right type */
found = 0;