]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
Merge commit 'b5849f77095439e994b11c25e6063d443b36c228'
[ffmpeg] / ffmpeg.c
index c4729df87b7399b55cec615623148660ec992730..6196a5ade5bd0ac32fa1c30a7af7d816dde4cf29 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -115,7 +115,6 @@ static const OptionDef options[];
 
 #define MAX_FILES 100
 #define MAX_STREAMS 1024    /* arbitrary sanity check value */
-
 static const char *last_asked_format = NULL;
 static double *ts_scale;
 static int  nb_ts_scale;
@@ -1575,7 +1574,7 @@ static int output_packet(InputStream *ist, int ist_index,
                 ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size,
                                             &avpkt);
                 if (ret < 0)
-                    goto fail_decode;
+                    return ret;
                 avpkt.data += ret;
                 avpkt.size -= ret;
                 data_size   = ret;
@@ -1602,7 +1601,7 @@ static int output_packet(InputStream *ist, int ist_index,
                                                 &picture, &got_output, &avpkt);
                     quality = same_quality ? picture.quality : 0;
                     if (ret < 0)
-                        goto fail_decode;
+                        return ret;
                     if (!got_output) {
                         /* no picture yet */
                         goto discard_packet;
@@ -1622,7 +1621,7 @@ static int output_packet(InputStream *ist, int ist_index,
                 ret = avcodec_decode_subtitle2(ist->st->codec,
                                                &subtitle, &got_output, &avpkt);
                 if (ret < 0)
-                    goto fail_decode;
+                    return ret;
                 if (!got_output) {
                     goto discard_packet;
                 }
@@ -1630,7 +1629,7 @@ static int output_packet(InputStream *ist, int ist_index,
                 avpkt.size = 0;
                 break;
             default:
-                goto fail_decode;
+                return -1;
             }
         } else {
             switch(ist->st->codec->codec_type) {
@@ -1910,8 +1909,6 @@ static int output_packet(InputStream *ist, int ist_index,
     }
 
     return 0;
- fail_decode:
-    return -1;
 }
 
 static void print_sdp(AVFormatContext **avc, int n)
@@ -3197,9 +3194,6 @@ static int opt_input_ts_scale(const char *opt, const char *arg)
         p++;
     scale= strtod(p, &p);
 
-    if(stream >= MAX_STREAMS)
-        ffmpeg_exit(1);
-
     ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
     ts_scale[stream] = scale;
     return 0;
@@ -3851,7 +3845,7 @@ static int opt_streamid(const char *opt, const char *arg)
         ffmpeg_exit(1);
     }
     *p++ = '\0';
-    idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
+    idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
     return 0;