X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg.c;h=f23bb6ec0732f6ec696ca2d968f38611a8aa9b85;hb=31fe5d9825a050ca319ab9ddbe502d84ac3a576e;hp=5a1ab0f64dfadd9f64a04fa3d35febc6a1c929e6;hpb=f52ad8ceddf3078dbfef7ab437ca8600a1f96ef2;p=ffmpeg diff --git a/ffmpeg.c b/ffmpeg.c index 5a1ab0f64df..f23bb6ec073 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -335,6 +335,7 @@ typedef struct InputFile { int eof_reached; /* true if eof reached */ int ist_index; /* index of first stream in ist_table */ int buffer_size; /* current total buffer size */ + int nb_streams; int64_t ts_offset; } InputFile; @@ -2063,7 +2064,7 @@ static int transcode(AVFormatContext **output_files, int si = stream_maps[i].stream_index; if (fi < 0 || fi > nb_input_files - 1 || - si < 0 || si > input_files[fi].ctx->nb_streams - 1) { + si < 0 || si > input_files[fi].nb_streams - 1) { fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si); ret = AVERROR(EINVAL); goto fail; @@ -2769,7 +2770,7 @@ static int transcode(AVFormatContext **output_files, } /* the following test is needed in case new streams appear dynamically in stream : we ignore them */ - if (pkt.stream_index >= input_files[file_index].ctx->nb_streams) + if (pkt.stream_index >= input_files[file_index].nb_streams) goto discard_packet; ist_index = input_files[file_index].ist_index + pkt.stream_index; ist = &input_streams[ist_index]; @@ -3030,8 +3031,7 @@ static int opt_qscale(const char *opt, const char *arg) static int opt_top_field_first(const char *opt, const char *arg) { top_field_first = parse_number_or_die(opt, arg, OPT_INT, 0, 1); - opt_default(opt, arg); - return 0; + return opt_default(opt, arg); } static int opt_thread_count(const char *opt, const char *arg) @@ -3077,15 +3077,13 @@ static int opt_audio_channels(const char *opt, const char *arg) static int opt_video_channel(const char *opt, const char *arg) { av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -channel.\n"); - opt_default("channel", arg); - return 0; + return opt_default("channel", arg); } static int opt_video_standard(const char *opt, const char *arg) { av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -standard.\n"); - opt_default("standard", arg); - return 0; + return opt_default("standard", arg); } static int opt_codec(const char *opt, const char *arg) @@ -3350,6 +3348,11 @@ static int opt_input_file(const char *opt, const char *filename) find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0); ic->flags |= AVFMT_FLAG_NONBLOCK; + if (loop_input) { + av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 1\n"); + ic->loop_input = loop_input; + } + /* open the input file with generic libav function */ err = avformat_open_input(&ic, filename, file_iformat, &format_opts); if (err < 0) { @@ -3382,13 +3385,8 @@ static int opt_input_file(const char *opt, const char *filename) opt_programid=0; } - if (loop_input) { - av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 1\n"); - ic->loop_input = loop_input; - } - /* Set AVCodecContext options for avformat_find_stream_info */ - opts = setup_find_stream_info_opts(ic); + opts = setup_find_stream_info_opts(ic, codec_opts); orig_nb_streams = ic->nb_streams; /* If not enough info to get the stream parameters, we decode the @@ -3493,6 +3491,7 @@ static int opt_input_file(const char *opt, const char *filename) input_files[nb_input_files - 1].ctx = ic; input_files[nb_input_files - 1].ist_index = nb_input_streams - ic->nb_streams; input_files[nb_input_files - 1].ts_offset = input_ts_offset - (copy_ts ? 0 : timestamp); + input_files[nb_input_files - 1].nb_streams = ic->nb_streams; top_field_first = -1; frame_rate = (AVRational){0, 0}; @@ -4379,8 +4378,7 @@ static void log_callback_null(void* ptr, int level, const char* fmt, va_list vl) static int opt_passlogfile(const char *opt, const char *arg) { pass_logfilename_prefix = arg; - opt_default("passlogfile", arg); - return 0; + return opt_default("passlogfile", arg); } static const OptionDef options[] = {