libavformat/utils.c:2567: error: Uninitialized Value
  The value read from ret was never initialized.

libavformat/utils.c:2567:5: 
2565.         av_packet_free(&ic->streams[i]->internal->extract_extradata.pkt);
2566.     }
2567.     return ret;
          ^
2568. }
2569. 

int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
{
    int i, count, ret, read_size, j;
    AVStream *st;
    AVCodecContext *avctx;
    AVPacket pkt1, *pkt;
    int64_t old_offset  = avio_tell(ic->pb);
    int orig_nb_streams = ic->nb_streams;
    for (i = 0; i < ic->nb_streams; i++) {
        const AVCodec *codec;
        AVDictionary *thread_opt = NULL;
        st = ic->streams[i];
        avctx = st->internal->avctx;
        if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) {
            st->parser = av_parser_init(st->codecpar->codec_id);
            if (st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser)
                st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
        }
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
        if (st->codec->codec_id != st->internal->orig_codec_id) {
            st->codecpar->codec_id   = st->codec->codec_id;
            st->codecpar->codec_type = st->codec->codec_type;
            st->internal->orig_codec_id = st->codec->codec_id;
        }
FF_ENABLE_DEPRECATION_WARNINGS
#endif
        if (st->codecpar->codec_id != st->internal->orig_codec_id)
            st->internal->orig_codec_id = st->codecpar->codec_id;
        ret = avcodec_parameters_to_context(avctx, st->codecpar);
        if (ret < 0)
            goto find_stream_info_err;
        if (st->codecpar->codec_id != AV_CODEC_ID_PROBE &&
            st->codecpar->codec_id != AV_CODEC_ID_NONE)
            st->internal->avctx_inited = 1;
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
        codec = st->codec->codec ? st->codec->codec
                                 : avcodec_find_decoder(st->codecpar->codec_id);
FF_ENABLE_DEPRECATION_WARNINGS
#else
        codec = avcodec_find_decoder(st->codecpar->codec_id);
#endif
        av_dict_set(options ? &options[i] : &thread_opt, "threads", "1", 0);
        if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE
            && codec && !avctx->codec)
            avcodec_open2(avctx, codec,
                          options ? &options[i] : &thread_opt);
        if (!has_codec_parameters(st)) {
            if (codec && !avctx->codec)
                avcodec_open2(avctx, codec,
                              options ? &options[i] : &thread_opt);
        }
        if (!options)
            av_dict_free(&thread_opt);
    }
    for (i = 0; i < ic->nb_streams; i++) {
        ic->streams[i]->info->fps_first_dts = AV_NOPTS_VALUE;
        ic->streams[i]->info->fps_last_dts  = AV_NOPTS_VALUE;
    }
    count     = 0;
    read_size = 0;
    for (;;) {
        if (ff_check_interrupt(&ic->interrupt_callback)) {
            ret = AVERROR_EXIT;
            av_log(ic, AV_LOG_DEBUG, "interrupted\n");
            break;
        }
        for (i = 0; i < ic->nb_streams; i++) {
            int fps_analyze_framecount = 20;
            st = ic->streams[i];
            if (!has_codec_parameters(st))
                break;
            if (av_q2d(st->time_base) > 0.0005)
                fps_analyze_framecount *= 2;
            if (ic->fps_probe_size >= 0)
                fps_analyze_framecount = ic->fps_probe_size;
            if (!st->avg_frame_rate.num &&
                st->codec_info_nb_frames < fps_analyze_framecount &&
                st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
                break;
            if (!st->codecpar->extradata &&
                !st->internal->avctx->extradata &&
                (!st->internal->extract_extradata.inited ||
                 st->internal->extract_extradata.bsf))
                break;
            if (st->first_dts == AV_NOPTS_VALUE &&
                st->codec_info_nb_frames < ic->max_ts_probe &&
                (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||
                 st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))
                break;
        }
        if (i == ic->nb_streams) {
            if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
                ret = count;
                av_log(ic, AV_LOG_DEBUG, "All info found\n");
                break;
            }
        }
        if (read_size >= ic->probesize) {
            ret = count;
            av_log(ic, AV_LOG_DEBUG,
                   "Probe buffer size limit %d reached\n", ic->probesize);
            break;
        }
        ret = read_frame_internal(ic, &pkt1);
        if (ret == AVERROR(EAGAIN))
            continue;
        if (ret < 0) {
            AVPacket empty_pkt = { 0 };
            int err = 0;
            av_init_packet(&empty_pkt);
            ret = -1;
            for (i = 0; i < ic->nb_streams; i++) {
                st = ic->streams[i];
                if (st->info->found_decoder == 1) {
                    do {
                        err = try_decode_frame(ic, st, &empty_pkt,
                                               (options && i < orig_nb_streams)
                                               ? &options[i] : NULL);
                    } while (err > 0 && !has_codec_parameters(st));
                }
                if (err < 0) {
                    av_log(ic, AV_LOG_WARNING,
                           "decoding for stream %d failed\n", st->index);
                } else if (!has_codec_parameters(st)) {
                    char buf[256];
                    avcodec_string(buf, sizeof(buf), st->internal->avctx, 0);
                    av_log(ic, AV_LOG_WARNING,
                           "Could not find codec parameters (%s)\n", buf);
                } else {
                    ret = 0;
                }
            }
            break;
        }
        pkt = &pkt1;
        if (!(ic->flags & AVFMT_FLAG_NOBUFFER)) {
            ret = add_to_pktbuf(&ic->internal->packet_buffer, pkt,
                                &ic->internal->packet_buffer_end, 0);
            if (ret < 0)
                goto find_stream_info_err;
        }
        read_size += pkt->size;
        st = ic->streams[pkt->stream_index];
        avctx = st->internal->avctx;
        if (!st->internal->avctx_inited) {
            ret = avcodec_parameters_to_context(avctx, st->codecpar);
            if (ret < 0)
                goto find_stream_info_err;
            st->internal->avctx_inited = 1;
        }
        if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) {
            if (st->info->fps_last_dts != AV_NOPTS_VALUE &&
                st->info->fps_last_dts >= pkt->dts) {
                av_log(ic, AV_LOG_WARNING,
                       "Non-increasing DTS in stream %d: packet %d with DTS "
                       "%"PRId64", packet %d with DTS %"PRId64"\n",
                       st->index, st->info->fps_last_dts_idx,
                       st->info->fps_last_dts, st->codec_info_nb_frames,
                       pkt->dts);
                st->info->fps_first_dts =
                st->info->fps_last_dts  = AV_NOPTS_VALUE;
            }
            if (st->info->fps_last_dts != AV_NOPTS_VALUE &&
                st->info->fps_last_dts_idx > st->info->fps_first_dts_idx &&
                (pkt->dts - st->info->fps_last_dts) / 1000 >
                (st->info->fps_last_dts     - st->info->fps_first_dts) /
                (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) {
                av_log(ic, AV_LOG_WARNING,
                       "DTS discontinuity in stream %d: packet %d with DTS "
                       "%"PRId64", packet %d with DTS %"PRId64"\n",
                       st->index, st->info->fps_last_dts_idx,
                       st->info->fps_last_dts, st->codec_info_nb_frames,
                       pkt->dts);
                st->info->fps_first_dts =
                st->info->fps_last_dts  = AV_NOPTS_VALUE;
            }
            if (st->info->fps_first_dts == AV_NOPTS_VALUE) {
                st->info->fps_first_dts     = pkt->dts;
                st->info->fps_first_dts_idx = st->codec_info_nb_frames;
            }
            st->info->fps_last_dts     = pkt->dts;
            st->info->fps_last_dts_idx = st->codec_info_nb_frames;
            if (av_rescale_q(pkt->dts - st->info->fps_first_dts, st->time_base,
                             AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
                av_log(ic, AV_LOG_WARNING, "max_analyze_duration %d reached\n",
                       ic->max_analyze_duration);
                if (ic->flags & AVFMT_FLAG_NOBUFFER)
                    av_packet_unref(pkt);
                break;
            }
        }
        if (!st->internal->avctx->extradata) {
            ret = extract_extradata(st, pkt);
            if (ret < 0)
                goto find_stream_info_err;
        }
        try_decode_frame(ic, st, pkt,
                         (options && i < orig_nb_streams) ? &options[i] : NULL);
        if (ic->flags & AVFMT_FLAG_NOBUFFER)
            av_packet_unref(pkt);
        st->codec_info_nb_frames++;
        count++;
    }
    for (i = 0; i < ic->nb_streams; i++) {
        st = ic->streams[i];
        avcodec_close(st->internal->avctx);
    }
    for (i = 0; i < ic->nb_streams; i++) {
        st = ic->streams[i];
        avctx = st->internal->avctx;
        if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
            if (!st->avg_frame_rate.num &&
                st->info->fps_last_dts != st->info->fps_first_dts) {
                int64_t delta_dts = st->info->fps_last_dts -
                                    st->info->fps_first_dts;
                int delta_packets = st->info->fps_last_dts_idx -
                                    st->info->fps_first_dts_idx;
                int best_fps      = 0;
                double best_error = 0.01;
                if (delta_dts     >= INT64_MAX / st->time_base.num ||
                    delta_packets >= INT64_MAX / st->time_base.den ||
                    delta_dts < 0)
                    continue;
                av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
                          delta_packets * (int64_t) st->time_base.den,
                          delta_dts * (int64_t) st->time_base.num, 60000);
                for (j = 0; j < MAX_STD_TIMEBASES; j++) {
                    AVRational std_fps = { get_std_framerate(j), 12 * 1001 };
                    double error       = fabs(av_q2d(st->avg_frame_rate) /
                                              av_q2d(std_fps) - 1);
                    if (error < best_error) {
                        best_error = error;
                        best_fps   = std_fps.num;
                    }
                }
                if (best_fps)
                    av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
                              best_fps, 12 * 1001, INT_MAX);
            }
        } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
            if (!avctx->bits_per_coded_sample)
                avctx->bits_per_coded_sample =
                    av_get_bits_per_sample(avctx->codec_id);
            switch (avctx->audio_service_type) {
            case AV_AUDIO_SERVICE_TYPE_EFFECTS:
                st->disposition = AV_DISPOSITION_CLEAN_EFFECTS;
                break;
            case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:
                st->disposition = AV_DISPOSITION_VISUAL_IMPAIRED;
                break;
            case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:
                st->disposition = AV_DISPOSITION_HEARING_IMPAIRED;
                break;
            case AV_AUDIO_SERVICE_TYPE_COMMENTARY:
                st->disposition = AV_DISPOSITION_COMMENT;
                break;
            case AV_AUDIO_SERVICE_TYPE_KARAOKE:
                st->disposition = AV_DISPOSITION_KARAOKE;
                break;
            }
        }
    }
    compute_chapters_end(ic);
    for (i = 0; i < ic->nb_streams; i++) {
        st = ic->streams[i];
        if (!st->internal->avctx_inited)
            continue;
        ret = avcodec_parameters_from_context(st->codecpar, st->internal->avctx);
        if (ret < 0)
            goto find_stream_info_err;
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
        ret = avcodec_parameters_to_context(st->codec, st->codecpar);
        if (ret < 0)
            goto find_stream_info_err;
        if (st->internal->avctx->subtitle_header) {
            st->codec->subtitle_header = av_malloc(st->internal->avctx->subtitle_header_size);
            if (!st->codec->subtitle_header)
                goto find_stream_info_err;
            st->codec->subtitle_header_size = st->internal->avctx->subtitle_header_size;
            memcpy(st->codec->subtitle_header, st->internal->avctx->subtitle_header,
                   st->codec->subtitle_header_size);
        }
FF_ENABLE_DEPRECATION_WARNINGS
#endif
        st->internal->avctx_inited = 0;
    }
    estimate_timings(ic, old_offset);
find_stream_info_err:
    for (i = 0; i < ic->nb_streams; i++) {
        av_freep(&ic->streams[i]->info);
        av_bsf_free(&ic->streams[i]->internal->extract_extradata.bsf);
        av_packet_free(&ic->streams[i]->internal->extract_extradata.pkt);
    }
    return ret;
}
['int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)\n{\n    int i, count, ret, read_size, j;\n    AVStream *st;\n    AVCodecContext *avctx;\n    AVPacket pkt1, *pkt;\n    int64_t old_offset  = avio_tell(ic->pb);\n    int orig_nb_streams = ic->nb_streams;\n    for (i = 0; i < ic->nb_streams; i++) {\n        const AVCodec *codec;\n        AVDictionary *thread_opt = NULL;\n        st = ic->streams[i];\n        avctx = st->internal->avctx;\n        if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) {\n            st->parser = av_parser_init(st->codecpar->codec_id);\n            if (st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser)\n                st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;\n        }\n#if FF_API_LAVF_AVCTX\nFF_DISABLE_DEPRECATION_WARNINGS\n        if (st->codec->codec_id != st->internal->orig_codec_id) {\n            st->codecpar->codec_id   = st->codec->codec_id;\n            st->codecpar->codec_type = st->codec->codec_type;\n            st->internal->orig_codec_id = st->codec->codec_id;\n        }\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n        if (st->codecpar->codec_id != st->internal->orig_codec_id)\n            st->internal->orig_codec_id = st->codecpar->codec_id;\n        ret = avcodec_parameters_to_context(avctx, st->codecpar);\n        if (ret < 0)\n            goto find_stream_info_err;\n        if (st->codecpar->codec_id != AV_CODEC_ID_PROBE &&\n            st->codecpar->codec_id != AV_CODEC_ID_NONE)\n            st->internal->avctx_inited = 1;\n#if FF_API_LAVF_AVCTX\nFF_DISABLE_DEPRECATION_WARNINGS\n        codec = st->codec->codec ? st->codec->codec\n                                 : avcodec_find_decoder(st->codecpar->codec_id);\nFF_ENABLE_DEPRECATION_WARNINGS\n#else\n        codec = avcodec_find_decoder(st->codecpar->codec_id);\n#endif\n        av_dict_set(options ? &options[i] : &thread_opt, "threads", "1", 0);\n        if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE\n            && codec && !avctx->codec)\n            avcodec_open2(avctx, codec,\n                          options ? &options[i] : &thread_opt);\n        if (!has_codec_parameters(st)) {\n            if (codec && !avctx->codec)\n                avcodec_open2(avctx, codec,\n                              options ? &options[i] : &thread_opt);\n        }\n        if (!options)\n            av_dict_free(&thread_opt);\n    }\n    for (i = 0; i < ic->nb_streams; i++) {\n        ic->streams[i]->info->fps_first_dts = AV_NOPTS_VALUE;\n        ic->streams[i]->info->fps_last_dts  = AV_NOPTS_VALUE;\n    }\n    count     = 0;\n    read_size = 0;\n    for (;;) {\n        if (ff_check_interrupt(&ic->interrupt_callback)) {\n            ret = AVERROR_EXIT;\n            av_log(ic, AV_LOG_DEBUG, "interrupted\\n");\n            break;\n        }\n        for (i = 0; i < ic->nb_streams; i++) {\n            int fps_analyze_framecount = 20;\n            st = ic->streams[i];\n            if (!has_codec_parameters(st))\n                break;\n            if (av_q2d(st->time_base) > 0.0005)\n                fps_analyze_framecount *= 2;\n            if (ic->fps_probe_size >= 0)\n                fps_analyze_framecount = ic->fps_probe_size;\n            if (!st->avg_frame_rate.num &&\n                st->codec_info_nb_frames < fps_analyze_framecount &&\n                st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)\n                break;\n            if (!st->codecpar->extradata &&\n                !st->internal->avctx->extradata &&\n                (!st->internal->extract_extradata.inited ||\n                 st->internal->extract_extradata.bsf))\n                break;\n            if (st->first_dts == AV_NOPTS_VALUE &&\n                st->codec_info_nb_frames < ic->max_ts_probe &&\n                (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ||\n                 st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))\n                break;\n        }\n        if (i == ic->nb_streams) {\n            if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {\n                ret = count;\n                av_log(ic, AV_LOG_DEBUG, "All info found\\n");\n                break;\n            }\n        }\n        if (read_size >= ic->probesize) {\n            ret = count;\n            av_log(ic, AV_LOG_DEBUG,\n                   "Probe buffer size limit %d reached\\n", ic->probesize);\n            break;\n        }\n        ret = read_frame_internal(ic, &pkt1);\n        if (ret == AVERROR(EAGAIN))\n            continue;\n        if (ret < 0) {\n            AVPacket empty_pkt = { 0 };\n            int err = 0;\n            av_init_packet(&empty_pkt);\n            ret = -1;\n            for (i = 0; i < ic->nb_streams; i++) {\n                st = ic->streams[i];\n                if (st->info->found_decoder == 1) {\n                    do {\n                        err = try_decode_frame(ic, st, &empty_pkt,\n                                               (options && i < orig_nb_streams)\n                                               ? &options[i] : NULL);\n                    } while (err > 0 && !has_codec_parameters(st));\n                }\n                if (err < 0) {\n                    av_log(ic, AV_LOG_WARNING,\n                           "decoding for stream %d failed\\n", st->index);\n                } else if (!has_codec_parameters(st)) {\n                    char buf[256];\n                    avcodec_string(buf, sizeof(buf), st->internal->avctx, 0);\n                    av_log(ic, AV_LOG_WARNING,\n                           "Could not find codec parameters (%s)\\n", buf);\n                } else {\n                    ret = 0;\n                }\n            }\n            break;\n        }\n        pkt = &pkt1;\n        if (!(ic->flags & AVFMT_FLAG_NOBUFFER)) {\n            ret = add_to_pktbuf(&ic->internal->packet_buffer, pkt,\n                                &ic->internal->packet_buffer_end, 0);\n            if (ret < 0)\n                goto find_stream_info_err;\n        }\n        read_size += pkt->size;\n        st = ic->streams[pkt->stream_index];\n        avctx = st->internal->avctx;\n        if (!st->internal->avctx_inited) {\n            ret = avcodec_parameters_to_context(avctx, st->codecpar);\n            if (ret < 0)\n                goto find_stream_info_err;\n            st->internal->avctx_inited = 1;\n        }\n        if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) {\n            if (st->info->fps_last_dts != AV_NOPTS_VALUE &&\n                st->info->fps_last_dts >= pkt->dts) {\n                av_log(ic, AV_LOG_WARNING,\n                       "Non-increasing DTS in stream %d: packet %d with DTS "\n                       "%"PRId64", packet %d with DTS %"PRId64"\\n",\n                       st->index, st->info->fps_last_dts_idx,\n                       st->info->fps_last_dts, st->codec_info_nb_frames,\n                       pkt->dts);\n                st->info->fps_first_dts =\n                st->info->fps_last_dts  = AV_NOPTS_VALUE;\n            }\n            if (st->info->fps_last_dts != AV_NOPTS_VALUE &&\n                st->info->fps_last_dts_idx > st->info->fps_first_dts_idx &&\n                (pkt->dts - st->info->fps_last_dts) / 1000 >\n                (st->info->fps_last_dts     - st->info->fps_first_dts) /\n                (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) {\n                av_log(ic, AV_LOG_WARNING,\n                       "DTS discontinuity in stream %d: packet %d with DTS "\n                       "%"PRId64", packet %d with DTS %"PRId64"\\n",\n                       st->index, st->info->fps_last_dts_idx,\n                       st->info->fps_last_dts, st->codec_info_nb_frames,\n                       pkt->dts);\n                st->info->fps_first_dts =\n                st->info->fps_last_dts  = AV_NOPTS_VALUE;\n            }\n            if (st->info->fps_first_dts == AV_NOPTS_VALUE) {\n                st->info->fps_first_dts     = pkt->dts;\n                st->info->fps_first_dts_idx = st->codec_info_nb_frames;\n            }\n            st->info->fps_last_dts     = pkt->dts;\n            st->info->fps_last_dts_idx = st->codec_info_nb_frames;\n            if (av_rescale_q(pkt->dts - st->info->fps_first_dts, st->time_base,\n                             AV_TIME_BASE_Q) >= ic->max_analyze_duration) {\n                av_log(ic, AV_LOG_WARNING, "max_analyze_duration %d reached\\n",\n                       ic->max_analyze_duration);\n                if (ic->flags & AVFMT_FLAG_NOBUFFER)\n                    av_packet_unref(pkt);\n                break;\n            }\n        }\n        if (!st->internal->avctx->extradata) {\n            ret = extract_extradata(st, pkt);\n            if (ret < 0)\n                goto find_stream_info_err;\n        }\n        try_decode_frame(ic, st, pkt,\n                         (options && i < orig_nb_streams) ? &options[i] : NULL);\n        if (ic->flags & AVFMT_FLAG_NOBUFFER)\n            av_packet_unref(pkt);\n        st->codec_info_nb_frames++;\n        count++;\n    }\n    for (i = 0; i < ic->nb_streams; i++) {\n        st = ic->streams[i];\n        avcodec_close(st->internal->avctx);\n    }\n    for (i = 0; i < ic->nb_streams; i++) {\n        st = ic->streams[i];\n        avctx = st->internal->avctx;\n        if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {\n            if (!st->avg_frame_rate.num &&\n                st->info->fps_last_dts != st->info->fps_first_dts) {\n                int64_t delta_dts = st->info->fps_last_dts -\n                                    st->info->fps_first_dts;\n                int delta_packets = st->info->fps_last_dts_idx -\n                                    st->info->fps_first_dts_idx;\n                int best_fps      = 0;\n                double best_error = 0.01;\n                if (delta_dts     >= INT64_MAX / st->time_base.num ||\n                    delta_packets >= INT64_MAX / st->time_base.den ||\n                    delta_dts < 0)\n                    continue;\n                av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,\n                          delta_packets * (int64_t) st->time_base.den,\n                          delta_dts * (int64_t) st->time_base.num, 60000);\n                for (j = 0; j < MAX_STD_TIMEBASES; j++) {\n                    AVRational std_fps = { get_std_framerate(j), 12 * 1001 };\n                    double error       = fabs(av_q2d(st->avg_frame_rate) /\n                                              av_q2d(std_fps) - 1);\n                    if (error < best_error) {\n                        best_error = error;\n                        best_fps   = std_fps.num;\n                    }\n                }\n                if (best_fps)\n                    av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,\n                              best_fps, 12 * 1001, INT_MAX);\n            }\n        } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {\n            if (!avctx->bits_per_coded_sample)\n                avctx->bits_per_coded_sample =\n                    av_get_bits_per_sample(avctx->codec_id);\n            switch (avctx->audio_service_type) {\n            case AV_AUDIO_SERVICE_TYPE_EFFECTS:\n                st->disposition = AV_DISPOSITION_CLEAN_EFFECTS;\n                break;\n            case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:\n                st->disposition = AV_DISPOSITION_VISUAL_IMPAIRED;\n                break;\n            case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:\n                st->disposition = AV_DISPOSITION_HEARING_IMPAIRED;\n                break;\n            case AV_AUDIO_SERVICE_TYPE_COMMENTARY:\n                st->disposition = AV_DISPOSITION_COMMENT;\n                break;\n            case AV_AUDIO_SERVICE_TYPE_KARAOKE:\n                st->disposition = AV_DISPOSITION_KARAOKE;\n                break;\n            }\n        }\n    }\n    compute_chapters_end(ic);\n    for (i = 0; i < ic->nb_streams; i++) {\n        st = ic->streams[i];\n        if (!st->internal->avctx_inited)\n            continue;\n        ret = avcodec_parameters_from_context(st->codecpar, st->internal->avctx);\n        if (ret < 0)\n            goto find_stream_info_err;\n#if FF_API_LAVF_AVCTX\nFF_DISABLE_DEPRECATION_WARNINGS\n        ret = avcodec_parameters_to_context(st->codec, st->codecpar);\n        if (ret < 0)\n            goto find_stream_info_err;\n        if (st->internal->avctx->subtitle_header) {\n            st->codec->subtitle_header = av_malloc(st->internal->avctx->subtitle_header_size);\n            if (!st->codec->subtitle_header)\n                goto find_stream_info_err;\n            st->codec->subtitle_header_size = st->internal->avctx->subtitle_header_size;\n            memcpy(st->codec->subtitle_header, st->internal->avctx->subtitle_header,\n                   st->codec->subtitle_header_size);\n        }\nFF_ENABLE_DEPRECATION_WARNINGS\n#endif\n        st->internal->avctx_inited = 0;\n    }\n    estimate_timings(ic, old_offset);\nfind_stream_info_err:\n    for (i = 0; i < ic->nb_streams; i++) {\n        av_freep(&ic->streams[i]->info);\n        av_bsf_free(&ic->streams[i]->internal->extract_extradata.bsf);\n        av_packet_free(&ic->streams[i]->internal->extract_extradata.pkt);\n    }\n    return ret;\n}']