static void build_file_streams(void)
{
    FFStream *stream, *stream_next;
    AVFormatContext *infile;
    int i;
    for(stream = first_stream; stream != NULL; stream = stream_next) {
        stream_next = stream->next;
        if (stream->stream_type == STREAM_TYPE_LIVE &&
            !stream->feed) {
            stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
            if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
                stream->ap_in->mpeg2ts_raw = 1;
                stream->ap_in->mpeg2ts_compute_pcr = 1;
            }
            if (av_open_input_file(&infile, stream->feed_filename,
                                   stream->ifmt, 0, stream->ap_in) < 0) {
                http_log("%s not found", stream->feed_filename);
            fail:
                remove_stream(stream);
            } else {
                if (av_find_stream_info(infile) < 0) {
                    http_log("Could not find codec parameters from '%s'",
                             stream->feed_filename);
                    av_close_input_file(infile);
                    goto fail;
                }
                extract_mpeg4_header(infile);
                for(i=0;i<infile->nb_streams;i++)
                    add_av_stream1(stream, infile->streams[i]->codec);
                av_close_input_file(infile);
            }
        }
    }
}
['static void build_file_streams(void)\n{\n    FFStream *stream, *stream_next;\n    AVFormatContext *infile;\n    int i;\n    for(stream = first_stream; stream != NULL; stream = stream_next) {\n        stream_next = stream->next;\n        if (stream->stream_type == STREAM_TYPE_LIVE &&\n            !stream->feed) {\n            stream->ap_in = av_mallocz(sizeof(AVFormatParameters));\n            if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {\n                stream->ap_in->mpeg2ts_raw = 1;\n                stream->ap_in->mpeg2ts_compute_pcr = 1;\n            }\n            if (av_open_input_file(&infile, stream->feed_filename,\n                                   stream->ifmt, 0, stream->ap_in) < 0) {\n                http_log("%s not found", stream->feed_filename);\n            fail:\n                remove_stream(stream);\n            } else {\n                if (av_find_stream_info(infile) < 0) {\n                    http_log("Could not find codec parameters from \'%s\'",\n                             stream->feed_filename);\n                    av_close_input_file(infile);\n                    goto fail;\n                }\n                extract_mpeg4_header(infile);\n                for(i=0;i<infile->nb_streams;i++)\n                    add_av_stream1(stream, infile->streams[i]->codec);\n                av_close_input_file(infile);\n            }\n        }\n    }\n}', 'void *av_mallocz(unsigned int size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}', 'int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,\n                       AVInputFormat *fmt,\n                       int buf_size,\n                       AVFormatParameters *ap)\n{\n    int err, probe_size;\n    AVProbeData probe_data, *pd = &probe_data;\n    ByteIOContext *pb = NULL;\n    pd->filename = "";\n    if (filename)\n        pd->filename = filename;\n    pd->buf = NULL;\n    pd->buf_size = 0;\n    if (!fmt) {\n        fmt = av_probe_input_format(pd, 0);\n    }\n    if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {\n        if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {\n            goto fail;\n        }\n        if (buf_size > 0) {\n            url_setbufsize(pb, buf_size);\n        }\n        for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){\n            int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0;\n            pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE);\n            pd->buf_size = get_buffer(pb, pd->buf, probe_size);\n            memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);\n            if (url_fseek(pb, 0, SEEK_SET) < 0) {\n                url_fclose(pb);\n                if (url_fopen(&pb, filename, URL_RDONLY) < 0) {\n                    pb = NULL;\n                    err = AVERROR(EIO);\n                    goto fail;\n                }\n            }\n            fmt = av_probe_input_format2(pd, 1, &score);\n        }\n        av_freep(&pd->buf);\n    }\n    if (!fmt) {\n        err = AVERROR_NOFMT;\n        goto fail;\n    }\n    if (fmt->flags & AVFMT_NEEDNUMBER) {\n        if (!av_filename_number_test(filename)) {\n            err = AVERROR_NUMEXPECTED;\n            goto fail;\n        }\n    }\n    err = av_open_input_stream(ic_ptr, pb, filename, fmt, ap);\n    if (err)\n        goto fail;\n    return 0;\n fail:\n    av_freep(&pd->buf);\n    if (pb)\n        url_fclose(pb);\n    *ic_ptr = NULL;\n    return err;\n}', 'int url_fopen(ByteIOContext **s, const char *filename, int flags)\n{\n    URLContext *h;\n    int err;\n    err = url_open(&h, filename, flags);\n    if (err < 0)\n        return err;\n    err = url_fdopen(s, h);\n    if (err < 0) {\n        url_close(h);\n        return err;\n    }\n    return 0;\n}', 'void av_freep(void *arg)\n{\n    void **ptr= (void**)arg;\n    av_free(*ptr);\n    *ptr = NULL;\n}', 'void av_free(void *ptr)\n{\n    if (ptr)\n#ifdef CONFIG_MEMALIGN_HACK\n        free((char*)ptr - ((char*)ptr)[-1]);\n#else\n        free(ptr);\n#endif\n}', 'static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)\n{\n    va_list ap;\n    va_start(ap, fmt);\n    if (logfile) {\n        vfprintf(logfile, fmt, ap);\n        fflush(logfile);\n    }\n    va_end(ap);\n}']