ffmpeg.c:3206: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `av_close_input_file`.

ffmpeg.c:3205:9: Unknown value from: fprintf
3203.     ret = av_find_stream_info(ic);
3204.     if (ret < 0 && verbose >= 0) {
3205.         fprintf(stderr, "%s: could not find codec parameters\n", filename);
              ^
3206.         av_close_input_file(ic);
3207.         av_exit(1);

ffmpeg.c:3206:9: Call
3204.     if (ret < 0 && verbose >= 0) {
3205.         fprintf(stderr, "%s: could not find codec parameters\n", filename);
3206.         av_close_input_file(ic);
              ^
3207.         av_exit(1);
3208.     }

libavformat/utils.c:2492:1: Parameter `s->nb_programs`
  2490. }
  2491. 
  2492. void av_close_input_file(AVFormatContext *s)
        ^
  2493. {
  2494.     ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;

libavformat/utils.c:2495:5: Call
  2493. {
  2494.     ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
  2495.     av_close_input_stream(s);
            ^
  2496.     if (pb)
  2497.         url_fclose(pb);

libavformat/utils.c:2444:1: <LHS trace>
2442. }
2443. 
2444. void av_close_input_stream(AVFormatContext *s)
      ^
2445. {
2446.     int i;

libavformat/utils.c:2444:1: Parameter `s->nb_programs`
    2442. }
    2443. 
    2444. void av_close_input_stream(AVFormatContext *s)
          ^
    2445. {
    2446.     int i;

libavformat/utils.c:2468:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_file` 
    2466.         av_free(st);
    2467.     }
    2468.     for(i=s->nb_programs-1; i>=0; i--) {
                  ^
    2469. #if LIBAVFORMAT_VERSION_INT < (53<<16)
    2470.         av_freep(&s->programs[i]->provider_name);

void av_close_input_stream(AVFormatContext *s)
{
    int i;
    AVStream *st;
    if (s->iformat->read_close)
        s->iformat->read_close(s);
    for(i=0;i<s->nb_streams;i++) {
        st = s->streams[i];
        if (st->parser) {
            av_parser_close(st->parser);
            av_free_packet(&st->cur_pkt);
        }
        av_metadata_free(&st->metadata);
        av_free(st->index_entries);
        av_free(st->codec->extradata);
        av_free(st->codec);
#if LIBAVFORMAT_VERSION_INT < (53<<16)
        av_free(st->filename);
#endif
        av_free(st->priv_data);
        av_free(st);
    }
    for(i=s->nb_programs-1; i>=0; i--) {
#if LIBAVFORMAT_VERSION_INT < (53<<16)
        av_freep(&s->programs[i]->provider_name);
        av_freep(&s->programs[i]->name);
#endif
        av_metadata_free(&s->programs[i]->metadata);
        av_freep(&s->programs[i]->stream_index);
        av_freep(&s->programs[i]);
    }
    av_freep(&s->programs);
    flush_packet_queue(s);
    av_freep(&s->priv_data);
    while(s->nb_chapters--) {
#if LIBAVFORMAT_VERSION_INT < (53<<16)
        av_free(s->chapters[s->nb_chapters]->title);
#endif
        av_metadata_free(&s->chapters[s->nb_chapters]->metadata);
        av_free(s->chapters[s->nb_chapters]);
    }
    av_freep(&s->chapters);
    av_metadata_free(&s->metadata);
    av_free(s);
}
['static void opt_input_file(const char *filename)\n{\n    AVFormatContext *ic;\n    AVFormatParameters params, *ap = &params;\n    AVInputFormat *file_iformat = NULL;\n    int err, i, ret, rfps, rfps_base;\n    int64_t timestamp;\n    if (last_asked_format) {\n        if (!(file_iformat = av_find_input_format(last_asked_format))) {\n            fprintf(stderr, "Unknown input format: \'%s\'\\n", last_asked_format);\n            av_exit(1);\n        }\n        last_asked_format = NULL;\n    }\n    if (!strcmp(filename, "-"))\n        filename = "pipe:";\n    using_stdin |= !strncmp(filename, "pipe:", 5) ||\n                    !strcmp(filename, "/dev/stdin");\n    ic = avformat_alloc_context();\n    if (!ic) {\n        print_error(filename, AVERROR(ENOMEM));\n        av_exit(1);\n    }\n    memset(ap, 0, sizeof(*ap));\n    ap->prealloced_context = 1;\n    ap->sample_rate = audio_sample_rate;\n    ap->channels = audio_channels;\n    ap->time_base.den = frame_rate.num;\n    ap->time_base.num = frame_rate.den;\n    ap->width = frame_width;\n    ap->height = frame_height;\n    ap->pix_fmt = frame_pix_fmt;\n    ap->channel = video_channel;\n    ap->standard = video_standard;\n    set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);\n    ic->video_codec_id   =\n        find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0,\n                          avcodec_opts[AVMEDIA_TYPE_VIDEO   ]->strict_std_compliance);\n    ic->audio_codec_id   =\n        find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0,\n                          avcodec_opts[AVMEDIA_TYPE_AUDIO   ]->strict_std_compliance);\n    ic->subtitle_codec_id=\n        find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0,\n                          avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);\n    ic->flags |= AVFMT_FLAG_NONBLOCK;\n    if(pgmyuv_compatibility_hack)\n        ic->video_codec_id= CODEC_ID_PGMYUV;\n    err = av_open_input_file(&ic, filename, file_iformat, 0, ap);\n    if (err < 0) {\n        print_error(filename, err);\n        av_exit(1);\n    }\n    if(opt_programid) {\n        int i, j;\n        int found=0;\n        for(i=0; i<ic->nb_streams; i++){\n            ic->streams[i]->discard= AVDISCARD_ALL;\n        }\n        for(i=0; i<ic->nb_programs; i++){\n            AVProgram *p= ic->programs[i];\n            if(p->id != opt_programid){\n                p->discard = AVDISCARD_ALL;\n            }else{\n                found=1;\n                for(j=0; j<p->nb_stream_indexes; j++){\n                    ic->streams[p->stream_index[j]]->discard= AVDISCARD_DEFAULT;\n                }\n            }\n        }\n        if(!found){\n            fprintf(stderr, "Specified program id not found\\n");\n            av_exit(1);\n        }\n        opt_programid=0;\n    }\n    ic->loop_input = loop_input;\n    ret = av_find_stream_info(ic);\n    if (ret < 0 && verbose >= 0) {\n        fprintf(stderr, "%s: could not find codec parameters\\n", filename);\n        av_close_input_file(ic);\n        av_exit(1);\n    }\n    timestamp = start_time;\n    if (ic->start_time != AV_NOPTS_VALUE)\n        timestamp += ic->start_time;\n    if (start_time != 0) {\n        ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD);\n        if (ret < 0) {\n            fprintf(stderr, "%s: could not seek to position %0.3f\\n",\n                    filename, (double)timestamp / AV_TIME_BASE);\n        }\n        start_time = 0;\n    }\n    for(i=0;i<ic->nb_streams;i++) {\n        AVStream *st = ic->streams[i];\n        AVCodecContext *enc = st->codec;\n        avcodec_thread_init(enc, thread_count);\n        switch(enc->codec_type) {\n        case AVMEDIA_TYPE_AUDIO:\n            set_context_opts(enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);\n            channel_layout = enc->channel_layout;\n            audio_channels = enc->channels;\n            audio_sample_rate = enc->sample_rate;\n            audio_sample_fmt = enc->sample_fmt;\n            input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(audio_codec_name);\n            if(audio_disable)\n                st->discard= AVDISCARD_ALL;\n            break;\n        case AVMEDIA_TYPE_VIDEO:\n            set_context_opts(enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);\n            frame_height = enc->height;\n            frame_width = enc->width;\n            if(ic->streams[i]->sample_aspect_ratio.num)\n                frame_aspect_ratio=av_q2d(ic->streams[i]->sample_aspect_ratio);\n            else\n                frame_aspect_ratio=av_q2d(enc->sample_aspect_ratio);\n            frame_aspect_ratio *= (float) enc->width / enc->height;\n            frame_pix_fmt = enc->pix_fmt;\n            rfps      = ic->streams[i]->r_frame_rate.num;\n            rfps_base = ic->streams[i]->r_frame_rate.den;\n            if(enc->lowres) {\n                enc->flags |= CODEC_FLAG_EMU_EDGE;\n                frame_height >>= enc->lowres;\n                frame_width  >>= enc->lowres;\n            }\n            if(me_threshold)\n                enc->debug |= FF_DEBUG_MV;\n            if (enc->time_base.den != rfps*enc->ticks_per_frame || enc->time_base.num != rfps_base) {\n                if (verbose >= 0)\n                    fprintf(stderr,"\\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) -> %2.2f (%d/%d)\\n",\n                            i, (float)enc->time_base.den / enc->time_base.num, enc->time_base.den, enc->time_base.num,\n                    (float)rfps / rfps_base, rfps, rfps_base);\n            }\n            frame_rate.num = rfps;\n            frame_rate.den = rfps_base;\n            input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(video_codec_name);\n            if(video_disable)\n                st->discard= AVDISCARD_ALL;\n            else if(video_discard)\n                st->discard= video_discard;\n            break;\n        case AVMEDIA_TYPE_DATA:\n            break;\n        case AVMEDIA_TYPE_SUBTITLE:\n            input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(subtitle_codec_name);\n            if(subtitle_disable)\n                st->discard = AVDISCARD_ALL;\n            break;\n        case AVMEDIA_TYPE_ATTACHMENT:\n        case AVMEDIA_TYPE_UNKNOWN:\n            nb_icodecs++;\n            break;\n        default:\n            abort();\n        }\n    }\n    input_files[nb_input_files] = ic;\n    input_files_ts_offset[nb_input_files] = input_ts_offset - (copy_ts ? 0 : timestamp);\n    if (verbose >= 0)\n        dump_format(ic, nb_input_files, filename, 0);\n    nb_input_files++;\n    video_channel = 0;\n    av_freep(&video_codec_name);\n    av_freep(&audio_codec_name);\n    av_freep(&subtitle_codec_name);\n}', 'void av_close_input_file(AVFormatContext *s)\n{\n    ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;\n    av_close_input_stream(s);\n    if (pb)\n        url_fclose(pb);\n}', 'void av_close_input_stream(AVFormatContext *s)\n{\n    int i;\n    AVStream *st;\n    if (s->iformat->read_close)\n        s->iformat->read_close(s);\n    for(i=0;i<s->nb_streams;i++) {\n        st = s->streams[i];\n        if (st->parser) {\n            av_parser_close(st->parser);\n            av_free_packet(&st->cur_pkt);\n        }\n        av_metadata_free(&st->metadata);\n        av_free(st->index_entries);\n        av_free(st->codec->extradata);\n        av_free(st->codec);\n#if LIBAVFORMAT_VERSION_INT < (53<<16)\n        av_free(st->filename);\n#endif\n        av_free(st->priv_data);\n        av_free(st);\n    }\n    for(i=s->nb_programs-1; i>=0; i--) {\n#if LIBAVFORMAT_VERSION_INT < (53<<16)\n        av_freep(&s->programs[i]->provider_name);\n        av_freep(&s->programs[i]->name);\n#endif\n        av_metadata_free(&s->programs[i]->metadata);\n        av_freep(&s->programs[i]->stream_index);\n        av_freep(&s->programs[i]);\n    }\n    av_freep(&s->programs);\n    flush_packet_queue(s);\n    av_freep(&s->priv_data);\n    while(s->nb_chapters--) {\n#if LIBAVFORMAT_VERSION_INT < (53<<16)\n        av_free(s->chapters[s->nb_chapters]->title);\n#endif\n        av_metadata_free(&s->chapters[s->nb_chapters]->metadata);\n        av_free(s->chapters[s->nb_chapters]);\n    }\n    av_freep(&s->chapters);\n    av_metadata_free(&s->metadata);\n    av_free(s);\n}']