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);
}
['void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)\n{\n    if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {\n        ByteIOContext pb;\n        RTSPState *rt = s->priv_data;\n        int len = strlen(p) * 6 / 8;\n        char *buf = av_mallocz(len);\n        av_base64_decode(buf, p, len);\n        if (rtp_asf_fix_header(buf, len) < 0)\n            av_log(s, AV_LOG_ERROR,\n                   "Failed to fix invalid RTSP-MS/ASF min_pktsize\\n");\n        init_packetizer(&pb, buf, len);\n        if (rt->asf_ctx) {\n            av_close_input_stream(rt->asf_ctx);\n            rt->asf_ctx = NULL;\n        }\n        av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL);\n        rt->asf_pb_pos = url_ftell(&pb);\n        av_free(buf);\n        rt->asf_ctx->pb = NULL;\n    }\n}', "int av_base64_decode(uint8_t *out, const char *in, int out_size)\n{\n    int i, v;\n    uint8_t *dst = out;\n    v = 0;\n    for (i = 0; in[i] && in[i] != '='; i++) {\n        unsigned int index= in[i]-43;\n        if (index>=FF_ARRAY_ELEMS(map2) || map2[index] == 0xff)\n            return -1;\n        v = (v << 6) + map2[index];\n        if (i & 3) {\n            if (dst - out < out_size) {\n                *dst++ = v >> (6 - 2 * (i & 3));\n            }\n        }\n    }\n    return dst - out;\n}", 'static int rtp_asf_fix_header(uint8_t *buf, int len)\n{\n    uint8_t *p = buf, *end = buf + len;\n    if (len < sizeof(ff_asf_guid) * 2 + 22 ||\n        memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) {\n        return -1;\n    }\n    p += sizeof(ff_asf_guid) + 14;\n    do {\n        uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid));\n        if (memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) {\n            if (chunksize > end - p)\n                return -1;\n            p += chunksize;\n            continue;\n        }\n        p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2;\n        if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) {\n            AV_WL32(p, 0);\n            return 0;\n        }\n        break;\n    } while (end - p >= sizeof(ff_asf_guid) + 8);\n    return -1;\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}']