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

ffmpeg.c:3197:13: Unknown value from: fprintf
3195.         }
3196.         if(!found){
3197.             fprintf(stderr, "Specified program id not found\n");
                  ^
3198.             ffmpeg_exit(1);
3199.         }

ffmpeg.c:3210:9: Call
3208.     if (ret < 0 && verbose >= 0) {
3209.         fprintf(stderr, "%s: could not find codec parameters\n", filename);
3210.         av_close_input_file(ic);
              ^
3211.         ffmpeg_exit(1);
3212.     }

libavformat/utils.c:2621:1: Parameter `s->nb_programs`
  2619. }
  2620. 
  2621. void av_close_input_file(AVFormatContext *s)
        ^
  2622. {
  2623.     AVIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;

libavformat/utils.c:2624:5: Call
  2622. {
  2623.     AVIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
  2624.     av_close_input_stream(s);
            ^
  2625.     if (pb)
  2626.         url_fclose(pb);

libavformat/utils.c:2565:1: Parameter `s->nb_programs`
    2563. }
    2564. 
    2565. void av_close_input_stream(AVFormatContext *s)
          ^
    2566. {
    2567.     flush_packet_queue(s);

libavformat/utils.c:2570:5: Call
    2568.     if (s->iformat->read_close)
    2569.         s->iformat->read_close(s);
    2570.     avformat_free_context(s);
              ^
    2571. }
    2572. 

libavformat/utils.c:2573:1: <LHS trace>
2571. }
2572. 
2573. void avformat_free_context(AVFormatContext *s)
      ^
2574. {
2575.     int i;

libavformat/utils.c:2573:1: Parameter `s->nb_programs`
      2571. }
      2572. 
      2573. void avformat_free_context(AVFormatContext *s)
            ^
      2574. {
      2575.     int i;

libavformat/utils.c:2597:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_file` 
      2595.         av_free(st);
      2596.     }
      2597.     for(i=s->nb_programs-1; i>=0; i--) {
                    ^
      2598. #if FF_API_OLD_METADATA
      2599.         av_freep(&s->programs[i]->provider_name);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    AVStream *st;
    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->subtitle_header);
        av_free(st->codec);
#if FF_API_OLD_METADATA
        av_free(st->filename);
#endif
        av_free(st->priv_data);
        av_free(st->info);
        av_free(st);
    }
    for(i=s->nb_programs-1; i>=0; i--) {
#if FF_API_OLD_METADATA
        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);
    av_freep(&s->priv_data);
    while(s->nb_chapters--) {
#if FF_API_OLD_METADATA
        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_freep(&s->key);
    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            ffmpeg_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        ffmpeg_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, NULL);\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    err = av_open_input_file(&ic, filename, file_iformat, 0, ap);\n    if (err < 0) {\n        print_error(filename, err);\n        ffmpeg_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            ffmpeg_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        ffmpeg_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 *dec = st->codec;\n        dec->thread_count = thread_count;\n        input_codecs = grow_array(input_codecs, sizeof(*input_codecs), &nb_input_codecs, nb_input_codecs + 1);\n        switch (dec->codec_type) {\n        case AVMEDIA_TYPE_AUDIO:\n            input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(audio_codec_name);\n            set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]);\n            channel_layout    = dec->channel_layout;\n            audio_channels    = dec->channels;\n            audio_sample_rate = dec->sample_rate;\n            audio_sample_fmt  = dec->sample_fmt;\n            if(audio_disable)\n                st->discard= AVDISCARD_ALL;\n            if (dec->lowres)\n                audio_sample_rate >>= dec->lowres;\n            break;\n        case AVMEDIA_TYPE_VIDEO:\n            input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(video_codec_name);\n            set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]);\n            frame_height = dec->height;\n            frame_width  = dec->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(dec->sample_aspect_ratio);\n            frame_aspect_ratio *= (float) dec->width / dec->height;\n            frame_pix_fmt = dec->pix_fmt;\n            rfps      = ic->streams[i]->r_frame_rate.num;\n            rfps_base = ic->streams[i]->r_frame_rate.den;\n            if (dec->lowres) {\n                dec->flags |= CODEC_FLAG_EMU_EDGE;\n                frame_height >>= dec->lowres;\n                frame_width  >>= dec->lowres;\n                dec->height = frame_height;\n                dec->width  = frame_width;\n            }\n            if(me_threshold)\n                dec->debug |= FF_DEBUG_MV;\n            if (dec->time_base.den != rfps*dec->ticks_per_frame || dec->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)dec->time_base.den / dec->time_base.num, dec->time_base.den, dec->time_base.num,\n                    (float)rfps / rfps_base, rfps, rfps_base);\n            }\n            frame_rate.num = rfps;\n            frame_rate.den = rfps_base;\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_input_codecs-1] = 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            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        av_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    AVIOContext *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    flush_packet_queue(s);\n    if (s->iformat->read_close)\n        s->iformat->read_close(s);\n    avformat_free_context(s);\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\n    AVStream *st;\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->subtitle_header);\n        av_free(st->codec);\n#if FF_API_OLD_METADATA\n        av_free(st->filename);\n#endif\n        av_free(st->priv_data);\n        av_free(st->info);\n        av_free(st);\n    }\n    for(i=s->nb_programs-1; i>=0; i--) {\n#if FF_API_OLD_METADATA\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    av_freep(&s->priv_data);\n    while(s->nb_chapters--) {\n#if FF_API_OLD_METADATA\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_freep(&s->key);\n    av_free(s);\n}']